Module: Eth

Defined in:
lib/eth/open_ssl.rb,
lib/eth.rb,
lib/eth/tx.rb,
lib/eth/gas.rb,
lib/eth/key.rb,
lib/eth/sedes.rb,
lib/eth/utils.rb,
lib/eth/address.rb,
lib/eth/version.rb,
lib/eth/secp256k1.rb

Overview

originally lifted from github.com/lian/bitcoin-ruby thanks to everyone there for figuring this out

Defined Under Namespace

Modules: Sedes, Utils Classes: Address, Configuration, Gas, InvalidTransaction, Key, OpenSsl, Secp256k1, Tx, ValidationError

Constant Summary collapse

BYTE_ZERO =
"\x00".freeze
UINT_MAX =
2**256 - 1
UnsignedTx =
Tx.exclude([:v, :r, :s])
VERSION =
"0.4.10"

Class Method Summary collapse

Class Method Details

.chain_idObject



28
29
30
# File 'lib/eth.rb', line 28

def chain_id
  configuration.chain_id
end

.chain_id_from_signature(signature) ⇒ Object



44
45
46
47
48
49
# File 'lib/eth.rb', line 44

def chain_id_from_signature(signature)
  return nil if Eth.replayable_v?(signature[:v])

  cid = (signature[:v] - 35) / 2
  (cid < 1) ? nil : cid
end

.configure {|configuration| ... } ⇒ Object

Yields:

  • (configuration)


20
21
22
# File 'lib/eth.rb', line 20

def configure
  yield(configuration)
end

.replayable_chain_idObject



24
25
26
# File 'lib/eth.rb', line 24

def replayable_chain_id
  27
end

.replayable_v?(v) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/eth.rb', line 36

def replayable_v?(v)
  [replayable_chain_id, replayable_chain_id + 1].include? v
end

.tx_data_hex?Boolean

Returns:

  • (Boolean)


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

def tx_data_hex?
  !!configuration.tx_data_hex
end

.v_baseObject



32
33
34
# File 'lib/eth.rb', line 32

def v_base
  replayable_chain_id
end