network: implement btcd simnet.
This commit is contained in:
parent
f00eeba5a7
commit
45e117a186
@ -275,7 +275,7 @@ HDPrivateKey.prototype.deriveAccount44 = function deriveAccount44(accountIndex)
|
||||
assert(this.isMaster(), 'Cannot derive account index.');
|
||||
return this
|
||||
.derive(44, true)
|
||||
.derive(this.network.type === 'main' ? 0 : 1, true)
|
||||
.derive(this.network.keyPrefix.coinType, true)
|
||||
.derive(accountIndex, true);
|
||||
};
|
||||
|
||||
|
||||
@ -74,6 +74,7 @@ Network.testnet = null;
|
||||
Network.regtest = null;
|
||||
Network.segnet3 = null;
|
||||
Network.segnet4 = null;
|
||||
Network.simnet = null;
|
||||
|
||||
/**
|
||||
* Update the height of the network.
|
||||
|
||||
@ -15,7 +15,7 @@ var utils = require('../utils/utils');
|
||||
*/
|
||||
|
||||
var network = exports;
|
||||
var main, testnet, regtest, segnet3, segnet4;
|
||||
var main, testnet, regtest, segnet3, segnet4, simnet;
|
||||
|
||||
/**
|
||||
* Network type list.
|
||||
@ -374,7 +374,8 @@ main.keyPrefix = {
|
||||
xpubkey: 0x0488b21e,
|
||||
xprivkey: 0x0488ade4,
|
||||
xprivkey58: 'xprv',
|
||||
xpubkey58: 'xpub'
|
||||
xpubkey58: 'xpub',
|
||||
coinType: 0
|
||||
};
|
||||
|
||||
/**
|
||||
@ -590,7 +591,8 @@ testnet.keyPrefix = {
|
||||
xpubkey: 0x043587cf,
|
||||
xprivkey: 0x04358394,
|
||||
xprivkey58: 'tprv',
|
||||
xpubkey58: 'tpub'
|
||||
xpubkey58: 'tpub',
|
||||
coinType: 1
|
||||
};
|
||||
|
||||
testnet.addressPrefix = {
|
||||
@ -739,7 +741,8 @@ regtest.keyPrefix = {
|
||||
xpubkey: 0x043587cf,
|
||||
xprivkey: 0x04358394,
|
||||
xprivkey58: 'tprv',
|
||||
xpubkey58: 'tpub'
|
||||
xpubkey58: 'tpub',
|
||||
coinType: 1
|
||||
};
|
||||
|
||||
regtest.addressPrefix = {
|
||||
@ -862,7 +865,8 @@ segnet3.keyPrefix = {
|
||||
xpubkey: 0x053587cf,
|
||||
xprivkey: 0x05358394,
|
||||
xprivkey58: '2791',
|
||||
xpubkey58: '2793'
|
||||
xpubkey58: '2793',
|
||||
coinType: 1
|
||||
};
|
||||
|
||||
segnet3.addressPrefix = {
|
||||
@ -1004,7 +1008,8 @@ segnet4.keyPrefix = {
|
||||
xpubkey: 0x053587cf,
|
||||
xprivkey: 0x05358394,
|
||||
xprivkey58: '2791',
|
||||
xpubkey58: '2793'
|
||||
xpubkey58: '2793',
|
||||
coinType: 1
|
||||
};
|
||||
|
||||
segnet4.addressPrefix = {
|
||||
@ -1034,3 +1039,154 @@ segnet4.batchSize = [
|
||||
[17000, 500],
|
||||
[250]
|
||||
];
|
||||
|
||||
/*
|
||||
* Simnet (btcd)
|
||||
*/
|
||||
|
||||
simnet = network.simnet = {};
|
||||
|
||||
simnet.type = 'simnet';
|
||||
|
||||
simnet.height = -1;
|
||||
|
||||
simnet.seeds = [
|
||||
'127.0.0.1'
|
||||
];
|
||||
|
||||
simnet.magic = 0x12141c16;
|
||||
|
||||
simnet.port = 18555;
|
||||
|
||||
simnet.alertKey = new Buffer(''
|
||||
+ '04302390343f91cc401d56d68b123028bf52e5f'
|
||||
+ 'ca1939df127f63c6467cdf9c8e2c14b61104cf8'
|
||||
+ '17d0b780da337893ecc4aaff1309e536162dabb'
|
||||
+ 'db45200ca2b0a',
|
||||
'hex');
|
||||
|
||||
simnet.checkpoints = {};
|
||||
|
||||
simnet.checkpoints.lastHeight = 0;
|
||||
|
||||
simnet.halvingInterval = 210000;
|
||||
|
||||
simnet.genesis = {
|
||||
version: 1,
|
||||
hash: 'f67ad7695d9b662a72ff3d8edbbb2de0bfa67b13974bb9910d116d5cbd863e68',
|
||||
prevBlock: '0000000000000000000000000000000000000000000000000000000000000000',
|
||||
merkleRoot: '3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a',
|
||||
ts: 1401292357,
|
||||
bits: 545259519,
|
||||
nonce: 2
|
||||
};
|
||||
|
||||
simnet.genesisBlock =
|
||||
'0100000000000000000000000000000000000000000000000000000000000000000000'
|
||||
+ '003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a4506'
|
||||
+ '8653ffff7f200200000001010000000100000000000000000000000000000000000000'
|
||||
+ '00000000000000000000000000ffffffff4d04ffff001d0104455468652054696d6573'
|
||||
+ '2030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66'
|
||||
+ '207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01'
|
||||
+ '000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f'
|
||||
+ '61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f'
|
||||
+ 'ac00000000';
|
||||
|
||||
simnet.pow = {
|
||||
limit: new bn(
|
||||
// High target of 0x207fffff (545259519)
|
||||
'7fffff0000000000000000000000000000000000000000000000000000000000',
|
||||
'hex'
|
||||
),
|
||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
||||
targetSpacing: 10 * 60,
|
||||
allowMinDifficultyBlocks: true,
|
||||
noRetargeting: false
|
||||
};
|
||||
|
||||
simnet.pow.retargetInterval = simnet.pow.targetTimespan / simnet.pow.targetSpacing | 0;
|
||||
|
||||
simnet.pow.bits = utils.toCompact(simnet.pow.limit);
|
||||
|
||||
simnet.block = {
|
||||
majorityEnforceUpgrade: 51,
|
||||
majorityRejectOutdated: 75,
|
||||
majorityWindow: 100,
|
||||
bip34height: -1,
|
||||
bip34hash: null,
|
||||
pruneAfterHeight: 1000,
|
||||
maxTipAge: 0x7fffffff,
|
||||
slowHeight: 0
|
||||
};
|
||||
|
||||
simnet.witness = false;
|
||||
|
||||
simnet.oldWitness = false;
|
||||
|
||||
simnet.activationThreshold = 1512; // 75% for testchains
|
||||
|
||||
simnet.minerWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
|
||||
|
||||
simnet.deployments = {
|
||||
testdummy: {
|
||||
bit: 28,
|
||||
startTime: 1199145601, // January 1, 2008
|
||||
timeout: 1230767999, // December 31, 2008
|
||||
force: true
|
||||
},
|
||||
csv: {
|
||||
bit: 0,
|
||||
startTime: 1456790400, // March 1st, 2016
|
||||
timeout: 1493596800, // May 1st, 2017
|
||||
force: true
|
||||
},
|
||||
witness: {
|
||||
bit: 1,
|
||||
startTime: 1462060800, // May 1st 2016
|
||||
timeout: 1493596800, // May 1st 2017
|
||||
force: false
|
||||
},
|
||||
mast: {
|
||||
bit: 2,
|
||||
startTime: 2000000000, // Far in the future
|
||||
timeout: 2100000000,
|
||||
force: false
|
||||
}
|
||||
};
|
||||
|
||||
simnet.keyPrefix = {
|
||||
privkey: 100,
|
||||
xpubkey: 0x0420bd3a,
|
||||
xprivkey: 0x0420b900,
|
||||
xprivkey58: 'sprv',
|
||||
xpubkey58: 'spub',
|
||||
coinType: 115
|
||||
};
|
||||
|
||||
simnet.addressPrefix = {
|
||||
pubkeyhash: 63,
|
||||
scripthash: 123,
|
||||
witnesspubkeyhash: 3,
|
||||
witnessscripthash: 40
|
||||
};
|
||||
|
||||
simnet.requireStandard = false;
|
||||
|
||||
simnet.rpcPort = 18556;
|
||||
|
||||
simnet.minRelay = 10000;
|
||||
|
||||
simnet.feeRate = 20000;
|
||||
|
||||
simnet.minRate = 10000;
|
||||
|
||||
simnet.maxRate = 40000;
|
||||
|
||||
simnet.selfConnect = true;
|
||||
|
||||
simnet.requestMempool = false;
|
||||
|
||||
simnet.batchSize = [
|
||||
[100000, 500],
|
||||
[250]
|
||||
];
|
||||
|
||||
@ -102,6 +102,13 @@ var segnet4 = createGenesisBlock({
|
||||
nonce: 0
|
||||
});
|
||||
|
||||
var btcd = createGenesisBlock({
|
||||
version: 1,
|
||||
ts: 1401292357,
|
||||
bits: 545259519,
|
||||
nonce: 2
|
||||
});
|
||||
|
||||
utils.log(main);
|
||||
utils.log('');
|
||||
utils.log(testnet);
|
||||
@ -127,3 +134,6 @@ utils.log('segnet3 raw: %s', segnet3.toRaw().toString('hex'));
|
||||
utils.log('');
|
||||
utils.log('segnet4 hash: %s', segnet4.rhash);
|
||||
utils.log('segnet4 raw: %s', segnet4.toRaw().toString('hex'));
|
||||
utils.log('');
|
||||
utils.log('btcd simnet hash: %s', btcd.rhash);
|
||||
utils.log('btcd simnet raw: %s', btcd.toRaw().toString('hex'));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user