Class: Bitcoin::ChainParams
- Inherits:
-
Object
- Object
- Bitcoin::ChainParams
- Defined in:
- lib/bitcoin/chain_params.rb
Overview
Network parameter class
Instance Attribute Summary collapse
-
#address_version ⇒ Object
readonly
Returns the value of attribute address_version.
-
#bech32_hrp ⇒ Object
readonly
Returns the value of attribute bech32_hrp.
-
#bip34_height ⇒ Object
readonly
Returns the value of attribute bip34_height.
-
#bip44_coin_type ⇒ Object
readonly
Returns the value of attribute bip44_coin_type.
-
#bip49_privkey_p2wpkh_p2sh_version ⇒ Object
readonly
Returns the value of attribute bip49_privkey_p2wpkh_p2sh_version.
-
#bip49_privkey_p2wsh_p2sh_version ⇒ Object
readonly
Returns the value of attribute bip49_privkey_p2wsh_p2sh_version.
-
#bip49_pubkey_p2wpkh_p2sh_version ⇒ Object
readonly
Returns the value of attribute bip49_pubkey_p2wpkh_p2sh_version.
-
#bip49_pubkey_p2wsh_p2sh_version ⇒ Object
readonly
Returns the value of attribute bip49_pubkey_p2wsh_p2sh_version.
-
#bip84_privkey_p2wpkh_version ⇒ Object
readonly
Returns the value of attribute bip84_privkey_p2wpkh_version.
-
#bip84_privkey_p2wsh_version ⇒ Object
readonly
Returns the value of attribute bip84_privkey_p2wsh_version.
-
#bip84_pubkey_p2wpkh_version ⇒ Object
readonly
Returns the value of attribute bip84_pubkey_p2wpkh_version.
-
#bip84_pubkey_p2wsh_version ⇒ Object
readonly
Returns the value of attribute bip84_pubkey_p2wsh_version.
-
#default_port ⇒ Object
readonly
Returns the value of attribute default_port.
-
#dns_seeds ⇒ Object
readonly
Returns the value of attribute dns_seeds.
-
#dust_relay_fee ⇒ Object
Returns the value of attribute dust_relay_fee.
-
#extended_privkey_version ⇒ Object
readonly
Returns the value of attribute extended_privkey_version.
-
#extended_pubkey_version ⇒ Object
readonly
Returns the value of attribute extended_pubkey_version.
-
#genesis ⇒ Object
readonly
Returns the value of attribute genesis.
-
#magic_head ⇒ Object
readonly
Returns the value of attribute magic_head.
-
#max_money ⇒ Object
readonly
Returns the value of attribute max_money.
-
#message_magic ⇒ Object
readonly
Returns the value of attribute message_magic.
-
#network ⇒ Object
readonly
Returns the value of attribute network.
-
#p2sh_version ⇒ Object
readonly
Returns the value of attribute p2sh_version.
-
#privkey_version ⇒ Object
readonly
Returns the value of attribute privkey_version.
-
#proof_of_work_limit ⇒ Object
readonly
Returns the value of attribute proof_of_work_limit.
-
#protocol_version ⇒ Object
readonly
Returns the value of attribute protocol_version.
-
#retarget_interval ⇒ Object
readonly
Returns the value of attribute retarget_interval.
-
#retarget_time ⇒ Object
readonly
Returns the value of attribute retarget_time.
-
#target_spacing ⇒ Object
readonly
Returns the value of attribute target_spacing.
Class Method Summary collapse
-
.mainnet ⇒ Object
mainnet genesis.
-
.regtest ⇒ Object
regtest genesis.
-
.signet ⇒ Object
signet genesis.
-
.testnet ⇒ Object
testnet genesis.
Instance Method Summary collapse
- #genesis_block ⇒ Object
- #mainnet? ⇒ Boolean
- #regtest? ⇒ Boolean
- #signet? ⇒ Boolean
- #testnet? ⇒ Boolean
Instance Attribute Details
#address_version ⇒ Object (readonly)
Returns the value of attribute address_version.
11 12 13 |
# File 'lib/bitcoin/chain_params.rb', line 11 def address_version @address_version end |
#bech32_hrp ⇒ Object (readonly)
Returns the value of attribute bech32_hrp.
13 14 15 |
# File 'lib/bitcoin/chain_params.rb', line 13 def bech32_hrp @bech32_hrp end |
#bip34_height ⇒ Object (readonly)
Returns the value of attribute bip34_height.
31 32 33 |
# File 'lib/bitcoin/chain_params.rb', line 31 def bip34_height @bip34_height end |
#bip44_coin_type ⇒ Object (readonly)
Returns the value of attribute bip44_coin_type.
35 36 37 |
# File 'lib/bitcoin/chain_params.rb', line 35 def bip44_coin_type @bip44_coin_type end |
#bip49_privkey_p2wpkh_p2sh_version ⇒ Object (readonly)
Returns the value of attribute bip49_privkey_p2wpkh_p2sh_version.
18 19 20 |
# File 'lib/bitcoin/chain_params.rb', line 18 def bip49_privkey_p2wpkh_p2sh_version @bip49_privkey_p2wpkh_p2sh_version end |
#bip49_privkey_p2wsh_p2sh_version ⇒ Object (readonly)
Returns the value of attribute bip49_privkey_p2wsh_p2sh_version.
20 21 22 |
# File 'lib/bitcoin/chain_params.rb', line 20 def bip49_privkey_p2wsh_p2sh_version @bip49_privkey_p2wsh_p2sh_version end |
#bip49_pubkey_p2wpkh_p2sh_version ⇒ Object (readonly)
Returns the value of attribute bip49_pubkey_p2wpkh_p2sh_version.
17 18 19 |
# File 'lib/bitcoin/chain_params.rb', line 17 def bip49_pubkey_p2wpkh_p2sh_version @bip49_pubkey_p2wpkh_p2sh_version end |
#bip49_pubkey_p2wsh_p2sh_version ⇒ Object (readonly)
Returns the value of attribute bip49_pubkey_p2wsh_p2sh_version.
19 20 21 |
# File 'lib/bitcoin/chain_params.rb', line 19 def bip49_pubkey_p2wsh_p2sh_version @bip49_pubkey_p2wsh_p2sh_version end |
#bip84_privkey_p2wpkh_version ⇒ Object (readonly)
Returns the value of attribute bip84_privkey_p2wpkh_version.
22 23 24 |
# File 'lib/bitcoin/chain_params.rb', line 22 def bip84_privkey_p2wpkh_version @bip84_privkey_p2wpkh_version end |
#bip84_privkey_p2wsh_version ⇒ Object (readonly)
Returns the value of attribute bip84_privkey_p2wsh_version.
24 25 26 |
# File 'lib/bitcoin/chain_params.rb', line 24 def bip84_privkey_p2wsh_version @bip84_privkey_p2wsh_version end |
#bip84_pubkey_p2wpkh_version ⇒ Object (readonly)
Returns the value of attribute bip84_pubkey_p2wpkh_version.
21 22 23 |
# File 'lib/bitcoin/chain_params.rb', line 21 def bip84_pubkey_p2wpkh_version @bip84_pubkey_p2wpkh_version end |
#bip84_pubkey_p2wsh_version ⇒ Object (readonly)
Returns the value of attribute bip84_pubkey_p2wsh_version.
23 24 25 |
# File 'lib/bitcoin/chain_params.rb', line 23 def bip84_pubkey_p2wsh_version @bip84_pubkey_p2wsh_version end |
#default_port ⇒ Object (readonly)
Returns the value of attribute default_port.
25 26 27 |
# File 'lib/bitcoin/chain_params.rb', line 25 def default_port @default_port end |
#dns_seeds ⇒ Object (readonly)
Returns the value of attribute dns_seeds.
33 34 35 |
# File 'lib/bitcoin/chain_params.rb', line 33 def dns_seeds @dns_seeds end |
#dust_relay_fee ⇒ Object
Returns the value of attribute dust_relay_fee.
37 38 39 |
# File 'lib/bitcoin/chain_params.rb', line 37 def dust_relay_fee @dust_relay_fee end |
#extended_privkey_version ⇒ Object (readonly)
Returns the value of attribute extended_privkey_version.
15 16 17 |
# File 'lib/bitcoin/chain_params.rb', line 15 def extended_privkey_version @extended_privkey_version end |
#extended_pubkey_version ⇒ Object (readonly)
Returns the value of attribute extended_pubkey_version.
16 17 18 |
# File 'lib/bitcoin/chain_params.rb', line 16 def extended_pubkey_version @extended_pubkey_version end |
#genesis ⇒ Object (readonly)
Returns the value of attribute genesis.
34 35 36 |
# File 'lib/bitcoin/chain_params.rb', line 34 def genesis @genesis end |
#magic_head ⇒ Object (readonly)
Returns the value of attribute magic_head.
9 10 11 |
# File 'lib/bitcoin/chain_params.rb', line 9 def magic_head @magic_head end |
#max_money ⇒ Object (readonly)
Returns the value of attribute max_money.
30 31 32 |
# File 'lib/bitcoin/chain_params.rb', line 30 def max_money @max_money end |
#message_magic ⇒ Object (readonly)
Returns the value of attribute message_magic.
10 11 12 |
# File 'lib/bitcoin/chain_params.rb', line 10 def @message_magic end |
#network ⇒ Object (readonly)
Returns the value of attribute network.
8 9 10 |
# File 'lib/bitcoin/chain_params.rb', line 8 def network @network end |
#p2sh_version ⇒ Object (readonly)
Returns the value of attribute p2sh_version.
12 13 14 |
# File 'lib/bitcoin/chain_params.rb', line 12 def p2sh_version @p2sh_version end |
#privkey_version ⇒ Object (readonly)
Returns the value of attribute privkey_version.
14 15 16 |
# File 'lib/bitcoin/chain_params.rb', line 14 def privkey_version @privkey_version end |
#proof_of_work_limit ⇒ Object (readonly)
Returns the value of attribute proof_of_work_limit.
32 33 34 |
# File 'lib/bitcoin/chain_params.rb', line 32 def proof_of_work_limit @proof_of_work_limit end |
#protocol_version ⇒ Object (readonly)
Returns the value of attribute protocol_version.
26 27 28 |
# File 'lib/bitcoin/chain_params.rb', line 26 def protocol_version @protocol_version end |
#retarget_interval ⇒ Object (readonly)
Returns the value of attribute retarget_interval.
27 28 29 |
# File 'lib/bitcoin/chain_params.rb', line 27 def retarget_interval @retarget_interval end |
#retarget_time ⇒ Object (readonly)
Returns the value of attribute retarget_time.
28 29 30 |
# File 'lib/bitcoin/chain_params.rb', line 28 def retarget_time @retarget_time end |
#target_spacing ⇒ Object (readonly)
Returns the value of attribute target_spacing.
29 30 31 |
# File 'lib/bitcoin/chain_params.rb', line 29 def target_spacing @target_spacing end |
Class Method Details
.mainnet ⇒ Object
mainnet genesis
40 41 42 |
# File 'lib/bitcoin/chain_params.rb', line 40 def self.mainnet init('mainnet') end |
.regtest ⇒ Object
regtest genesis
50 51 52 |
# File 'lib/bitcoin/chain_params.rb', line 50 def self.regtest init('regtest') end |
.signet ⇒ Object
signet genesis
55 56 57 |
# File 'lib/bitcoin/chain_params.rb', line 55 def self.signet init('signet') end |
.testnet ⇒ Object
testnet genesis
45 46 47 |
# File 'lib/bitcoin/chain_params.rb', line 45 def self.testnet init('testnet') end |
Instance Method Details
#genesis_block ⇒ Object
75 76 77 78 79 80 |
# File 'lib/bitcoin/chain_params.rb', line 75 def genesis_block header = Bitcoin::BlockHeader.new( genesis['version'], genesis['prev_hash'].rhex, genesis['merkle_root'].rhex, genesis['time'], genesis['bits'], genesis['nonce']) Bitcoin::Block.new(header) end |
#mainnet? ⇒ Boolean
59 60 61 |
# File 'lib/bitcoin/chain_params.rb', line 59 def mainnet? network == 'mainnet' end |
#regtest? ⇒ Boolean
67 68 69 |
# File 'lib/bitcoin/chain_params.rb', line 67 def regtest? network == 'regtest' end |
#signet? ⇒ Boolean
71 72 73 |
# File 'lib/bitcoin/chain_params.rb', line 71 def signet? network == 'signet' end |
#testnet? ⇒ Boolean
63 64 65 |
# File 'lib/bitcoin/chain_params.rb', line 63 def testnet? network == 'testnet' end |