/ test / functional / data / README.md
README.md
 1  # Various test vectors
 2  
 3  ## mainnet_alt.json
 4  
 5  For easier testing the difficulty is maximally increased in the first (and only)
 6  retarget period, by producing blocks approximately 2 minutes apart.
 7  
 8  The alternate mainnet chain was generated as follows:
 9  - use faketime to set node clock to 2 minutes after genesis block
10  - mine a block using a CPU miner such as https://github.com/pooler/cpuminer
11  - restart node with a faketime 2 minutes later
12  
13  ```sh
14  for i in {1..2015}
15  do
16   faketime "`date -d @"$(( 1231006505 + $i * 120 ))"  +'%Y-%m-%d %H:%M:%S'`" \
17   bitcoind -connect=0 -nocheckpoints -stopatheight=$i
18  done
19  ```
20  
21  The CPU miner is kept running as follows:
22  
23  ```sh
24  ./minerd --coinbase-addr 1NQpH6Nf8QtR2HphLRcvuVqfhXBXsiWn8r --no-stratum --algo sha256d --no-longpoll --scantime 3 --retry-pause 1
25  ```
26  
27  The payout address is derived from first BIP32 test vector master key:
28  
29  ```
30  pkh(xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi/44h/0h/0h/<0;1>/*)#fkjtr0yn
31  ```
32  
33  It uses `pkh()` because `tr()` outputs at low heights are not spendable (`unexpected-witness`).
34  
35  This makes each block deterministic except for its timestamp and nonce, which
36  are stored in `mainnet_alt.json` and used to reconstruct the chain without
37  having to redo the proof-of-work.
38  
39  The timestamp was not kept constant because at difficulty 1 it's not sufficient
40  to only grind the nonce. Grinding the extra_nonce or version field instead
41  would have required additional (stratum) software. It would also make it more
42  complicated to reconstruct the blocks in this test.