Class: Bitcoin::ChainParams

Inherits:
Object
  • Object
show all
Defined in:
lib/bitcoin/chain_params.rb

Overview

Network parameter class

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#address_versionObject (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_hrpObject (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_heightObject (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_typeObject (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_versionObject (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_versionObject (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_versionObject (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_versionObject (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_versionObject (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_versionObject (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_versionObject (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_versionObject (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_portObject (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_seedsObject (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_feeObject

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_versionObject (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_versionObject (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

#genesisObject (readonly)

Returns the value of attribute genesis.



34
35
36
# File 'lib/bitcoin/chain_params.rb', line 34

def genesis
  @genesis
end

#magic_headObject (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_moneyObject (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_magicObject (readonly)

Returns the value of attribute message_magic.



10
11
12
# File 'lib/bitcoin/chain_params.rb', line 10

def message_magic
  @message_magic
end

#networkObject (readonly)

Returns the value of attribute network.



8
9
10
# File 'lib/bitcoin/chain_params.rb', line 8

def network
  @network
end

#p2sh_versionObject (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_versionObject (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_limitObject (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_versionObject (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_intervalObject (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_timeObject (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_spacingObject (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

.mainnetObject

mainnet genesis



40
41
42
# File 'lib/bitcoin/chain_params.rb', line 40

def self.mainnet
  init('mainnet')
end

.regtestObject

regtest genesis



50
51
52
# File 'lib/bitcoin/chain_params.rb', line 50

def self.regtest
  init('regtest')
end

.signetObject

signet genesis



55
56
57
# File 'lib/bitcoin/chain_params.rb', line 55

def self.signet
  init('signet')
end

.testnetObject

testnet genesis



45
46
47
# File 'lib/bitcoin/chain_params.rb', line 45

def self.testnet
  init('testnet')
end

Instance Method Details

#genesis_blockObject



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

Returns:

  • (Boolean)


59
60
61
# File 'lib/bitcoin/chain_params.rb', line 59

def mainnet?
  network == 'mainnet'
end

#regtest?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/bitcoin/chain_params.rb', line 67

def regtest?
  network == 'regtest'
end

#signet?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/bitcoin/chain_params.rb', line 71

def signet?
  network == 'signet'
end

#testnet?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/bitcoin/chain_params.rb', line 63

def testnet?
  network == 'testnet'
end