Skip to content

Commit

Permalink
Add testnet4 configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
azuchi committed Sep 3, 2024
1 parent 958f843 commit 59a2402
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
38 changes: 38 additions & 0 deletions lib/bitcoin/chainparams/testnet4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--- !ruby/object:Bitcoin::ChainParams
network: "testnet4"
magic_head: "1c163f28"
message_magic: "Bitcoin Signed Message:\n"
address_version: "6f"
p2sh_version: "c4"
bech32_hrp: 'tb'
privkey_version: "ef"
extended_privkey_version: "04358394"
extended_pubkey_version: "043587cf"
bip49_pubkey_p2wpkh_p2sh_version: "044a5262"
bip49_pubkey_p2wsh_p2sh_version: "024289ef"
bip49_privkey_p2wpkh_p2sh_version: "044a4e28"
bip49_privkey_p2wsh_p2sh_version: "024285b5"
bip84_pubkey_p2wpkh_version: "045f1cf6"
bip84_pubkey_p2wsh_version: "02575483"
bip84_privkey_p2wpkh_version: "045f18bc"
bip84_privkey_p2wsh_version: "02575048"
default_port: 48333
protocol_version: 70013
retarget_interval: 2016
retarget_time: 1209600 # 2 weeks
target_spacing: 600 # block interval
max_money: 21000000
bip34_height: 1
proof_of_work_limit: 0x1d00ffff
dns_seeds:
- "seed.testnet4.bitcoin.sprovoost.nl"
- "seed.testnet4.wiz.biz"
genesis:
hash: "00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043"
merkle_root: "7aa0a7ae1e223414cb807e40cd57e667b718e42aaf9306db9102fe28912b7b4e"
time: 1714777860
nonce: 393743547
bits: 0x1d00ffff
version: 1
prev_hash: "0000000000000000000000000000000000000000000000000000000000000000"
bip44_coin_type: 1
22 changes: 22 additions & 0 deletions spec/bitcoin/chain_params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
expect(subject.testnet?).to be false
expect(subject.regtest?).to be false
expect(subject.signet?).to be false
expect(subject.testnet4?).to be false
expect(subject.genesis_block.header.to_hex).to eq('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c')
expect(subject.genesis_block.header.block_hash).to eq('6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000')
expect(subject.dust_relay_fee).to eq(Bitcoin::DUST_RELAY_TX_FEE)
Expand All @@ -26,6 +27,7 @@
expect(subject.testnet?).to be true
expect(subject.regtest?).to be false
expect(subject.signet?).to be false
expect(subject.testnet4?).to be false
expect(subject.genesis_block.header.to_hex).to eq('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff001d1aa4ae18')
expect(subject.genesis_block.header.block_hash).to eq('43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000')
expect(subject.dust_relay_fee).to eq(Bitcoin::DUST_RELAY_TX_FEE)
Expand All @@ -40,6 +42,7 @@
expect(subject.testnet?).to be false
expect(subject.regtest?).to be true
expect(subject.signet?).to be false
expect(subject.testnet4?).to be false
expect(subject.genesis_block.header.to_hex).to eq('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff7f2002000000')
expect(subject.genesis_block.header.block_hash).to eq('06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f')
expect(subject.dust_relay_fee).to eq(3600)
Expand All @@ -55,10 +58,29 @@
expect(subject.testnet?).to be false
expect(subject.regtest?).to be false
expect(subject.signet?).to be true
expect(subject.testnet4?).to be false
expect(subject.genesis_block.header.to_hex).to eq('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a008f4d5fae77031e8ad22203')
expect(subject.genesis_block.header.block_id).to eq('00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6')
end
end

# https://github.com/bitcoin/bips/blob/master/bip-0094.mediawiki
context 'testnet4' do
subject{Bitcoin::ChainParams.testnet4}
it do
expect(subject.default_port).to eq(48333)
expect(subject.mainnet?).to be false
expect(subject.testnet?).to be false
expect(subject.regtest?).to be false
expect(subject.signet?).to be false
expect(subject.testnet4?).to be true
expect(subject.magic_head).to eq('1c163f28')
expect(subject.bip34_height).to eq(1)

expect(subject.genesis_block.header.to_hex).to eq('0100000000000000000000000000000000000000000000000000000000000000000000004e7b2b9128fe0291db0693af2ae418b767e657cd407e80cb1434221eaea7a07a046f3566ffff001dbb0c7817')
expect(subject.genesis_block.header.block_id).to eq('00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043')
end
end
end

end

0 comments on commit 59a2402

Please sign in to comment.