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
- .eth_accounts ⇒ Object
- .eth_block_number ⇒ Object
- .eth_call(object) ⇒ Object
- .eth_coinbase ⇒ Object
- .eth_compile_LLL(code) ⇒ Object
- .eth_compile_serpent(code) ⇒ Object
- .eth_compile_solidity(code) ⇒ Object
- .eth_estimate_gas(object) ⇒ Object
- .eth_gas_price ⇒ Object
- .eth_get_balance(address, block_number) ⇒ Object
- .eth_get_block_by_hash(block_hash, full) ⇒ Object
- .eth_get_block_by_number(block_number, full) ⇒ Object
- .eth_get_block_transaction_count_by_hash(block_hash) ⇒ Object
- .eth_get_block_transaction_count_by_number(block_number) ⇒ Object
- .eth_get_code(address, block_number) ⇒ Object
- .eth_get_compilers ⇒ Object
- .eth_get_filter_changes(filter_id) ⇒ Object
- .eth_get_filter_logs(filter_id) ⇒ Object
- .eth_get_logs(filter) ⇒ Object
- .eth_get_storage_at(address, position, block_number) ⇒ Object
- .eth_get_transaction_by_block_hash_and_index(block_hash, transaction_index) ⇒ Object
- .eth_get_transaction_by_block_number_and_index(block_number, transaction_index) ⇒ Object
- .eth_get_transaction_by_hash(transaction_hash) ⇒ Object
- .eth_get_transaction_count(address, block_number) ⇒ Object
- .eth_get_transaction_receipt(transaction_hash) ⇒ Object
- .eth_get_uncle_by_block_hash_and_index(block_hash, uncle_index) ⇒ Object
- .eth_get_uncle_by_block_number_and_index(block_number, uncle_index) ⇒ Object
- .eth_get_uncle_count_by_block_hash(block_hash) ⇒ Object
- .eth_get_uncle_count_by_block_number(block_number) ⇒ Object
- .eth_get_work ⇒ Object
- .eth_hashrate ⇒ Object
- .eth_mining ⇒ Object
- .eth_new_block_filter ⇒ Object
- .eth_new_filter(object) ⇒ Object
- .eth_new_pending_transaction_filter ⇒ Object
-
.eth_protocol_version ⇒ Object
Returns the current ethereum protocol version.
- .eth_send_raw_transaction(signed_transaction_data) ⇒ Object
- .eth_send_transaction(object) ⇒ Object
- .eth_sign(address, data) ⇒ Object
- .eth_submit_hashrate(hashrate, random) ⇒ Object
- .eth_submit_work(nonce_found, headers_pow_hash, mix_digest) ⇒ Object
-
.eth_syncing ⇒ Object
Returns an object with data about the sync status or
false. - .eth_uninstall_filter(filter_id) ⇒ Object
-
.net_listening ⇒ Object
Returns true if client is actively listening for network connections.
-
.net_peer_count ⇒ Object
Returns number of peers currenly connected to the client.
-
.net_version ⇒ Object
Returns the current network protocol version.
- .shh_add_to_group(address) ⇒ Object
- .shh_get_filter_changes(filter_id) ⇒ Object
- .shh_get_messages(filter_id) ⇒ Object
- .shh_has_identity(address) ⇒ Object
- .shh_new_filter(object) ⇒ Object
- .shh_new_group ⇒ Object
- .shh_new_identity ⇒ Object
- .shh_post(object) ⇒ Object
- .shh_uninstall_filter(filter_id) ⇒ Object
- .shh_version ⇒ Object
-
.web3_client_version ⇒ Object
Returns the current client version.
-
.web3_sha3(string) ⇒ Object
Returns Keccak-256 (not the standardized SHA3-256) of the given data.
Class Method Details
.eth_accounts ⇒ Object
92 93 94 |
# File 'lib/ethereum_client.rb', line 92 def eth_accounts raise NotImplementedError, 'eth_accounts not yet implemented' end |
.eth_block_number ⇒ Object
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
157 158 159 |
# File 'lib/ethereum_client.rb', line 157 def eth_call(object) raise NotImplementedError, 'eth_call not yet implemented' end |
.eth_coinbase ⇒ Object
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
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
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
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
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_price ⇒ Object
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
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
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
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
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
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
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_compilers ⇒ Object
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
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
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
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
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
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
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
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
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
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
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
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
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
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_work ⇒ Object
262 263 264 |
# File 'lib/ethereum_client.rb', line 262 def eth_get_work raise NotImplementedError, 'eth_get_work not yet implemented' end |
.eth_hashrate ⇒ Object
82 83 84 |
# File 'lib/ethereum_client.rb', line 82 def eth_hashrate raise NotImplementedError, 'eth_hashrate not yet implemented' end |
.eth_mining ⇒ Object
77 78 79 |
# File 'lib/ethereum_client.rb', line 77 def eth_mining raise NotImplementedError, 'eth_mining not yet implemented' end |
.eth_new_block_filter ⇒ Object
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
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_filter ⇒ Object
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_version ⇒ Object
Returns the current ethereum protocol version.
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
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
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
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
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
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_syncing ⇒ Object
Returns an object with data about the sync status or false.
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
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_listening ⇒ Object
Returns true if client is actively listening for network connections.
46 47 48 |
# File 'lib/ethereum_client.rb', line 46 def net_listening raise NotImplementedError, 'net_listening not yet implemented' end |
.net_peer_count ⇒ Object
Returns number of peers currenly connected to the client.
53 54 55 |
# File 'lib/ethereum_client.rb', line 53 def net_peer_count raise NotImplementedError, 'net_peer_count not yet implemented' end |
.net_version ⇒ Object
Returns the current network protocol version.
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
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
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
322 323 324 |
# File 'lib/ethereum_client.rb', line 322 def (filter_id) raise NotImplementedError, 'shh_get_messages not yet implemented' end |
.shh_has_identity(address) ⇒ Object
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
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_group ⇒ Object
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_identity ⇒ Object
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
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
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_version ⇒ Object
277 278 279 |
# File 'lib/ethereum_client.rb', line 277 def shh_version raise NotImplementedError, 'shh_version not yet implemented' end |
.web3_client_version ⇒ Object
Returns the current client version.
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.
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 |