Module: EthereumClient

Defined in:
lib/ethereum_client.rb,
lib/ethereum_client/error.rb

Overview

Ethereum JSON RPC client

Constant Summary collapse

HEADERS =
{
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}.freeze
Error =
Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.eth_accountsObject

Raises:

  • (NotImplementedError)


92
93
94
# File 'lib/ethereum_client.rb', line 92

def eth_accounts
  raise NotImplementedError, 'eth_accounts not yet implemented'
end

.eth_block_numberObject

Raises:

  • (NotImplementedError)


97
98
99
# File 'lib/ethereum_client.rb', line 97

def eth_block_number
  raise NotImplementedError, 'eth_block_number not yet implemented'
end

.eth_call(object) ⇒ Object

Raises:

  • (NotImplementedError)


157
158
159
# File 'lib/ethereum_client.rb', line 157

def eth_call(object)
  raise NotImplementedError, 'eth_call not yet implemented'
end

.eth_coinbaseObject

Raises:

  • (NotImplementedError)


72
73
74
# File 'lib/ethereum_client.rb', line 72

def eth_coinbase
  raise NotImplementedError, 'eth_coinbase not yet implemented'
end

.eth_compile_LLL(code) ⇒ Object

Raises:

  • (NotImplementedError)


217
218
219
# File 'lib/ethereum_client.rb', line 217

def eth_compile_LLL(code)
  raise NotImplementedError, 'eth_compile_LLL not yet implemented'
end

.eth_compile_serpent(code) ⇒ Object

Raises:

  • (NotImplementedError)


222
223
224
# File 'lib/ethereum_client.rb', line 222

def eth_compile_serpent(code)
  raise NotImplementedError, 'eth_compile_serpent not yet implemented'
end

.eth_compile_solidity(code) ⇒ Object

Raises:

  • (NotImplementedError)


212
213
214
# File 'lib/ethereum_client.rb', line 212

def eth_compile_solidity(code)
  raise NotImplementedError, 'eth_compile_solidity not yet implemented'
end

.eth_estimate_gas(object) ⇒ Object

Raises:

  • (NotImplementedError)


162
163
164
# File 'lib/ethereum_client.rb', line 162

def eth_estimate_gas(object)
  raise NotImplementedError, 'eth_estimate_gas not yet implemented'
end

.eth_gas_priceObject

Raises:

  • (NotImplementedError)


87
88
89
# File 'lib/ethereum_client.rb', line 87

def eth_gas_price
  raise NotImplementedError, 'eth_gas_price not yet implemented'
end

.eth_get_balance(address, block_number) ⇒ Object

Raises:

  • (NotImplementedError)


102
103
104
# File 'lib/ethereum_client.rb', line 102

def eth_get_balance(address, block_number)
  raise NotImplementedError, 'eth_get_balance not yet implemented'
end

.eth_get_block_by_hash(block_hash, full) ⇒ Object

Raises:

  • (NotImplementedError)


167
168
169
# File 'lib/ethereum_client.rb', line 167

def eth_get_block_by_hash(block_hash, full)
  raise NotImplementedError, 'eth_get_block_by_hash not yet implemented'
end

.eth_get_block_by_number(block_number, full) ⇒ Object

Raises:

  • (NotImplementedError)


172
173
174
# File 'lib/ethereum_client.rb', line 172

def eth_get_block_by_number(block_number, full)
  raise NotImplementedError, 'eth_get_block_by_number not yet implemented'
end

.eth_get_block_transaction_count_by_hash(block_hash) ⇒ Object

Raises:

  • (NotImplementedError)


117
118
119
# File 'lib/ethereum_client.rb', line 117

def eth_get_block_transaction_count_by_hash(block_hash)
  raise NotImplementedError, 'eth_get_block_transaction_count_by_hash not yet implemented'
end

.eth_get_block_transaction_count_by_number(block_number) ⇒ Object

Raises:

  • (NotImplementedError)


122
123
124
# File 'lib/ethereum_client.rb', line 122

def eth_get_block_transaction_count_by_number(block_number)
  raise NotImplementedError, 'eth_get_block_transaction_count_by_number not yet implemented'
end

.eth_get_code(address, block_number) ⇒ Object

Raises:

  • (NotImplementedError)


137
138
139
# File 'lib/ethereum_client.rb', line 137

def eth_get_code(address, block_number)
  raise NotImplementedError, 'eth_get_code not yet implemented'
end

.eth_get_compilersObject

Raises:

  • (NotImplementedError)


207
208
209
# File 'lib/ethereum_client.rb', line 207

def eth_get_compilers
  raise NotImplementedError, 'eth_get_compilers not yet implemented'
end

.eth_get_filter_changes(filter_id) ⇒ Object

Raises:

  • (NotImplementedError)


247
248
249
# File 'lib/ethereum_client.rb', line 247

def eth_get_filter_changes(filter_id)
  raise NotImplementedError, 'eth_get_filter_changes not yet implemented'
end

.eth_get_filter_logs(filter_id) ⇒ Object

Raises:

  • (NotImplementedError)


252
253
254
# File 'lib/ethereum_client.rb', line 252

def eth_get_filter_logs(filter_id)
  raise NotImplementedError, 'eth_get_filter_logs not yet implemented'
end

.eth_get_logs(filter) ⇒ Object

Raises:

  • (NotImplementedError)


257
258
259
# File 'lib/ethereum_client.rb', line 257

def eth_get_logs(filter)
  raise NotImplementedError, 'eth_get_logs not yet implemented'
end

.eth_get_storage_at(address, position, block_number) ⇒ Object

Raises:

  • (NotImplementedError)


107
108
109
# File 'lib/ethereum_client.rb', line 107

def eth_get_storage_at(address, position, block_number)
  raise NotImplementedError, 'eth_get_storage_at not yet implemented'
end

.eth_get_transaction_by_block_hash_and_index(block_hash, transaction_index) ⇒ Object

Raises:

  • (NotImplementedError)


182
183
184
# File 'lib/ethereum_client.rb', line 182

def eth_get_transaction_by_block_hash_and_index(block_hash, transaction_index)
  raise NotImplementedError, 'eth_get_transaction_by_block_hash_and_index not yet implemented'
end

.eth_get_transaction_by_block_number_and_index(block_number, transaction_index) ⇒ Object

Raises:

  • (NotImplementedError)


187
188
189
# File 'lib/ethereum_client.rb', line 187

def eth_get_transaction_by_block_number_and_index(block_number, transaction_index)
  raise NotImplementedError, 'eth_get_transaction_by_block_number_and_index not yet implemented'
end

.eth_get_transaction_by_hash(transaction_hash) ⇒ Object

Raises:

  • (NotImplementedError)


177
178
179
# File 'lib/ethereum_client.rb', line 177

def eth_get_transaction_by_hash(transaction_hash)
  raise NotImplementedError, 'eth_get_transaction_by_hash not yet implemented'
end

.eth_get_transaction_count(address, block_number) ⇒ Object

Raises:

  • (NotImplementedError)


112
113
114
# File 'lib/ethereum_client.rb', line 112

def eth_get_transaction_count(address, block_number)
  raise NotImplementedError, 'eth_get_transaction_count not yet implemented'
end

.eth_get_transaction_receipt(transaction_hash) ⇒ Object

Raises:

  • (NotImplementedError)


192
193
194
# File 'lib/ethereum_client.rb', line 192

def eth_get_transaction_receipt(transaction_hash)
  raise NotImplementedError, 'eth_get_transaction_receipt not yet implemented'
end

.eth_get_uncle_by_block_hash_and_index(block_hash, uncle_index) ⇒ Object

Raises:

  • (NotImplementedError)


197
198
199
# File 'lib/ethereum_client.rb', line 197

def eth_get_uncle_by_block_hash_and_index(block_hash, uncle_index)
  raise NotImplementedError, 'eth_get_uncle_by_block_hash_and_index not yet implemented'
end

.eth_get_uncle_by_block_number_and_index(block_number, uncle_index) ⇒ Object

Raises:

  • (NotImplementedError)


202
203
204
# File 'lib/ethereum_client.rb', line 202

def eth_get_uncle_by_block_number_and_index(block_number, uncle_index)
  raise NotImplementedError, 'eth_get_uncle_by_block_number_and_index not yet implemented'
end

.eth_get_uncle_count_by_block_hash(block_hash) ⇒ Object

Raises:

  • (NotImplementedError)


127
128
129
# File 'lib/ethereum_client.rb', line 127

def eth_get_uncle_count_by_block_hash(block_hash)
  raise NotImplementedError, 'eth_get_uncle_count_by_block_hash not yet implemented'
end

.eth_get_uncle_count_by_block_number(block_number) ⇒ Object

Raises:

  • (NotImplementedError)


132
133
134
# File 'lib/ethereum_client.rb', line 132

def eth_get_uncle_count_by_block_number(block_number)
  raise NotImplementedError, 'eth_get_uncle_count_by_block_number not yet implemented'
end

.eth_get_workObject

Raises:

  • (NotImplementedError)


262
263
264
# File 'lib/ethereum_client.rb', line 262

def eth_get_work
  raise NotImplementedError, 'eth_get_work not yet implemented'
end

.eth_hashrateObject

Raises:

  • (NotImplementedError)


82
83
84
# File 'lib/ethereum_client.rb', line 82

def eth_hashrate
  raise NotImplementedError, 'eth_hashrate not yet implemented'
end

.eth_miningObject

Raises:

  • (NotImplementedError)


77
78
79
# File 'lib/ethereum_client.rb', line 77

def eth_mining
  raise NotImplementedError, 'eth_mining not yet implemented'
end

.eth_new_block_filterObject

Raises:

  • (NotImplementedError)


232
233
234
# File 'lib/ethereum_client.rb', line 232

def eth_new_block_filter
  raise NotImplementedError, 'eth_new_block_filter not yet implemented'
end

.eth_new_filter(object) ⇒ Object

Raises:

  • (NotImplementedError)


227
228
229
# File 'lib/ethereum_client.rb', line 227

def eth_new_filter(object)
  raise NotImplementedError, 'eth_new_filter not yet implemented'
end

.eth_new_pending_transaction_filterObject

Raises:

  • (NotImplementedError)


237
238
239
# File 'lib/ethereum_client.rb', line 237

def eth_new_pending_transaction_filter
  raise NotImplementedError, 'eth_new_pending_transaction_filter not yet implemented'
end

.eth_protocol_versionObject

Returns the current ethereum protocol version.

github.com/ethereum/wiki/wiki/JSON-RPC#eth_protocolversion

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/ethereum_client.rb', line 60

def eth_protocol_version
  raise NotImplementedError, 'eth_protocol_version not yet implemented'
end

.eth_send_raw_transaction(signed_transaction_data) ⇒ Object

Raises:

  • (NotImplementedError)


152
153
154
# File 'lib/ethereum_client.rb', line 152

def eth_send_raw_transaction(signed_transaction_data)
  raise NotImplementedError, 'eth_send_raw_transaction not yet implemented'
end

.eth_send_transaction(object) ⇒ Object

Raises:

  • (NotImplementedError)


147
148
149
# File 'lib/ethereum_client.rb', line 147

def eth_send_transaction(object)
  raise NotImplementedError, 'eth_send_transaction not yet implemented'
end

.eth_sign(address, data) ⇒ Object

Raises:

  • (NotImplementedError)


142
143
144
# File 'lib/ethereum_client.rb', line 142

def eth_sign(address, data)
  raise NotImplementedError, 'eth_sign not yet implemented'
end

.eth_submit_hashrate(hashrate, random) ⇒ Object

Raises:

  • (NotImplementedError)


272
273
274
# File 'lib/ethereum_client.rb', line 272

def eth_submit_hashrate(hashrate, random)
  raise NotImplementedError, 'eth_submit_hashrate not yet implemented'
end

.eth_submit_work(nonce_found, headers_pow_hash, mix_digest) ⇒ Object

Raises:

  • (NotImplementedError)


267
268
269
# File 'lib/ethereum_client.rb', line 267

def eth_submit_work(nonce_found, headers_pow_hash, mix_digest)
  raise NotImplementedError, 'eth_submit_work not yet implemented'
end

.eth_syncingObject

Returns an object with data about the sync status or false.

github.com/ethereum/wiki/wiki/JSON-RPC#eth_syncing

Raises:

  • (NotImplementedError)


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

def eth_syncing
  raise NotImplementedError, 'eth_syncing not yet implemented'
end

.eth_uninstall_filter(filter_id) ⇒ Object

Raises:

  • (NotImplementedError)


242
243
244
# File 'lib/ethereum_client.rb', line 242

def eth_uninstall_filter(filter_id)
  raise NotImplementedError, 'eth_uninstall_filter not yet implemented'
end

.net_listeningObject

Returns true if client is actively listening for network connections.

github.com/ethereum/wiki/wiki/JSON-RPC#net_listening

Raises:

  • (NotImplementedError)


46
47
48
# File 'lib/ethereum_client.rb', line 46

def net_listening
  raise NotImplementedError, 'net_listening not yet implemented'
end

.net_peer_countObject

Returns number of peers currenly connected to the client.

github.com/ethereum/wiki/wiki/JSON-RPC#net_peercount

Raises:

  • (NotImplementedError)


53
54
55
# File 'lib/ethereum_client.rb', line 53

def net_peer_count
  raise NotImplementedError, 'net_peer_count not yet implemented'
end

.net_versionObject

Returns the current network protocol version.

github.com/ethereum/wiki/wiki/JSON-RPC#net_version

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/ethereum_client.rb', line 39

def net_version
  raise NotImplementedError, 'net_version not yet implemented'
end

.shh_add_to_group(address) ⇒ Object

Raises:

  • (NotImplementedError)


302
303
304
# File 'lib/ethereum_client.rb', line 302

def shh_add_to_group(address)
  raise NotImplementedError, 'shh_add_to_group not yet implemented'
end

.shh_get_filter_changes(filter_id) ⇒ Object

Raises:

  • (NotImplementedError)


317
318
319
# File 'lib/ethereum_client.rb', line 317

def shh_get_filter_changes(filter_id)
  raise NotImplementedError, 'shh_get_filter_changes not yet implemented'
end

.shh_get_messages(filter_id) ⇒ Object

Raises:

  • (NotImplementedError)


322
323
324
# File 'lib/ethereum_client.rb', line 322

def shh_get_messages(filter_id)
  raise NotImplementedError, 'shh_get_messages not yet implemented'
end

.shh_has_identity(address) ⇒ Object

Raises:

  • (NotImplementedError)


292
293
294
# File 'lib/ethereum_client.rb', line 292

def shh_has_identity(address)
  raise NotImplementedError, 'shh_has_identity not yet implemented'
end

.shh_new_filter(object) ⇒ Object

Raises:

  • (NotImplementedError)


307
308
309
# File 'lib/ethereum_client.rb', line 307

def shh_new_filter(object)
  raise NotImplementedError, 'shh_new_filter not yet implemented'
end

.shh_new_groupObject

Raises:

  • (NotImplementedError)


297
298
299
# File 'lib/ethereum_client.rb', line 297

def shh_new_group
  raise NotImplementedError, 'shh_new_group not yet implemented'
end

.shh_new_identityObject

Raises:

  • (NotImplementedError)


287
288
289
# File 'lib/ethereum_client.rb', line 287

def shh_new_identity
  raise NotImplementedError, 'shh_new_identity not yet implemented'
end

.shh_post(object) ⇒ Object

Raises:

  • (NotImplementedError)


282
283
284
# File 'lib/ethereum_client.rb', line 282

def shh_post(object)
  raise NotImplementedError, 'shh_post not yet implemented'
end

.shh_uninstall_filter(filter_id) ⇒ Object

Raises:

  • (NotImplementedError)


312
313
314
# File 'lib/ethereum_client.rb', line 312

def shh_uninstall_filter(filter_id)
  raise NotImplementedError, 'shh_uninstall_filter not yet implemented'
end

.shh_versionObject

Raises:

  • (NotImplementedError)


277
278
279
# File 'lib/ethereum_client.rb', line 277

def shh_version
  raise NotImplementedError, 'shh_version not yet implemented'
end

.web3_client_versionObject

Returns the current client version.

github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion



16
17
18
19
20
21
22
# File 'lib/ethereum_client.rb', line 16

def web3_client_version
  payload = {
    method: 'web3_clientVersion'
  }

  post(payload)
end

.web3_sha3(string) ⇒ Object

Returns Keccak-256 (not the standardized SHA3-256) of the given data.

github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3



27
28
29
30
31
32
33
34
# File 'lib/ethereum_client.rb', line 27

def web3_sha3(string)
  payload = {
    method: 'web3_sha3',
    params: [string]
  }

  post(payload)
end