module EthereumClient
Ethereum JSON RPC client
Constants
- Error
- HEADERS
Public Class Methods
github.com/ethereum/wiki/wiki/JSON-RPC#eth_accounts
# File lib/ethereum_client.rb, line 92 def eth_accounts raise NotImplementedError, 'eth_accounts not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber
# File lib/ethereum_client.rb, line 97 def eth_block_number raise NotImplementedError, 'eth_block_number not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_call
# File lib/ethereum_client.rb, line 157 def eth_call(object) raise NotImplementedError, 'eth_call not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_coinbase
# File lib/ethereum_client.rb, line 72 def eth_coinbase raise NotImplementedError, 'eth_coinbase not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilelll
# File lib/ethereum_client.rb, line 217 def eth_compile_LLL(code) raise NotImplementedError, 'eth_compile_LLL not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_compileserpent
# File lib/ethereum_client.rb, line 222 def eth_compile_serpent(code) raise NotImplementedError, 'eth_compile_serpent not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilesolidity
# File lib/ethereum_client.rb, line 212 def eth_compile_solidity(code) raise NotImplementedError, 'eth_compile_solidity not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas
# File lib/ethereum_client.rb, line 162 def eth_estimate_gas(object) raise NotImplementedError, 'eth_estimate_gas not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice
# File lib/ethereum_client.rb, line 87 def eth_gas_price raise NotImplementedError, 'eth_gas_price not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance
# File lib/ethereum_client.rb, line 102 def eth_get_balance(address, block_number) raise NotImplementedError, 'eth_get_balance not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode
# File lib/ethereum_client.rb, line 137 def eth_get_code(address, block_number) raise NotImplementedError, 'eth_get_code not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcompilers
# File lib/ethereum_client.rb, line 207 def eth_get_compilers raise NotImplementedError, 'eth_get_compilers not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges
# File lib/ethereum_client.rb, line 247 def eth_get_filter_changes(filter_id) raise NotImplementedError, 'eth_get_filter_changes not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs
# File lib/ethereum_client.rb, line 252 def eth_get_filter_logs(filter_id) raise NotImplementedError, 'eth_get_filter_logs not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs
# File lib/ethereum_client.rb, line 257 def eth_get_logs(filter) raise NotImplementedError, 'eth_get_logs not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt
# File lib/ethereum_client.rb, line 192 def eth_get_transaction_receipt(transaction_hash) raise NotImplementedError, 'eth_get_transaction_receipt not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblockhashandindex
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblocknumberandindex
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_getwork
# File lib/ethereum_client.rb, line 262 def eth_get_work raise NotImplementedError, 'eth_get_work not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_hashrate
# File lib/ethereum_client.rb, line 82 def eth_hashrate raise NotImplementedError, 'eth_hashrate not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining
# File lib/ethereum_client.rb, line 77 def eth_mining raise NotImplementedError, 'eth_mining not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter
# File lib/ethereum_client.rb, line 232 def eth_new_block_filter raise NotImplementedError, 'eth_new_block_filter not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter
# File lib/ethereum_client.rb, line 227 def eth_new_filter(object) raise NotImplementedError, 'eth_new_filter not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter
# File lib/ethereum_client.rb, line 237 def eth_new_pending_transaction_filter raise NotImplementedError, 'eth_new_pending_transaction_filter not yet implemented' end
Returns the current ethereum protocol version.
github.com/ethereum/wiki/wiki/JSON-RPC#eth_protocolversion
# File lib/ethereum_client.rb, line 60 def eth_protocol_version raise NotImplementedError, 'eth_protocol_version not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction
# 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
github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction
# File lib/ethereum_client.rb, line 147 def eth_send_transaction(object) raise NotImplementedError, 'eth_send_transaction not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign
# File lib/ethereum_client.rb, line 142 def eth_sign(address, data) raise NotImplementedError, 'eth_sign not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_submithashrate
# File lib/ethereum_client.rb, line 272 def eth_submit_hashrate(hashrate, random) raise NotImplementedError, 'eth_submit_hashrate not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_submitwork
# 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
Returns an object with data about the sync status or false
.
github.com/ethereum/wiki/wiki/JSON-RPC#eth_syncing
# File lib/ethereum_client.rb, line 67 def eth_syncing raise NotImplementedError, 'eth_syncing not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter
# File lib/ethereum_client.rb, line 242 def eth_uninstall_filter(filter_id) raise NotImplementedError, 'eth_uninstall_filter not yet implemented' end
Returns true if client is actively listening for network connections.
github.com/ethereum/wiki/wiki/JSON-RPC#net_listening
# File lib/ethereum_client.rb, line 46 def net_listening raise NotImplementedError, 'net_listening not yet implemented' end
Returns number of peers currenly connected to the client.
github.com/ethereum/wiki/wiki/JSON-RPC#net_peercount
# File lib/ethereum_client.rb, line 53 def net_peer_count raise NotImplementedError, 'net_peer_count not yet implemented' end
Returns the current network protocol version.
github.com/ethereum/wiki/wiki/JSON-RPC#net_version
# File lib/ethereum_client.rb, line 39 def net_version raise NotImplementedError, 'net_version not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#shh_addtogroup
# File lib/ethereum_client.rb, line 302 def shh_add_to_group(address) raise NotImplementedError, 'shh_add_to_group not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#shh_getfilterchanges
# File lib/ethereum_client.rb, line 317 def shh_get_filter_changes(filter_id) raise NotImplementedError, 'shh_get_filter_changes not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#shh_getmessages
# File lib/ethereum_client.rb, line 322 def shh_get_messages(filter_id) raise NotImplementedError, 'shh_get_messages not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#shh_hasidentity
# File lib/ethereum_client.rb, line 292 def shh_has_identity(address) raise NotImplementedError, 'shh_has_identity not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#shh_newfilter
# File lib/ethereum_client.rb, line 307 def shh_new_filter(object) raise NotImplementedError, 'shh_new_filter not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#shh_newgroup
# File lib/ethereum_client.rb, line 297 def shh_new_group raise NotImplementedError, 'shh_new_group not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#shh_newidentity
# File lib/ethereum_client.rb, line 287 def shh_new_identity raise NotImplementedError, 'shh_new_identity not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#shh_post
# File lib/ethereum_client.rb, line 282 def shh_post(object) raise NotImplementedError, 'shh_post not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#shh_uninstallfilter
# File lib/ethereum_client.rb, line 312 def shh_uninstall_filter(filter_id) raise NotImplementedError, 'shh_uninstall_filter not yet implemented' end
github.com/ethereum/wiki/wiki/JSON-RPC#shh_version
# File lib/ethereum_client.rb, line 277 def shh_version raise NotImplementedError, 'shh_version not yet implemented' end
Returns the current client version.
github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion
# File lib/ethereum_client.rb, line 16 def web3_client_version payload = { method: 'web3_clientVersion' } post(payload) end
Returns Keccak-256 (not the standardized SHA3-256) of the given data.
github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3
# File lib/ethereum_client.rb, line 27 def web3_sha3(string) payload = { method: 'web3_sha3', params: [string] } post(payload) end
Private Class Methods
# File lib/ethereum_client.rb, line 328 def post(payload) body = payload.to_json response = HTTParty.post(url, body: body, headers: HEADERS) json = JSON.parse(response.body) if json.key?('error') raise EthereumClient::Error, json['error']['message'] end json['result'] end
# File lib/ethereum_client.rb, line 342 def url 'http://localhost:8545' end