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/vault.rb,
lib/eth/address.rb,
lib/eth/version.rb,
lib/eth/secp256k1.rb,
lib/eth/signature.rb,
lib/eth/rpc_signer.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, RpcSigner, Secp256k1, Signature, Tx, ValidationError, Vault

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.chain_idObject



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

def chain_id
  configuration.chain_id
end

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

Yields:

  • (configuration)


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

def configure
  yield(configuration)
end

.prevent_replays?Boolean

Returns:

  • (Boolean)


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

def prevent_replays?
  !chain_id.nil?
end

.replayable_chain_idObject



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

def replayable_chain_id
  27
end

.replayable_v?(v) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/eth.rb', line 51

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

.tx_data_hex?Boolean

Returns:

  • (Boolean)


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

def tx_data_hex?
  !!configuration.tx_data_hex
end

.v_baseObject



39
40
41
42
43
44
45
# File 'lib/eth.rb', line 39

def v_base
  if chain_id
    (chain_id * 2) + 35
  else
    replayable_chain_id
  end
end