Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1# Various test vectors3## mainnet_alt.json5For easier testing the difficulty is maximally increased in the first (and only)6retarget period, by producing blocks approximately 2 minutes apart.8The alternate mainnet chain was generated as follows:9- use faketime to set node clock to 2 minutes after genesis block10- mine a block using a CPU miner such as https://github.com/pooler/cpuminer11- restart node with a faketime 2 minutes later13```sh14for i in {1..2016}15do16t=$(( 1231006505 + $i * 120 ))17faketime "`date -d @$t +'%Y-%m-%d %H:%M:%S'`" \18bitcoind -connect=0 -nocheckpoints -stopatheight=$i19done20```22The CPU miner is kept running as follows:24```sh25./minerd -u ... -p ... -o http://127.0.0.1:8332 --no-stratum \26--coinbase-addr 1NQpH6Nf8QtR2HphLRcvuVqfhXBXsiWn8r \27--algo sha256d --no-longpoll --scantime 3 --retry-pause 128```30The payout address is derived from first BIP32 test vector master key:32```33pkh(xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi/44h/0h/0h/<0;1>/*)#fkjtr0yn34```36It uses `pkh()` because `tr()` outputs at low heights are not spendable (`unexpected-witness`).38This makes each block deterministic except for its timestamp and nonce, which39are stored in `mainnet_alt.json` and used to reconstruct the chain without40having to redo the proof-of-work.42The timestamp was not kept constant because at difficulty 1 it's not sufficient43to only grind the nonce. Grinding the extra_nonce or version field instead44would have required additional (stratum) software. It would also make it more45complicated to reconstruct the blocks in this test.47The `getblocktemplate` RPC code needs to be patched to ignore not being connected48to any peers, and to ignore the IBD status check.50On macOS use `faketime "@$t"` instead.
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.