14 Network Parameters¶
A Decred network is an independent chain together with the peers that relay it: it has its own genesis block, its own consensus constants and its own encodings for addresses and keys. dcrd defines four networks, and every constant that differs between them is a field of the structure chaincfg.Params. The rest of this document names such a constant in the form TicketMaturity and quotes its main-network value; this chapter gives every field for every network, the quantities that follow from them, the genesis blocks, and the few network-specific rules that dcrd hard-codes outside the parameter structure.
14.1 The Four Networks¶
Table 14.1 summarizes the networks.
- The main network (
mainnet) is the production network that carries the DCR currency. - The test network, version 3 (
testnet3), is a public network for testing software against realistic conditions with coins of no value. dcrd describes it as the third public iteration of the test network. Its predecessors are not defined in the current source; a remark in the block-size code notes that themaxblocksizevote took place on an earlier version of the test network that has since been replaced. - The simulation network (
simnet) is meant for private use by a group of people running full integration tests between applications such as wallets, voting service providers, pools and block explorers. It has no seeds, so its nodes connect only to peers named explicitly, and its parameters make blocks, ticket maturity and voting intervals very short. - The regression test network (
regnet) is meant for unit tests and RPC server tests. dcrd states that its values may change even when the change is a hard fork. When started on regnet, dcrd deletes any existing block and UTXO databases, so every run begins again from the genesis block.
| mainnet | testnet3 | simnet | regnet | |
|---|---|---|---|---|
Name | mainnet | testnet3 | simnet | regnet |
Magic (Net) | 0xd9b400f9 | 0xb194aa75 | 0x12141c16 | 0xdab500fa |
P2P port (DefaultPort) | 9108 | 19108 | 18555 | 18655 |
RPC port (not in chaincfg) | 9109 | 19109 | 19556 | 18656 |
Address prefix (NetworkAddressPrefix) | D | T | S | R |
| Target block time | 5 min | 2 min | 1 s | 1 s |
| Genesis timestamp (UTC) | 2016-02-08 | 2018-08-06 | 2014-05-28 | 2018-10-03 |
Nodes of different networks are kept apart at three levels.
- Network magic
- Every peer-to-peer message begins with the 4-byte network magic
Net, auint32serialized little-endian. A node reading a message whose magic differs from its own network’s treats the message as coming from another network and fails the read (Chapter 15). - Genesis block
- Each network has its own genesis block (Section 14.6), so no block of one network can extend the chain of another: every chain is anchored to its network’s genesis hash.
- Encodings
- Addresses, WIF private keys and extended keys carry network-specific version bytes (Table 14.16), so that a string produced for one network fails to decode on another and funds are not sent to an address on the wrong network by mistake.
The RPC ports in Table 14.1 are defined by the dcrd application rather than by chaincfg. Like the peer-to-peer port, they are defaults that an operator may change. Source: params.go.
14.2 Reading the Parameter Tables¶
chaincfg.Params has 85 fields at the reference commit, including the unexported field seeders. Each appears exactly once in Table 14.2 to Table 14.16, grouped by theme, with its dcrd field name, a one-line meaning and its value on each network. A value that is the same on all four networks is printed once across the four value columns. Values too long for a column (hashes, scripts, keys, 256-bit integers) are given in separate tables referenced from the cell. The tables were produced by a program that imports dcrd’s chaincfg package and walks the structure by reflection, refusing to run if any field is not covered; no value was transcribed by hand.
Beside each field name a tag says how dcrd uses it:
- consensus
- read by the validation code; an implementation MUST use the value exactly.
- node
- used for networking, synchronization or RPC; not part of consensus.
- policy
- a default for mempool and relay policy (Chapter 17).
- encoding
- used to encode and decode addresses and keys (Chapter 5).
- unused
- not read anywhere in dcrd at the reference commit.
Durations are given in seconds, with the equivalent in larger units below; amounts are in atoms with the DCR equivalent below. Compact difficulty values (“bits”, Chapter 9) are given in hexadecimal.
Implementation pitfall
Several doc comments inchaincfg/params.go do not match how the field is used, and a field’s “deprecated” marking does not mean it is unused. In particular: WorkRewardProportion, StakeRewardProportion and BlockTaxProportion are marked deprecated but define the original subsidy split, which still governs every block before the DCP-0010 agenda activated, and the treasury share in every era is still BlockTaxProportion divided by the sum of the three (Chapter 11); BlockTaxProportion is documented as an inverse percentage but is used as a proportion (1 of a total of 10); the V2 proportions are not read at all; WorkDiffWindowSize is documented as a number of windows but is the number of blocks per window; and ReduceMinDifficulty is deprecated but still consensus-critical on testnet3. The tags in the tables reflect use, not comments.14.3 Parameter Tables¶
14.3.1 Identity, Peer-to-Peer and Policy¶
| Field and meaning | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
Name NODEHuman-readable identifier of the network. | mainnet | testnet3 | simnet | regnet |
Net NODENetwork magic: the uint32 that begins every peer-to-peer message header, serialized little-endian (byte order shown below the value). Consensus code also uses it to identify the network for the hard-coded exceptions of Section 14.5. | 0xd9b400f9 wire: f9 00 b4 d9 | 0xb194aa75 wire: 75 aa 94 b1 | 0x12141c16 wire: 16 1c 14 12 | 0xdab500fa wire: fa 00 b5 da |
DefaultPort NODEDefault TCP port for peer-to-peer connections. | 9108 | 19108 | 18555 | 18655 |
DNSSeeds UNUSEDDeprecated list of DNS seed host names (with a flag for service-flag filtering support); dcrd no longer reads it. Listed in Table 14.3. | 3 entries | 3 entries | 0 entries | 0 entries |
seeders NODEUnexported list of HTTPS seeder host names that dcrd queries for peer addresses (accessor Seeders()). Listed in Table 14.3. | 4 entries | 3 entries | 0 entries | 0 entries |
GenerateSupported NODEWhether the node’s built-in CPU mining RPC is permitted. | false | true | true | true |
AcceptNonStdTxs POLICYDefault for the mempool option to accept and relay non-standard transactions. | false | true | true | true |
| Field | Network | Value |
|---|---|---|
DNSSeeds | mainnet | mainnet-seed.decred.mindcry.org (HasFiltering: true) |
| mainnet | mainnet-seed.decred.netpurgatory.com (HasFiltering: true) | |
| mainnet | mainnet-seed.decred.org (HasFiltering: true) | |
| testnet3 | testnet-seed.decred.mindcry.org (HasFiltering: true) | |
| testnet3 | testnet-seed.decred.netpurgatory.com (HasFiltering: true) | |
| testnet3 | testnet-seed.decred.org (HasFiltering: true) | |
| simnet | none | |
| regnet | none | |
seeders | mainnet | mainnet-seed-1.decred.org |
| mainnet | mainnet-seed-2.decred.org | |
| mainnet | mainnet-seed.jholdstock.uk | |
| mainnet | dcr-seed.jz.bz | |
| testnet3 | testnet-seed-1.decred.org | |
| testnet3 | testnet-seed-2.decred.org | |
| testnet3 | testnet-seed.jholdstock.uk | |
| simnet | none | |
| regnet | none |
The seed host names are informative: they are how dcrd bootstraps peer discovery, not part of the protocol. The DNSSeeds list is retained in the structure for compatibility only.
14.3.2 Genesis¶
| Field and meaning | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
GenesisBlock CONSENSUSThe block at height 0. Specified field by field in Section 14.6. | see Section 14.6 | |||
GenesisHash CONSENSUSHash of the genesis block header (display form in Table 14.23). | see Table 14.23 | |||
14.3.3 Block Limits and Proof of Work¶
| Field and meaning | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
MaximumBlockSizes CONSENSUSMaximum serialized block size in bytes. The first entry applies by default; the second, where present, applies once the maxblocksize agenda is active. | 393216 | 1310720 | 1000000, 1310720 | 1000000, 1310720 |
MaxTxSize CONSENSUSMaximum serialized transaction size in bytes. | 393216 | 1000000 | 1000000 | 1000000 |
TargetTimePerBlock CONSENSUSTarget interval between blocks. | 300 s 5 min | 120 s 2 min | 1 s | 1 s |
PowLimit CONSENSUSHighest permitted proof-of-work target, as a 256-bit integer (full hexadecimal in Table 14.6). | 2^224 - 1 | 2^232 - 1 | 2^255 - 1 | 2^255 - 1 |
PowLimitBits CONSENSUSPowLimit in compact form; because of the compact format’s limited precision it is not exactly equal to PowLimit (expanded value in Table 14.6). | 0x1d00ffff | 0x1e00ffff | 0x207fffff | 0x207fffff |
ReduceMinDifficulty CONSENSUSDeprecated. Whether the minimum-difficulty reduction of test networks applies (testnet3 only, and only below a hard-coded height; see Section 14.5). | false | true | false | false |
MinDiffReductionTime CONSENSUSDeprecated. Time without a block after which the minimum-difficulty reduction applies, when ReduceMinDifficulty is set. | 0 s | 600 s 10 min | 0 s | 0 s |
WorkDiffAlpha CONSENSUSVersion 1 (BLAKE-256) difficulty algorithm: smoothing value of the weighted average. | 1 | |||
WorkDiffWindowSize CONSENSUSVersion 1 algorithm: number of blocks in one window, which is also the retarget interval. (The doc comment in dcrd wrongly calls it a number of windows.) | 144 | 144 | 8 | 8 |
WorkDiffWindows CONSENSUSVersion 1 algorithm: number of windows in the weighted average. | 20 | 20 | 4 | 4 |
TargetTimespan CONSENSUSVersion 1 algorithm: target duration of one window, equal to WorkDiffWindowSize times TargetTimePerBlock. | 43200 s 12 h | 17280 s 288 min | 8 s | 8 s |
RetargetAdjustmentFactor CONSENSUSVersion 1 algorithm: bound on the factor by which the difficulty may change at one retarget. The original (version 1) stake difficulty algorithm uses the same bound. | 4 | |||
WorkDiffV2Blake3StartBits CONSENSUSVersion 2 (ASERT, BLAKE3) algorithm: target, in compact form, used at the start of BLAKE3 proof of work. | 0x1b00a5a6 | 0x1e00ffff | 0x207fffff | 0x207fffff |
WorkDiffV2HalfLifeSecs CONSENSUSVersion 2 algorithm: half-life in seconds; the difficulty halves or doubles for every multiple of this time the chain is behind or ahead of schedule. | 43200 12 h | 720 12 min | 6 | 6 |
PowLimit, and the compact values PowLimitBits and WorkDiffV2Blake3StartBits expanded, as 256-bit integers in big-endian hexadecimal| Field | Network | Value |
|---|---|---|
PowLimit | mainnet | 00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| testnet3 | 000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | |
| simnet | 7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | |
| regnet | 7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | |
PowLimitBits | mainnet | 00000000ffff0000000000000000000000000000000000000000000000000000 |
| testnet3 | 000000ffff000000000000000000000000000000000000000000000000000000 | |
| simnet | 7fffff0000000000000000000000000000000000000000000000000000000000 | |
| regnet | 7fffff0000000000000000000000000000000000000000000000000000000000 | |
WorkDiffV2Blake3StartBits | mainnet | 000000000000a5a6000000000000000000000000000000000000000000000000 |
| testnet3 | 000000ffff000000000000000000000000000000000000000000000000000000 | |
| simnet | 7fffff0000000000000000000000000000000000000000000000000000000000 | |
| regnet | 7fffff0000000000000000000000000000000000000000000000000000000000 |
MaximumBlockSizes has a second entry only on simnet and regnet. dcrd selects the second entry for a block when the maxblocksize agenda is active for it and the list has more than one entry, and the first entry otherwise (internal/blockchain/chain.go · maxBlockSize). Since an agenda that has no deployment on a network other than mainnet is treated as always active (Section 14.3.6), testnet3 would select a second entry if it had one; it does not, so its limit is always 1310720 bytes. The proof-of-work algorithms that use these parameters are specified in Chapter 9.
14.3.4 Subsidy¶
| Field and meaning | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
BaseSubsidy CONSENSUSBlock subsidy, in atoms, before any reduction. | 3119582664 31.19582664 DCR | 2500000000 25 DCR | 50000000000 500 DCR | 50000000000 500 DCR |
MulSubsidy CONSENSUSMultiplier applied to the subsidy at each reduction. | 100 | |||
DivSubsidy CONSENSUSDivisor applied to the subsidy at each reduction (after the multiplication). | 101 | |||
SubsidyReductionInterval CONSENSUSNumber of blocks between subsidy reductions. | 6144 | 2048 | 128 | 128 |
WorkRewardProportion CONSENSUSProof-of-work share of the original subsidy split, as a proportion of the sum WorkRewardProportion + StakeRewardProportion + BlockTaxProportion. Marked deprecated in dcrd but still read by the original split. | 6 | |||
StakeRewardProportion CONSENSUSProof-of-stake (all votes of a block together) share of the original split, as a proportion of the same sum. | 3 | |||
BlockTaxProportion CONSENSUSTreasury share, as a proportion of the same sum, in every era: the later splits change only the proof-of-work and proof-of-stake shares. (The doc comment in dcrd describes it as an inverse percentage, which does not match its use.) | 1 | |||
WorkRewardProportionV2 UNUSEDProof-of-work proportion of the DCP-0010 split. Not read: the DCP-0010 and DCP-0012 splits are hard-coded in the subsidy code (Chapter 11). | 1 | |||
StakeRewardProportionV2 UNUSEDProof-of-stake proportion of the DCP-0010 split. Not read, as for WorkRewardProportionV2. | 8 | |||
OrganizationPkScript CONSENSUSOutput script that the treasury share of the coinbase must pay before the treasury agenda (DCP-0006) is active (Table 14.8). | see Table 14.8 | |||
OrganizationPkScriptVersion CONSENSUSScript version required on that coinbase output. | 0 | |||
BlockOneLedger CONSENSUSOutputs (script version, script, amount) that the coinbase of block 1 must pay exactly. Contents in Chapter 11; count and total in Section 14.7. | 3146 outputs | 2 outputs | 3 outputs | 3 outputs |
| Field | Network | Value |
|---|---|---|
OrganizationPkScript | mainnet | a914f5916158e3e2c4551c1796708db8367207ed13bb87OP_HASH160 f5916158e3e2c4551c1796708db8367207ed13bb OP_EQUALaddress Dcur2mcGjmENx4DhNqDctW5wJCVyT3Qeqkx |
| testnet3 | a914d585cd7426d25b4ea5faf1e6987aacfeda3db94287OP_HASH160 d585cd7426d25b4ea5faf1e6987aacfeda3db942 OP_EQUALaddress TcrypGAcGCRVXrES7hWqVZb5oLJKCZEtoL1 | |
| simnet | a914cbb08d6ca783b533b2c7d24a51fbca92d937bf9987OP_HASH160 cbb08d6ca783b533b2c7d24a51fbca92d937bf99 OP_EQUALaddress ScuQxvveKGfpG1ypt6u27F99Anf7EW3cqhq | |
| regnet | a9146913bcc838bd0087fb3f6b3c868423d5e300078d87OP_HASH160 6913bcc838bd0087fb3f6b3c868423d5e300078d OP_EQUALaddress RcQR65gasxuzf7mUeBXeAux6Z37joPuUwUN |
The organization script is the pay-to-script-hash output to which the treasury share of every coinbase was paid before the decentralized treasury (DCP-0006, Chapter 12) replaced it with a treasury base. How the subsidy parameters are combined is specified in Chapter 11.
14.3.5 Proof of Stake¶
| Field and meaning | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
MinimumStakeDiff CONSENSUSMinimum ticket price (stake difficulty) in atoms. | 200000000 2 DCR | 20000000 0.2 DCR | 20000 0.0002 DCR | 20000 0.0002 DCR |
TicketPoolSize CONSENSUSTicket pool size in units of blocks: the stake difficulty algorithms target a live pool of TicketPoolSize times TicketsPerBlock tickets. | 8192 | 1024 | 64 | 64 |
TicketsPerBlock CONSENSUSNumber of tickets selected to vote on each block, which is also the maximum number of votes a block may contain. | 5 | |||
TicketMaturity CONSENSUSNumber of blocks for a ticket to mature after the block that includes it (exact semantics in Chapter 8). | 256 | 16 | 16 | 16 |
TicketExpiry CONSENSUSNumber of blocks after maturity after which a ticket that has not been selected expires. | 40960 | 6144 | 384 | 384 |
CoinbaseMaturity CONSENSUSMaturity depth, in blocks, for spending coinbase outputs; also the depth for vote and revocation outputs once the treasury agenda is active, and for treasury balance changes (Chapter 7, Chapter 12). | 256 | 16 | 16 | 16 |
SStxChangeMaturity CONSENSUSMaturity depth for ticket change outputs, and for vote and revocation outputs before the treasury agenda is active. | 1 | |||
TicketPoolSizeWeight CONSENSUSWeight applied to the pool-size deviation in version 1 of the stake difficulty algorithm; not read by version 2. | 4 | |||
StakeDiffAlpha CONSENSUSSmoothing value of the original (version 1) stake difficulty algorithm. | 1 | |||
StakeDiffWindowSize CONSENSUSNumber of blocks in one stake difficulty window; the ticket price changes only at multiples of this height. | 144 | 144 | 8 | 8 |
StakeDiffWindows CONSENSUSNumber of windows in the weighted average of version 1 of the stake difficulty algorithm; not read by version 2. | 20 | 20 | 8 | 8 |
MaxFreshStakePerBlock CONSENSUSMaximum number of ticket purchases a block may contain. | 20 | |||
StakeEnabledHeight CONSENSUSFirst height at which a ticket can be live (the earliest possible maturity). | 512 | 32 | 32 | 32 |
StakeValidationHeight CONSENSUSFirst height whose block must contain votes (at least a majority of TicketsPerBlock). Those votes are on the block one below, which is the first block voted on and the first on which the ticket lottery runs. (The doc comment in dcrd says the block at this height contains no votes, which does not match the code.) | 4096 | 768 | 144 | 144 |
StakeBaseSigScript CONSENSUSRequired signature script of the stakebase input of every vote. | 0000 | 0000 | 0000 | 7357 |
The stake system that these parameters configure is specified in Chapter 8; the two stake difficulty algorithms are in Chapter 9. Regnet’s StakeBaseSigScript is 7357, unlike the 0000 of the other networks; a vote on regnet MUST carry exactly those two bytes.
14.3.6 Voting, Versions and Upgrades¶
| Field and meaning | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
StakeVersionInterval CONSENSUSNumber of blocks in a stake version interval. | 2016 | 2016 | 112 | 112 |
StakeMajorityMultiplier CONSENSUSNumerator of the stake-version majority fraction. | 3 | |||
StakeMajorityDivisor CONSENSUSDenominator of the stake-version majority fraction. | 4 | |||
RuleChangeActivationQuorum CONSENSUSMinimum number of non-abstaining votes in a rule change interval for an agenda vote to count. | 4032 | 2520 | 160 | 160 |
RuleChangeActivationMultiplier CONSENSUSNumerator of the fraction of non-abstaining votes a choice needs to win. | 3 | |||
RuleChangeActivationDivisor CONSENSUSDenominator of that fraction. | 4 | |||
RuleChangeActivationInterval CONSENSUSNumber of blocks in a rule change interval. | 8064 | 5040 | 320 | 320 |
Deployments CONSENSUSAgendas keyed by stake version. Summary in Table 14.11; full definitions in Chapter 13. | 13 agendas | 12 agendas | 13 agendas | 13 agendas |
BlockEnforceNumRequired CONSENSUSLegacy block-version upgrade: number of recent blocks at a version needed to enforce rules of that version. | 750 | 51 | 51 | 51 |
BlockRejectNumRequired CONSENSUSLegacy block-version upgrade: number of recent blocks at a higher version needed to reject older block versions. | 950 | 75 | 75 | 75 |
BlockUpgradeNumToCheck CONSENSUSLegacy block-version upgrade: number of most recent blocks examined. | 1000 | 100 | 100 | 100 |
Table 14.11 summarizes Deployments. Each cell gives the stake version under which the agenda is defined and its vote mask, and below it either the median-time voting period (start and expiry dates, UTC), the forced choice, or “start 0, never expires” for agendas that are always open for voting. The agenda definitions in full (descriptions, choices and bits), the voting rules, and the outcome of every vote are owned by Chapter 13.
| Agenda | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
maxblocksize | absent never active | absent always active | v4 0x0006 forced: yes | v4 0x0006 start 0, never expires |
sdiffalgorithm | v4 0x0006 2017-04-26 to 2018-04-26 | v5 0x0006 forced: yes | v5 0x0006 forced: yes | v5 0x0006 start 0, never expires |
lnsupportno consensus effect | v4 0x0018 2017-04-26 to 2017-10-26 | absent | absent | absent |
lnfeatures | v5 0x0006 2017-09-13 to 2018-09-13 | v6 0x0006 forced: yes | v6 0x0006 forced: yes | v6 0x0006 start 0, never expires |
fixlnseqlocks | v6 0x0006 2019-01-28 to 2020-01-28 | v7 0x0006 2019-01-28 to 2020-01-28 | v7 0x0006 forced: yes | v7 0x0006 start 0, never expires |
headercommitments | v7 0x0006 2019-09-05 to 2020-09-05 | v8 0x0006 2019-09-05 to 2020-09-05 | v8 0x0006 forced: yes | v8 0x0006 start 0, never expires |
treasury | v8 0x0006 2020-08-01 to 2021-08-01 | v9 0x0006 2020-08-01 to 2021-08-01 | v9 0x0006 forced: yes | v9 0x0006 start 0, never expires |
reverttreasurypolicy | v9 0x0006 2021-09-16 to 2023-09-16 | v10 0x0006 2021-09-16 to 2023-09-16 | v10 0x0006 forced: yes | v10 0x0006 start 0, never expires |
explicitverupgrades | v9 0x0018 2021-09-16 to 2023-09-16 | v10 0x0018 2021-09-16 to 2023-09-16 | v10 0x0018 forced: yes | v10 0x0018 start 0, never expires |
autorevocations | v9 0x0060 2021-09-16 to 2023-09-16 | v10 0x0060 2021-09-16 to 2023-09-16 | v10 0x0060 forced: yes | v10 0x0060 start 0, never expires |
changesubsidysplit | v9 0x0180 2021-09-16 to 2023-09-16 | v10 0x0180 2021-09-16 to 2023-09-16 | v10 0x0180 forced: yes | v10 0x0180 start 0, never expires |
blake3pow | v10 0x0006 2023-04-24 to 2025-04-24 | v11 0x0006 2023-04-24 to 2025-04-24 | v11 0x0006 forced: yes | v11 0x0006 start 0, never expires |
changesubsidysplitr2 | v10 0x0060 2023-04-24 to 2025-04-24 | v11 0x0060 2023-04-24 to 2025-04-24 | v11 0x0060 forced: yes | v11 0x0060 start 0, never expires |
maxtreasuryspend | v11 0x0006 2025-11-13 to 2027-11-13 | v12 0x0006 2025-11-13 to 2027-11-13 | v12 0x0006 forced: yes | v12 0x0006 start 0, never expires |
dcrd maintains a list of the agenda identifiers that influence consensus (every row except lnsupport, whose vote only requested development work). When such an agenda has no deployment in a network’s parameters, dcrd creates a default one that is never active on the main network and always active on every other network; these are the cells marked “absent” with “never active” or “always active” (internal/blockchain/agendas.go · requiredAgendaIDs). A forced choice makes the agenda behave as if that choice had won, without a vote; simnet uses this for every agenda and testnet3 for its two oldest, to activate rules that mainnet adopted by vote. Regnet defines every agenda without a forced choice, so on regnet each rule change is put to an actual vote.
Note
On mainnet and testnet3 dcrd also records the outcome of past votes as historical facts (the block at which each agenda’s activation was determined), which lets it decide activation without re-tallying votes. This list lives ininternal/blockchain/agendas.go · makeHistoricalAgendas rather than in chaincfg and is described in Chapter 13.14.3.7 Treasury¶
| Field and meaning | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
PiKeys CONSENSUSPublic keys authorized to sign treasury spends (Table 14.13). | 2 keys | |||
TreasuryVoteInterval CONSENSUSTreasury vote interval (TVI) in blocks: treasury spends may only be included at heights that are non-zero multiples of it. | 288 | 60 | 48 | 4 |
TreasuryVoteIntervalMultiplier CONSENSUSNumber of TVIs in a treasury spend voting window. | 12 | 4 | 3 | 3 |
TreasuryVoteQuorumMultiplier CONSENSUSNumerator of the treasury spend quorum, as a fraction of the votes possible in the voting window. | 1 | |||
TreasuryVoteQuorumDivisor CONSENSUSDenominator of that quorum. | 5 | |||
TreasuryVoteRequiredMultiplier CONSENSUSNumerator of the fraction of yes votes a treasury spend requires. | 3 | |||
TreasuryVoteRequiredDivisor CONSENSUSDenominator of that fraction. | 5 | |||
TreasuryExpenditureWindow CONSENSUSNumber of voting windows (TVI times multiplier) in one expenditure policy window. | 2 | 4 | 4 | 4 |
TreasuryExpenditurePolicy CONSENSUSOriginal (DCP-0006) policy only: number of earlier expenditure windows averaged. | 6 | 3 | 3 | 3 |
TreasuryExpenditureBootstrap CONSENSUSOriginal (DCP-0006) policy only: average expenditure, in atoms, assumed when none of those windows contains a treasury spend. | 1600000000000 16000 DCR | 1000000000000 10000 DCR | 10000000000 100 DCR | 10000000000 100 DCR |
| Field | Network | Value |
|---|---|---|
PiKeys[0] | mainnet | 03f6e7041f1cf51ee10e0a01cd2b0385ce3cd9debaabb2296f7e9dee9329da946c |
PiKeys[1] | mainnet | 0319a37405cb4d1691971847d7719cfce70857c0f6e97d7c9174a3998cf0ab86dd |
PiKeys[0] | testnet3 | 03beca9bbd227ca6bb5a58e03a36ba2b52fff09093bd7a50aee1193bccd257fb8a |
PiKeys[1] | testnet3 | 03e647c014f55265da506781f0b2d67674c35cb59b873d9926d483c4ced9a7bbd3 |
PiKeys[0] | simnet | 02a36b785d584555696b69d1b2bbeff4010332b301e3edd316d79438554cacb3e7 |
PiKeys[1] | simnet | 02b2c110e7b560aa9e1545dd18dd9f7e74a3ba036297a696050c0256f1f69479d7 |
PiKeys[0] | regnet | 03b459ccf3ce4935a676414fd9ec93ecf7c9dad081a52ed6993bf073c627499388 |
PiKeys[1] | regnet | 02e3af1209f4d39dd8b448ef0a5375befa85bbc50be0aa0936379d67444184a2c3 |
The treasury rules are specified in Chapter 12. All three expenditure policies measure spending over a policy window whose length in blocks is the product of TreasuryVoteInterval, TreasuryVoteIntervalMultiplier and TreasuryExpenditureWindow. Of the remaining parameters, only the original DCP-0006 policy uses TreasuryExpenditurePolicy and TreasuryExpenditureBootstrap; the DCP-0007 policy uses neither; the DCP-0013 policy has no parameters of its own in chaincfg and derives a floor for its limit from BaseSubsidy (Table 14.18). For simnet and regnet, the private keys belonging to the two Pi keys are published in the dcrd source, so anyone can sign treasury spends on those networks.
14.3.8 Checkpoints and Synchronization¶
| Field and meaning | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
Checkpoints UNUSEDDeprecated. Formerly the manual checkpoints; empty on every network and not read. | empty | |||
AssumeValid NODEHash of an externally verified block; some checks are skipped for its ancestors, and it anchors the rejection of old forks (Chapter 10). The fork rejection decides which blocks a node accepts, so an implementation that omits it accepts side-chain blocks that dcrd rejects; the check uses this hard-coded value, not an operator’s override, and --allowoldforks disables it. All zero means not set. | see Table 14.15 | see Table 14.15 | zero (unset) | zero (unset) |
MinKnownChainWork NODEMinimum total chain work known at release time, used during initial synchronization. Unset on simnet and regnet. | see Table 14.15 | see Table 14.15 | nil (unset) | nil (unset) |
| Field | Network | Value |
|---|---|---|
AssumeValid | mainnet | 458d6a8e11c916d4149ca8bc5c7aaaaf16cc61971b0c20764c07edf85df44eb6 |
| testnet3 | e5d29f04aa33d19dfe4935ca2e70d8f640a7263b653f57ce600b6829d6f2cf48 | |
MinKnownChainWork | mainnet | 000000000000000000000000000000000000000000243868232c14b8224643b6 |
| testnet3 | 000000000000000000000000000000000000000000000000f377240e146195df |
None of the networks has manual checkpoints any longer. The assume-valid block and the minimum known chain work are refreshed with dcrd releases and are not consensus rules in themselves; how the assume-valid block anchors the rejection of old forks, and that this rejection is disabled when AssumeValid is zero (simnet and regnet), is specified in Chapter 10.
Implementation pitfall
Since theblake3pow agenda (DCP-0011) the proof of work is checked against a BLAKE3 hash of the header, while the block hash that identifies a block is still the BLAKE-256 hash (Chapter 9). Block hashes of blocks mined since then in general do not begin with zeros, as the assume-valid hashes in Table 14.15 show. An implementation that sanity-checks block hashes for leading zeros rejects the current chain.14.3.9 Address and Key Encoding¶
| Field and meaning | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
NetworkAddressPrefix ENCODINGFirst character of every address on the network. Not read by dcrd itself; the character follows from the address prefixes. | D | T | S | R |
PubKeyAddrID ENCODINGTwo-byte prefix of pay-to-pubkey addresses (all three signature types). | 0x1386 | 0x28f7 | 0x276f | 0x25e5 |
PubKeyHashAddrID ENCODINGPrefix of pay-to-pubkey-hash addresses, secp256k1 ECDSA. | 0x073f | 0x0f21 | 0x0e91 | 0x0e00 |
PKHEdwardsAddrID ENCODINGPrefix of pay-to-pubkey-hash addresses, Ed25519. | 0x071f | 0x0f01 | 0x0e71 | 0x0de0 |
PKHSchnorrAddrID ENCODINGPrefix of pay-to-pubkey-hash addresses, secp256k1 Schnorr. | 0x0701 | 0x0ee3 | 0x0e53 | 0x0dc2 |
ScriptHashAddrID ENCODINGPrefix of pay-to-script-hash addresses. | 0x071a | 0x0efc | 0x0e6c | 0x0ddb |
PrivateKeyID ENCODINGPrefix of WIF-encoded private keys. | 0x22de | 0x230e | 0x2307 | 0x22fe |
HDPrivateKeyID ENCODINGVersion bytes of serialized extended private keys. | 0x02fda4e8 | 0x04358397 | 0x0420b903 | 0xeab40448 |
HDPublicKeyID ENCODINGVersion bytes of serialized extended public keys. | 0x02fda926 | 0x043587d1 | 0x0420bd3d | 0xeab4f987 |
SLIP0044CoinType ENCODINGSLIP-0044 coin type used in hierarchical deterministic derivation paths. Read by wallets, not by dcrd. | 42 | 1 | 1 | 1 |
LegacyCoinType ENCODINGCoin type used by older wallets, kept for backwards compatibility. Read by wallets, not by dcrd. | 20 | 11 | 115 | 1 |
Table 14.17 shows the leading characters that each prefix produces. They were computed by Base58-encoding the prefix followed by an all-zero and by an all-0xff payload and checksum of the correct length and keeping the characters common to both, so every valid string of that type begins with them; the encoded length is given in parentheses. The payload is 20 bytes for the hash-based addresses, 33 bytes (a type byte and a 32-byte coordinate or key) for pay-to-pubkey addresses and WIF keys, and 74 bytes after the 4-byte version for extended keys. The encodings themselves are specified in Chapter 5.
| Encoding and field | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
Pay-to-pubkey (33-byte payload)PubKeyAddrID | 0x1386 Dk... (53 chars) | 0x28f7 Tk... (53 chars) | 0x276f Sk... (53 chars) | 0x25e5 Rk... (53 chars) |
P2PKH, secp256k1 ECDSAPubKeyHashAddrID | 0x073f Ds... (35 chars) | 0x0f21 Ts... (35 chars) | 0x0e91 Ss... (35 chars) | 0x0e00 Rs... (35 chars) |
P2PKH, Ed25519PKHEdwardsAddrID | 0x071f De... (35 chars) | 0x0f01 Te... (35 chars) | 0x0e71 Se... (35 chars) | 0x0de0 Re... (35 chars) |
P2PKH, secp256k1 SchnorrPKHSchnorrAddrID | 0x0701 DS... (35 chars) | 0x0ee3 TS... (35 chars) | 0x0e53 SS... (35 chars) | 0x0dc2 RS... (35 chars) |
Pay-to-script-hashScriptHashAddrID | 0x071a Dc... (35 chars) | 0x0efc Tc... (35 chars) | 0x0e6c Sc... (35 chars) | 0x0ddb Rc... (35 chars) |
WIF private key (type byte + 32-byte key)PrivateKeyID | 0x22de Pm... (53 chars) | 0x230e Pt... (53 chars) | 0x2307 Ps... (53 chars) | 0x22fe Pr... (53 chars) |
Extended private keyHDPrivateKeyID | 0x02fda4e8 dprv... (111 chars) | 0x04358397 tprv... (111 chars) | 0x0420b903 sprv... (111 chars) | 0xeab40448 rprv1... (112 chars) |
Extended public keyHDPublicKeyID | 0x02fda926 dpub... (111 chars) | 0x043587d1 tpub... (111 chars) | 0x0420bd3d spub... (111 chars) | 0xeab4f987 rpub1... (112 chars) |
14.4 Derived Quantities¶
Table 14.18 lists quantities that follow arithmetically from the parameters and that implementers frequently need. is TargetTimePerBlock in seconds. The two rows marked “Check” verify relations that the dcrd comments state between parameters. The treasury rows follow the computations in internal/blockchain/treasury.go · checkTSpendHasVotes and internal/blockchain/chain.go · New: a treasury spend voting window spans TreasuryVoteInterval TreasuryVoteIntervalMultiplier blocks, the number of votes possible in it is that times TicketsPerBlock, and the DCP-0013 floor on the spending limit is times the window length. The exact use of each quantity is specified in the chapter that owns it.
| Quantity and formula | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
| Blocks per day | 288 | 720 | 86400 | 86400 |
| Expected blocks in two weeks | 4032 14 d | 10080 14 d | 1209600 14 d | 1209600 14 d |
Check: TargetTimespanWorkDiffWindowSize | true | |||
V1 PoW retarget intervalWorkDiffWindowSize | 144 12 h | 144 4.8 h | 8 8 s | 8 8 s |
V1 PoW averaging spanWorkDiffWindowSize WorkDiffWindows | 2880 10 d | 2880 4 d | 32 32 s | 32 32 s |
ASERT half-life in blocksWorkDiffV2HalfLifeSecs | 144 | 6 | 6 | 6 |
Subsidy reduction intervalSubsidyReductionInterval | 6144 21.33 d | 2048 2.84 d | 128 2.13 min | 128 2.13 min |
| Original split PoW / PoS / treasury proportions over their sum | 6/3/1 of 10 | |||
Target live ticket poolTicketPoolSize TicketsPerBlock | 40960 | 5120 | 320 | 320 |
Ticket price windowStakeDiffWindowSize | 144 12 h | 144 4.8 h | 8 8 s | 8 8 s |
Ticket price averaging span (version 1 algorithm only)StakeDiffWindowSize StakeDiffWindows | 2880 10 d | 2880 4 d | 64 1.07 min | 64 1.07 min |
Ticket maturityTicketMaturity | 256 21.33 h | 16 32 min | 16 16 s | 16 16 s |
Ticket expiryTicketExpiry | 40960 142.22 d | 6144 8.53 d | 384 6.4 min | 384 6.4 min |
Check: TicketExpiry StakeEnabledHeight StakeValidationHeight | true | |||
Coinbase maturityCoinbaseMaturity | 256 21.33 h | 16 32 min | 16 16 s | 16 16 s |
Stake enabled heightStakeEnabledHeight | 512 1.78 d | 32 1.07 h | 32 32 s | 32 32 s |
Stake validation heightStakeValidationHeight | 4096 14.22 d | 768 1.07 d | 144 2.4 min | 144 2.4 min |
Stake version intervalStakeVersionInterval | 2016 7 d | 2016 2.8 d | 112 1.87 min | 112 1.87 min |
Rule change intervalRuleChangeActivationInterval | 8064 28 d | 5040 7 d | 320 5.33 min | 320 5.33 min |
Votes possible per rule change intervalRuleChangeActivationInterval TicketsPerBlock | 40320 | 25200 | 1600 | 1600 |
Rule change quorum as a share of thoseRuleChangeActivationQuorum previous row | 10 % | |||
Treasury vote interval (TVI)TreasuryVoteInterval | 288 1 d | 60 2 h | 48 48 s | 4 4 s |
| Treasury spend voting window TVI TreasuryVoteIntervalMultiplier | 3456 12 d | 240 8 h | 144 2.4 min | 12 12 s |
| Votes possible in a voting window window TicketsPerBlock | 17280 | 1200 | 720 | 60 |
| Treasury spend quorum (votes) possible votes TreasuryVoteQuorumMultiplier TreasuryVoteQuorumDivisor, rounded down | 3456 | 240 | 144 | 12 |
Treasury spend yes fractionTreasuryVoteRequiredMultiplier TreasuryVoteRequiredDivisor | 60 % | |||
| Expenditure policy window voting window TreasuryExpenditureWindow | 6912 24 d | 960 1.33 d | 576 9.6 min | 48 48 s |
| DCP-0006 averaging span policy window TreasuryExpenditurePolicy | 41472 144 d | 2880 4 d | 1728 28.8 min | 144 2.4 min |
DCP-0013 spend limit floor (atoms)BaseSubsidy (rounded down) voting window | 1078127767296 10781.27767296 DCR | 60000000000 600 DCR | 720000000000 7200 DCR | 60000000000 600 DCR |
| Block-one ledger total sum of the BlockOneLedger amounts | 1680000 DCR 168000000000000 atoms | 100000 DCR 10000000000000 atoms | 300000 DCR 30000000000000 atoms | 300000 DCR 30000000000000 atoms |
14.5 Network-Specific Rules Outside the Parameters¶
A few consensus rules depend on the network but are not expressed through chaincfg.Params. dcrd selects them by comparing Net with the magic of a particular network. They are listed here so that an implementation supporting several networks does not miss them; each is specified in the chapter given.
| Network | Rule | Specified in |
|---|---|---|
| testnet3 | The minimum-difficulty reduction of ReduceMinDifficulty applies only to blocks below height 962928. From that height a maximum difficulty applies: the target is never allowed below PowLimit shifted right by 6 bits, i.e. 00000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffff, compact 0x1d03ffff, and blocks at that maximum difficulty must be at least one minute apart. The block at height 962928 MUST have hash 0000004fd1b267fd39111d456ff557137824538e6f6776168600e56002e23b93 (display form); any other block at that height is rejected. | Chapter 9 |
| mainnet, testnet3 | Exemptions from the DCP-0005 block-version check for blocks that were accepted in violation of it: five specific version-6 blocks on mainnet (heights 413762 to 430191), and every version-7 block up to height 323282 on testnet3. | Chapter 13 |
| mainnet; others | The latest block version below which blocks become rejectable by majority is 11 on mainnet and 12 on every other network. | Chapter 13 |
| mainnet; others | The lowest block version for which dcrd’s header-stage difficulty check considers the ASERT result before the agenda state is known is 10 on mainnet and 11 on every other network. This is not itself a consensus rule: the proof-of-work rules of Chapter 9 do not depend on the block version. | Chapter 9 |
| mainnet, testnet3 | A list of specific outputs (six on mainnet, one on testnet3) that were spent by a stake transaction in the same block under rules that were later tightened, and that remain acceptable. | Chapter 7 |
| mainnet | A deployment with a forced choice is refused on the main network (ErrForcedMainNetChoice). | Chapter 13 |
| mainnet, testnet3 | Historical agenda activation anchors (Section 14.3.6). | Chapter 13 |
14.6 Genesis Blocks¶
The genesis block is the block at height 0. It has no parent and is not produced by mining: each network’s genesis block is a constant of the protocol, written out field by field in chaincfg and given here in full.
Rule 14.1 · Genesis block
The block at height 0 of a network MUST be exactly the genesis block given in this section for that network, whose serialization is given at the end of this section. The genesis block is valid by definition: none of the validation rules of Chapter 10 or Chapter 7 is applied to it, including proof of work, Merkle root and size checks. A block at height 1 MUST name the genesis block’s hash as its previous block.dcrd: internal/blockchain/chainio.go · createChainState | internal/blockchain/validate.go · checkBlockHeaderPositional, checkBlockPositional
Rule 14.2 · Genesis outputs are not spendable
The transactions of the genesis block are never connected: the UTXO set of a chain whose tip is the genesis block is empty. An input that references an output of the genesis coinbase therefore references an output that does not exist, and the transaction containing it MUST be rejected as for any missing input (Chapter 7).dcrd: internal/blockchain/chainio.go · createChainState | internal/blockchain/utxoviewpoint.go · FetchUtxoView
Besides serving as the parent of block 1, the genesis header’s values that matter to later blocks are its timestamp, which is the median time of the chain while the genesis block is the tip, and its difficulty bits, which are the starting point of the proof-of-work difficulty computation (Chapter 9). Agendas are never active for the genesis block. The version 2 compact filter of the genesis block is computed by the ordinary algorithm with no spent scripts and contains one item (Chapter 16).
Table 14.20 lists every header field (Chapter 4 specifies the header layout) and Table 14.21 every field of the single coinbase transaction. No genesis block has stake transactions.
| Field | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
Version | 1 | 6 | 1 | 1 |
PrevBlock | zero | |||
MerkleRoot | 66aa7491... full value below | e7dfbcea... full value below | 5c9488e2... full value below | 66aa7491... full value below |
StakeRoot | zero | |||
VoteBits | 0 | |||
FinalState | 000000000000 | |||
Voters | 0 | |||
FreshStake | 0 | |||
Revocations | 0 | |||
PoolSize | 0 | |||
Bits | 0x1b01ffff | 0x1e00ffff | 0x207fffff | 0x207fffff |
SBits | 200000000 2 DCR | 20000000 0.2 DCR | 0 0 DCR | 0 0 DCR |
Height | 0 | |||
Size | 0 | |||
Timestamp | 1454954400 2016-02-08 18:00:00 UTC | 1533513600 2018-08-06 00:00:00 UTC | 1401292357 2014-05-28 15:52:37 UTC | 1538524800 2018-10-03 00:00:00 UTC |
Nonce | 0x00000000 | 0x18aea41a | 0x00000000 | 0x00000000 |
ExtraData | zero | |||
StakeVersion | 0 | 6 | 0 | 0 |
| Field | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
SerType | 0 full | |||
Version | 1 | |||
inputs | 1 | |||
in: PreviousOutPoint.Hash | zero | |||
in: PreviousOutPoint.Index | 0xffffffff | |||
in: PreviousOutPoint.Tree | 0 | |||
in: Sequence | 0xffffffff | |||
in: ValueIn | -1 | -1 | 0 | -1 |
in: BlockHeight | 0x00000000 | |||
in: BlockIndex | 0xffffffff | 0xffffffff | 0x00000000 | 0xffffffff |
in: SignatureScript | 0000 2 bytes | 0000 2 bytes | 77 bytes full value below | 0000 2 bytes |
outputs | 1 | |||
out: Value | 0 | |||
out: Version | 0 | |||
out: PkScript | 32 bytes full value below | 32 bytes full value below | 67 bytes full value below | 32 bytes full value below |
LockTime | 0 | |||
Expiry | 0 | |||
| Field | Network | Value |
|---|---|---|
SignatureScript | mainnet | 00000 0 |
| testnet3 | 00000 0 | |
| simnet | 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffff001d 04 5468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73 | |
| regnet | 00000 0 | |
PkScript | mainnet | 801679e98561ada96caec2949a5d41c4cab3851eb740d951c10ecbcf265c1fd9OP_LEFT 79e98561ada96caec2949a5d41c4cab3851eb740d951 OP_TADD [error] (parse failure: opcode OP_DATA_14 requires 15 bytes, but script only has 7 remaining)class: nonstandard |
| testnet3 | 801679e98561ada96caec2949a5d41c4cab3851eb740d951c10ecbcf265c1fd9OP_LEFT 79e98561ada96caec2949a5d41c4cab3851eb740d951 OP_TADD [error] (parse failure: opcode OP_DATA_14 requires 15 bytes, but script only has 7 remaining)class: nonstandard | |
| simnet | 4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIGclass: pubkey | |
| regnet | 801679e98561ada96caec2949a5d41c4cab3851eb740d951c10ecbcf265c1fd9OP_LEFT 79e98561ada96caec2949a5d41c4cab3851eb740d951 OP_TADD [error] (parse failure: opcode OP_DATA_14 requires 15 bytes, but script only has 7 remaining)class: nonstandard |
| Field | Network | Value |
|---|---|---|
block hash | mainnet | 298e5cc3d985bfe7f81dc135f360abe089edd4396b86d2de66b0cef42b21d980 |
| testnet3 | a649dce53918caf422e9c711c858837e08d626ecfcd198969b24f7b634a49bac | |
| simnet | 6bef82c645999585f7255cb02672921ac2f5492820090cd635fe3a59d16b4f87 | |
| regnet | 2ced94b4ae95bba344cfa043268732d230649c640f92dce2d9518823d3057cb0 | |
MerkleRoot | mainnet | 66aa7491b9adce110585ccab7e3fb5fe280de174530cca10eba2c6c3df01c10d |
| testnet3 | e7dfbceac9fccd6025c70a1dfa9302b3e7b5aa22fa51c98a69164ad403d60a2c | |
| simnet | 5c9488e2f3425de9951ee31f4ad5803c4487a8f4a2719d60c3bf2b58c5295692 | |
| regnet | 66aa7491b9adce110585ccab7e3fb5fe280de174530cca10eba2c6c3df01c10d | |
coinbase TxHash | mainnet | e7dfbceac9fccd6025c70a1dfa9302b3e7b5aa22fa51c98a69164ad403d60a2c |
| testnet3 | e7dfbceac9fccd6025c70a1dfa9302b3e7b5aa22fa51c98a69164ad403d60a2c | |
| simnet | a216ea043f0d481a072424af646787794c32bcefd3ed181a090319bbf8a37105 | |
| regnet | e7dfbceac9fccd6025c70a1dfa9302b3e7b5aa22fa51c98a69164ad403d60a2c | |
coinbase TxHashFull | mainnet | 66aa7491b9adce110585ccab7e3fb5fe280de174530cca10eba2c6c3df01c10d |
| testnet3 | 66aa7491b9adce110585ccab7e3fb5fe280de174530cca10eba2c6c3df01c10d | |
| simnet | 5c9488e2f3425de9951ee31f4ad5803c4487a8f4a2719d60c3bf2b58c5295692 | |
| regnet | 66aa7491b9adce110585ccab7e3fb5fe280de174530cca10eba2c6c3df01c10d |
| Property | mainnet | testnet3 | simnet | regnet |
|---|---|---|---|---|
| Merkle root field equals coinbase | TxHashFull | TxHash | TxHashFull | TxHashFull |
Block hash target of its own Bits | no | no | yes | yes |
Several properties of the genesis blocks are unusual and follow from their being constants rather than validated blocks.
- The mainnet, testnet3 and regnet coinbases are the same transaction. Its single input has the null outpoint (zero hash, index
0xffffffff, tree 0) and the null witness values (value in , block height 0, block index0xffffffff); its signature script is the two bytes0000. Its single output has value 0 and version 0, and its 32-byte output script does not even parse: afterOP_LEFT, a 22-byte push andOP_TADD, a 14-byte push runs past the end of the script. It is not a standard script of any kind and could never be satisfied. - The simnet coinbase is different. Its signature script pushes the bytes
ffff001d, the byte04, and the ASCII text “The Times 03/Jan/2009 Chancellor on brink of second bailout for banks”, the coinbase message of Bitcoin’s genesis block; its output is a 65-byte uncompressed public key followed byOP_CHECKSIG, again with value 0. Its input witness leaves the value in and block index at zero instead of the null values. - Merkle root. The Merkle root of a block with a single regular transaction is that transaction’s full hash (Chapter 4). The testnet3 genesis header instead carries the transaction’s prefix hash (
TxHash); the dcrd source acknowledges this as a mistake that cannot be corrected without changing the testnet3 genesis hash, and notes that the field is not validated. Mainnet and regnet share a Merkle root because they share the coinbase. - Header fields. The
Sizefield is 0 although each block is larger, and the stake root is zero. On mainnet and testnet3 the block hash does not satisfy the target encoded in the block’s ownBits; on simnet and regnet, whose targets admit about half of all hashes, it happens to. - Stake fields. The testnet3 genesis header has block version 6 and stake version 6, unlike the version 1 and stake version 0 of the other networks, and its
SBitsequalsMinimumStakeDiffas on mainnet. Simnet and regnet haveSBits0.
The serialized blocks below were produced by serializing the chaincfg genesis blocks with dcrd’s wire package, checked by deserializing them again, and hashed with dcrd; the hashes match GenesisHash. The first 180 bytes of each are the block header, whose BLAKE-256 hash is the block hash (Chapter 3).
Test vector: mainnet genesis block: serialized (300 bytes; the first 180 are the header)
0100000000000000000000000000000000000000000000000000000000000000000000000dc101dfc3c6a2eb10ca0c5374e10d28feb53f7eabcc850511ceadb99174aa66000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffff011b00c2eb0b000000000000000000000000a0d7b856000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff00ffffffff010000000000000000000020801679e98561ada96caec2949a5d41c4cab3851eb740d951c10ecbcf265c1fd9000000000000000001ffffffffffffffff00000000ffffffff02000000Test vector: testnet3 genesis block: serialized (300 bytes; the first 180 are the header)
0600000000000000000000000000000000000000000000000000000000000000000000002c0ad603d44a16698ac951fa22aab5e7b30293fa1d0ac72560cdfcc9eabcdfe7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffff001e002d3101000000000000000000000000808f675b1aa4ae180000000000000000000000000000000000000000000000000000000000000000060000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff00ffffffff010000000000000000000020801679e98561ada96caec2949a5d41c4cab3851eb740d951c10ecbcf265c1fd9000000000000000001ffffffffffffffff00000000ffffffff02000000Test vector: simnet genesis block: serialized (410 bytes; the first 180 are the header)
010000000000000000000000000000000000000000000000000000000000000000000000925629c5582bbfc3609d71a2f4a887443c80d54a1fe31e95e95d42f3e288945c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffff7f200000000000000000000000000000000045068653000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff00ffffffff0100000000000000000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac000000000000000001000000000000000000000000000000004d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b7300Test vector: regnet genesis block: serialized (300 bytes; the first 180 are the header)
0100000000000000000000000000000000000000000000000000000000000000000000000dc101dfc3c6a2eb10ca0c5374e10d28feb53f7eabcc850511ceadb99174aa66000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffff7f20000000000000000000000000000000008006b45b000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff00ffffffff010000000000000000000020801679e98561ada96caec2949a5d41c4cab3851eb740d951c10ecbcf265c1fd9000000000000000001ffffffffffffffff00000000ffffffff0200000014.7 Block-One Ledger¶
The coinbase of the block at height 1 does not pay the ordinary subsidy; instead it must pay exactly the outputs listed in BlockOneLedger (the premine on mainnet). Table 14.25 gives the number of outputs and their total for each network. The outputs themselves, and the rules that enforce them, are given in Chapter 11.
| Network | Outputs | Total (atoms) | Total | Script types |
|---|---|---|---|---|
| mainnet | 3146 | 168000000000000 | 1680000 DCR | all P2PKH (secp256k1 ECDSA), script version 0 |
| testnet3 | 2 | 10000000000000 | 100000 DCR | all P2PKH (secp256k1 ECDSA), script version 0 |
| simnet | 3 | 30000000000000 | 300000 DCR | all P2PKH (secp256k1 ECDSA), script version 0 |
| regnet | 3 | 30000000000000 | 300000 DCR | all P2PKH (secp256k1 ECDSA), script version 0 |