Ethereum

JSON-RPC API | ethereum.org

In order for a software application to interact with the ethereum blockchain, either by reading data from the blockchain or sending transactions to the network, it must connect to an ethereum node.

For this purpose, every ethereum client implements a json-rpc specification, so there is a uniform set of methods that applications can rely on, regardless of the specific node or client implementation.

Reading: Ethereum json rpc

json-rpc is a lightweight, stateless remote procedure call (rpc) protocol. defines various data structures and the rules around their processing. it is transport independent in the sense that the concepts can be used within the same process, over sockets, over http, or in many message passing environments. uses json (rfc 4627) as data format.

client implementations

ethereum clients can use different programming languages ​​by implementing the json-rpc specification. see the individual client documentation for more details related to specific programming languages. we recommend consulting each client’s documentation for the latest api support information.

convenience libraries

While you can choose to interact directly with ethereum clients via the json-rpc api, there are often easier options for dapp developers. There are many javascript and back-end api libraries to provide wrappers in addition to the json-rpc api. With these libraries, developers can write intuitive one-liner methods in the programming language of their choice to initialize json-rpc requests (under the hood) that interact with ethereum.

specification

read the full json-rpc api spec on github.

conventions

hexadecimal value encoding

Two key data types are passed via json: raw byte arrays and amounts. both are passed in hexadecimal encoding but with different format requirements.

quantities

when encoding quantities (integers, numbers): encode as hexadecimal, prefixed with “0x”, the most compact representation (small exception: zero must be represented as “0x0”).

here are some examples:

  • 0x41 (65 decimal)
  • 0x400 (1024 decimal)
  • wrong: 0x (must always have at least one digit – zero is “0x0”)
  • incorrect: 0x0400 (no leading zeros allowed)
  • incorrect: ff (must be prefixed with 0x)

raw data

when encoding raw data (byte arrays, account addresses, hashes, bytecode arrays): encode as hex, prefix “0x”, two hex digits per byte.

here are some examples:

  • 0x41 (size 1, “a”)
  • 0x004200 (size 3, “b”)
  • 0x (size 0, “”)
  • incorrect: 0xf0f0f (must have an even number of digits)
  • incorrect: 004200 (must have 0x prefix)

the default block parameter

The following methods have an additional default block parameter:

  • eth_getbalance
  • eth_getcode
  • eth_gettransactioncount
  • eth_getstorageat
  • eth_call

when making requests that act on the state of ethereum, the last default block parameter determines the block height.

The following options are possible for the default block parameter:

  • hexadecimal string – an integer block number
  • “earliest” string for the earliest/genesis block
  • “latest” string – for the latest block extracted
  • “pending” string – for status/pending transactions

examples

On this page, we provide examples of how to use individual json_rpc api endpoints using the command line tool, curl. these individual endpoint examples are below in the curl examples section. Further down the page, we also provide an end-to-end example for building and deploying a smart contract using a geth node, the json_rpc api, and curl.

examples of curls

The following are examples of using the json_rpc api by making curl requests to an ethereum node. each example includes a description of the specific endpoint, its parameters, the return type, and a practical example of how it should be used.

curl requests may return an error message related to the content type. this is because the -data option sets the content-type to application/x-www-form-urlencoded. if your node complains about this, manually set the header by putting -h “content-type: application/json” at the beginning of the call. the examples also do not include the url/ip & port combination that must be the last argument given to curl (for example, 127.0.0.1:8545). a complete curl request including this additional data takes the following form:

gossip, status, history

A handful of core json-rpc methods require data from the ethereum network and fall neatly into three main categories: gossip, status, and history. use the links in these sections to jump to each method, or use the table of contents to explore the full list of methods.

methods of gossip

These methods trace the head of the string. this is how transactions traverse the network, find their way to blocks, and how clients find out about new blocks.

  • eth_blocknumber
  • eth_sendrawtransaction

state methods

methods that report the current state of all stored data. the “status” is like a big shared piece of ram and includes account balances, contract data, and gas estimates.

  • eth_getbalance
  • eth_getstorageat
  • eth_gettransactioncount
  • eth_getcode
  • eth_call
  • eth_estimategas

history methods

get historical records of each block up to genesis. it’s like one big file just to append and it includes all the block headers, block bodies, uncle blocks and transaction receipts.

  • eth_getblocktransactioncountbyhash
  • eth_getblocktransactioncountbynumber
  • eth_getunclecountbyblockhash
  • eth_getunclecountbyblocknumber
  • eth_getblockbyhash
  • eth_getblockbynumber</li
  • eth_gettransactionbyhash
  • eth_gettransactionbyblockhashandindex
  • eth_gettransactionbyblocknumberandindex
  • eth_gettransactionreceipt
  • eth_getunclebyblockhashandindex
  • eth_getunclebyblocknumberandindex

json-rpc api methods

web3_client version

returns the current version of the client.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

string – the current version of the client

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

web3_sha3

returns keccak-256 (not the standardized sha3-256) of the given data.

parameters

  1. data: the data to convert to a sha3 hash

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

data: the sha3 result of the given string.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

net_version

returns the current network id.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

string: the current network ID.

The full list of current network ids is available at chainlist.org. some common ones are: 1: ethereum mainnet 2: morden testnet (now deprecated) 3: ropsten testnet 4: rinkeby testnet 5: goerli testnet

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

net_listening

returns true if the client is actively listening for network connections.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

boolean: true when listening; otherwise false.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

net_peercount

returns the number of peers currently connected to the client.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

quantity – integer of the number of connected pairs.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_protocol_version

returns the current version of the ethereum protocol.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

string – the current version of the ethereum protocol

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_syncing

returns an object with data about the sync state or false.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

object|boolean, an object with sync status data or false, when not syncing:

  • start block: amount: the block the import started on (it will only restart, after the sync reaches its head)
  • current block: amount: the current block , same as eth_blocknumber
  • highestblock: number – highest estimated block

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_coinbase

returns the client’s currency base address.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

data, 20 bytes: the current address of the coin base.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

ethical_mining

returns true if the client is actively mining new blocks.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

boolean: returns true if the client is mining, false otherwise.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

hash_rate

returns the number of hashes per second that the node is mining with.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

amount – number of hashes per second.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_gasprice

returns the current price for gas in wei.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

quantity – integer of the current gas price in wei.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_accounts

returns a list of addresses owned by the client.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

data array, 20 bytes – client owned addresses.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_block_number

returns the number of the most recent block.

parameters

none

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

amount: integer of the current block number the client is in.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getbalance

returns the account balance for the given address.

parameters

  1. data, 20 bytes: address to check balance.
  2. amount|label: integer block number, or the string “latest”, “earliest”, or “pending”, see the default block parameter

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

amount – integer of the current balance in wei.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getstorageat

returns the value of a storage position at a given address.

parameters

  1. data, 20 bytes – address of storage.
  2. amount – integer of position in storage.
  3. amount|label – integer block number, or the “last”, “first”, or “pending” string, see the default block parameter

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

data: the value at this storage position.

example calculating the correct position depends on the storage to retrieve. Consider the following contract implemented at 0x295a70b2de5e3953354a6a8344e616ed314d7251 by address 0x391694e7e0b0cce554cb130d723a9d27458f9298.

Retrieving the value of pos0 is easy:

Retrieving a map element is more difficult. the position of an element on the map is calculated with:

this means that to retrieve the storage at pos1[“0x391694e7e0b0cce554cb130d723a9d27458f9298”] we need to calculate the position with:

you can use the geth console that comes with the web3 library to do the calculation:

now to get the storage:

eth_gettransactioncount

returns the number of transactions sent from an address.

parameters

  1. data, 20 bytes – address.
  2. amount|label – integer block number, or string “newest”, “oldest”, or “pending”, see parameter default block

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

amount: integer of the number of transactions sent from this address.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getblocktransactioncountbyhash

returns the number of transactions in a block of a block that matches the given block hash.

parameters

  1. data, 32 bytes – hash of a block

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

amount – integer of the number of transactions in this block.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getblocktransactioncountbynumber

returns the number of transactions in a block that matches the given block number.

parameters

  1. amount|label: integer of a block number, or the string “oldest”, “newest”, or “pending”, as in the default block parameter.

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

amount – integer of the number of transactions in this block.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getunclecountbyblockhash

returns the number of uncles in a block of a block that match the given block hash.

parameters

  1. data, 32 bytes – hash of a block

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

quantity – integer of the number of guys in this block.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getunclecountbyblocknumber

returns the number of guys in a block of a block that matches the given block number.

parameters

  1. amount|label: integer of a block number, or the string “newest”, “oldest” or “pending”, see default block parameter

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

quantity – integer of the number of guys in this block.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getcode

returns the code at a given address.

parameters

  1. data, 20 bytes – address
  2. amount|label – integer block number, or string “newest”, “oldest”, or “pending”, see block parameter default

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

data – the code of the given address.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_sign

the sign method calculates an ethereum-specific signature with: sign(keccak256(“x19ethereum signed message:n” + len(message) + message))).

by adding a prefix to the message, the computed signature is recognized as an ethereum-specific signature. this prevents misuse where a malicious dapp can sign arbitrary data (eg transactions) and use the signature to impersonate the victim.

note: address to sign must be unblocked.

parameters

  1. data, 20 bytes – address
  2. data, n bytes – message to sign

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

data: signature

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

transaction_eth_sign

sign a transaction that can be sent to the network at a later time using eth_sendrawtransaction.

parameters

  1. object – the transaction object
  • from: data, 20 bytes – the address from which the transaction is sent.
  • to: data, 20 bytes – (optional when creating a new contract) the address to which the transaction is directed.
  • gas: quantity – (optional, default: 90000) integer of the gas provided for the execution of the transaction. will return unused gas.
  • gasprice: quantity – (optional, default: TBD) integer of the gasprice used for each paid gas, in wei.
  • value: quantity – ( optional) integer of the value sent with this transaction, in wei.
  • data: data – the compiled code of a contract or the hash of the invoked method signature and encoded parameters.
  • nonce: amount – (optional) integer of a nonce. this allows you to overwrite your own pending transactions that use the same nonce.

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

data, the signed transaction object.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_sendtransaction

creates a new message call transaction or contract creation, if the data field contains code.

parameters

  1. object – the transaction object
  • from: data, 20 bytes – the address from which the transaction is sent.
  • to: data, 20 bytes – (optional when creating a new contract) the address to which the transaction is directed.
  • gas: quantity – (optional, default: 90000) integer of the gas provided for the execution of the transaction. will return unused gas.
  • gasprice: quantity – (optional, default: TBD) integer of the gas price used for each gas paid.
  • value: quantity – ( optional ) integer of the value sent with this transaction.
  • data: data: the compiled code of a contract or the hash of the invoked method signature and encoded parameters.
  • nonce: amount – (optional) integer of a nonce. this allows you to overwrite your own pending transactions that use the same nonce.

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

data, 32 bytes: The hash of the transaction, or the zero hash if the transaction is not yet available.

use eth_gettransactionreceipt to get the address of the contract, after the transaction was pulled, when you created a contract.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_sendrawtransaction

creates a new message call transaction or contract creation for signed transactions.

parameters

  1. data, the data of the signed transaction.

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

data, 32 bytes: The hash of the transaction, or the zero hash if the transaction is not yet available.

use eth_gettransactionreceipt to get the address of the contract, after the transaction was pulled, when you created a contract.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_call

executes a new message call immediately without creating a transaction on the blockchain.

parameters

  1. object: the transaction call object
  • from: data, 20 bytes – (optional) the address from which the transaction is sent.
  • to: data, 20 bytes – the address to which the transaction is directed.
  • gas: quantity – (optional) integer of the gas provided for the execution of the transaction. eth_call consumes zero gas, but this parameter may be required for some executions.
  • gasprice: quantity – (optional) integer of the gas price used for each gas paid
  • value: quantity – ( optional) integer of the value sent with this transaction
  • data: data – (optional) method signature hash and encoded parameters. for more information see ethereum contract abi in solidity documentation
  1. amount|label: integer block number, or the string “newest”, “oldest” or “pending”, see default block parameter

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

data: the return value of the executed contract.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_estimategas

generates and returns an estimate of the amount of gas needed to allow the transaction to complete. the transaction will not be added to the blockchain. Please note that the estimate may be significantly higher than the amount of gas actually used by the transaction, for a variety of reasons including evm mechanics and node performance.

parameters

see eth_call parameters, expect all properties to be optional. if no gas limit is specified, geth uses the pending block’s gas limit as the upper limit. as a result, the estimate returned may not be enough to execute the call/transaction when the amount of gas is greater than the gas limit of the pending block.

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

amount – the amount of gas used.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getblockbyhash

returns information about a hash block.

parameters

  1. data, 32 bytes – hash of a block.
  2. boolean – if true, return full transaction objects, if false, only transaction hashes.

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

object: a block object or null when no block was found:

  • number: quantity – the block number. null when its block is pending.
  • hash: data, 32 bytes – hash of the block. null when its block is pending.
  • parenthash: data, 32 bytes – hash of the parent block.
  • nonce: data, 8 bytes – hash of the generated proof of work. null when your block is pending.
  • sha3uncles: data, 32 bytes – sha3 of the uncles data in the block.
  • logsbloom: data, 256 bytes – the bloom filter for the records of the block. null when its block is pending.
  • transactionsroot: data, 32 bytes – the root of the block’s trie transaction.
  • stateroot: data, 32 bytes – the root of the final trie state of the block.
  • receiptsroot: data, 32 bytes – the root of the trie receipts of the block.
  • miner: data, 20 bytes – the address of the beneficiary to whom the rewards were given mining.
  • difficulty: amount – integer of the difficulty for this block.
  • totaldifficulty: amount – integer of the total difficulty of the chain up to this block.
  • extradata: data: the “extra data” field of this block.
  • size: quantity: integer of the size of this block in bytes.
  • gaslimit: quantity: the maximum gas allowed in this block.
  • gasused: amount – the total gas used by all transactions in this block.
  • timestamp: amount – the unix timestamp for when block was matched .
  • transactions: ma array – array of transaction objects, or 32-byte transaction hashes depending on the last parameter given.
  • uncles: array – array of uncle hashes.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getblockbynumber

returns information about a block by block number.

parameters

  1. amount|label: integer of a block number, or the string “oldest”, “newest”, or “pending”, as in the default block parameter.
  2. boolean: if true returns the full transaction objects, if false, only the hash values ​​of the transactions.

returns see eth_getblockbyhash

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

result see eth_getblockbyhash

eth_gettransactionbyhash

returns information about a requested transaction by transaction hash.

parameters

  1. data, 32 bytes – hash of a transaction

See also: 7 Best Motherboards for Mining Reviews in 2022

returns

object: a transaction object or null when no transaction was found:

  • blockhash: data, 32 bytes – hash of the block where this transaction was. null when pending.
  • blocknumber: amount – block number where this transaction was. null when pending.
  • from: data, 20 bytes – sender address.
  • gas: quantity – gas provided by sender.
  • gasprice: quantity – gas price provided by the sender in wei.
  • hash: data, 32 bytes – hash of the transaction.
  • input: data – the data is sent along with the transaction.
  • nonce: amount – the number of transactions made by the sender before this.
  • to: data, 20 bytes – address of the receiver. null when it is a contract creation transaction.
  • transaction index: amount – integer of the transaction index position in the block. null when pending.
  • value: amount – value transferred in wei.
  • v: amount – ecdsa retrieval id
  • r: amount – ecdsa signature r
  • s: quantity – ecdsa signature s

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_gettransactionbyblockhashandindex

returns information about a transaction by block hash and transaction index position.

parameters

  1. data, 32 bytes – hash of a block.
  2. amount – integer of transaction index position.

returns see eth_gettransactionbyhash

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

See also: Wormhole cryptocurrency platform hacked for 325 million after error on GitHub – The Verge

result see eth_gettransactionbyhash

eth_gettransactionbyblocknumberandindex

returns information about a transaction by block number and transaction index position.

parameters

  1. amount|label: a block number, or the “oldest”, “newest”, or “pending” string, as in the default block parameter.
  2. amount: the transaction index position.

returns see eth_gettransactionbyhash

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

See also: Wormhole cryptocurrency platform hacked for 325 million after error on GitHub – The Verge

result see eth_gettransactionbyhash

eth_gettransactionreceipt

returns the receipt of a transaction by transaction hash.

Note that the receipt is not available for pending transactions.

parameters

  1. data, 32 bytes – hash of a transaction

returns object: a transaction receipt object, or null when no receipt was found:

  • transactionhash : data, 32 bytes – transaction hash.
  • transactionindex: amount – integer of the transaction index position in the block.
  • blockhash : data, 32 bytes – hash of the block where this transaction was.
  • blocknumber: amount – block number where this transaction was.
  • from: data, 20 bytes – sender address .
  • a: data, 20 bytes – receiver address. null when it is a contract creation transaction.
  • cumulativegasused: amount: the total amount of gas used when this transaction was executed in the block.
  • gasused: amount: the amount of gas used by this specific transaction only.
  • contract address: data, 20 bytes: the contract address created, if the transaction was a contract creation, otherwise null.
  • logs: array: array of log objects, which generated this transaction.
  • logsbloom: data, 256 bytes: bloom filter for light clients to quickly retrieve related logs. also returns:
  • root: 32-byte post-transaction stateroot data (pre byzantium)
  • status: quantity 1 (success) or 0 (failure)

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getunclebyblockhashandindex

returns information about an uncle in a block using the uncle’s hash and index position.

parameters

  1. data, 32 bytes: the hash of a block.
  2. amount: the position of the uncle’s index.

returns see eth_getblockbyhash

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

result see eth_getblockbyhash

note: a guy does not contain individual transactions.

eth_getunclebyblocknumberandindex

returns information about a guy in a block by number and index position of guy.

parameters

  1. amount|label: a block number, or the “oldest”, “newest”, or “pending” string, as in the default block parameter.
  2. amount: the uncle index position.

returns see eth_getblockbyhash

note: a guy does not contain individual transactions.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

result see eth_getblockbyhash

eth_get compilers

returns a list of available compilers on the client.

parameters none

returns array – array of available compilers.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_compilesolidity

returns the compiled robustness code.

parameters

  1. string – the source code.

returns data: the compiled source code.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_compilellll

returns the compiled lll code.

parameters

  1. string – the source code.

returns data: the compiled source code.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_compileserpent

returns the compiled snake code.

parameters

  1. string – the source code.

returns data: the compiled source code.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_newfilter

create a filter object, based on filter options, to notify when state changes (records). to check if the state has changed, call eth_getfilterchanges.

A note about specifying topic filters: Topics depend on order. a transaction with a record with topics [a, b] will be matched against the following topic filters:

  • [] “anything”
  • [a] “a in first position (and anything after)”
  • [null, b] “anything in first position and b in second position (and anything after)”
  • [a, b] “a in first position and b in second position (and anything after)”
  • [[ a, b ], [a, b]] “(a or b) in first position and (a or b) in second position (and anything after)”
  • parameters
  1. object – the filter options:
  • fromblock: amount|label – (optional, default: “latest”) integer block number, or “latest” for the last mined block or “pending”, “first” for transactions not yet mined .
  • toblock: amount|label – (optional, default: “latest”) integer block number, or “latest” for last mined block or “pending”, “first” for transactions yet not mined.</li
  • address: data|array, 20 bytes – (optional) contract address or a list of addresses from which records should originate.
  • topics: data array, – (optional) 32-byte array data topics topics depend on order. each topic can also be an array of data with “or” options.

returns amount – a filter id.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_newblockfilter

create a filter on the node, to notify when a new block arrives. to check if the state has changed, call eth_getfilterchanges.

parameters none

returns amount – a filter id.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_newpendingtransactionfilter

create a filter on the node, to notify when new pending transactions arrive. to check if the state has changed, call eth_getfilterchanges.

parameters none

returns amount – a filter id.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_uninstallfilter

uninstalls a filter with the given id. should always be called when the watch is no longer needed. additionally, it filters the timeout when they are not requested with eth_getfilterchanges for a period of time.

parameters

  1. amount – the filter ID.

returns boolean: true if the filter was successfully uninstalled; otherwise false.

example

See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

eth_getfilterchanges

polling method for a filter, which returns a series of records that occurred since the last poll.

parameters

  1. amount – the filter ID.

returns array: array of log objects or an empty array if nothing has changed since the last poll.

  • for filters created with eth_newblockfilter, the return is block hashes (data, 32 bytes), e.g. [“0x3454645634534…”].
  • For filters created with eth_newpendingtransactionfilter, the return is transaction hashes (data, 32 bytes), e.g. [“0x6345343454645…”].
  • For filters created with eth_newfilter, the records are objects with the following parameters:
    • removed: tag: true when the record was removed, because to a rearrangement of the chain. false if it is a valid log.
    • logindex: count – integer of the log index position in the block. null when the record is pending.
    • transaction index: quantity – integer of the position record of the transaction index from which it was created. null when the record is pending.
    • transactionhash: data, 32 bytes – hash of the transactions from which this record was created. null when pending record.
    • blockhash: data, 32 bytes – hash of the block where this record was. null when pending. null when pending record.
    • block number: amount – the block number where this record was. null when pending. null when pending record.
    • address: data, 20 bytes: address from which this record originated.
    • data: data: contains one or more 32 non-indexed arguments log bytes.
    • topics: data array – 0 to 4 32-byte data array of indexed log arguments. (in solidity: the first topic is the hash of the event signature (eg bucket(address, bytes32, uint256)), except that you declared the event with the anonymous specifier).

    eth_getfilterlogs

    returns an array of all records matching the filter with the given id.

    parameters

    1. amount – the filter ID.

    returns see eth_getfilterchanges

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

    result see eth_getfilterchanges

    eth_getlogs

    returns an array of all records that match a given filter object.

    parameters

    1. object – the filter options:
    • fromblock: amount|label – (optional, default: “latest”) integer block number, or “latest” for the last mined block or “pending”, “first” for transactions not yet mined .
    • toblock: amount|label – (optional, default: “latest”) integer block number, or “latest” for last mined block or “pending”, “first” for transactions yet not mined.</li
    • address: data|array, 20 bytes – (optional) contract address or a list of addresses from which records should originate.
    • topics: data array, – (optional) 32-byte array data topics topics depend on order. each topic can also be an array of data with “or” options.
    • blockhash: data, 32 bytes – (optional, future) with the addition of eip-234, blockhash there will be a new filter option that restricts the returned records to the single block with the 32 byte blockhash hash. using blockhash is equivalent to fromblock = toblock = the hashed block number blockhash. if blockhash is present in the filter criteria, neither fromblock nor toblock are allowed.

    returns see eth_getfilterchanges

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

    result see eth_getfilterchanges

    eth_getwork

    returns the hash of the current block, the seedhash, and the boundary condition to be met (“target”).

    parameters none

    returns array – array with the following properties:

    1. data, 32 bytes: current block header pow-hash
    2. data, 32 bytes: the initial hash used for the dag.
    3. data, 32 bytes: the boundary condition (“target”), 2^256 / difficulty.

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

    eth_submitwork

    used to submit a proof of work solution.

    parameters

    1. data, 8 bytes – the found nonce (64 bits)
    2. data, 32 bytes – the header pow-hash (256 bits)
    3. data, 32 bytes – the merge summary (256 bits)

    returns boolean: returns true if the supplied solution is valid; otherwise return false.

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

    eth_submithashrate

    used to send mining hashrate.

    parameters

    1. hashrate, a hexadecimal string (32 bytes) representation of the hashrate
    2. id, string – a random hexadecimal id (32 bytes) that identifies the client

    returns boolean: returns true if the submission was successful and false otherwise.

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

    db_putstring (deprecated)

    stores a string in the local database.

    note this function is deprecated.

    parameters

    1. string – database name.
    2. string – key name.
    3. string – string to store.

    returns boolean: returns true if the value was stored; otherwise return false.

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

    db_getstring (deprecated)

    returns a string from the local database. note this function is deprecated.

    parameters

    1. string – database name.
    2. string – key name.

    returns string: the previously stored string.

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

    db_puthex (deprecated)

    stores binary data in the local database. note this function is deprecated.

    parameters

    1. string – database name.
    2. string – key name.
    3. data – data to store.

    returns boolean: returns true if the value was stored; otherwise return false.

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

    db_gethex (deprecated)

    returns binary data from the local database. note this function is deprecated.

    parameters

    1. string – database name.
    2. string – key name.

    returns data: the previously stored data.

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

    shh_version (deprecated)

    returns the current version of the whisper protocol.

    note this function is deprecated.

    parameters none

    returns string: the current version of the whisper protocol

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

    shh_post (deprecated)

    sends a whisper message.

    note this function is deprecated.

    parameters

    1. object – the whisper post object:
    • from: data, 60 bytes – (optional) the identity of the sender.
    • to: data, 60 bytes – (optional) the identity of the receiver. when present, the whisper will encrypt the message so that only the receiver can decrypt it.
    • subjects: dataset: set of data subjects, for messages to be identified by the receiver.
    • payload: data – the payload of the message.
    • priority: amount – the integer of the priority in a range of… (?).
    • ttl: amount – integer number of live time in seconds.

    returns boolean: returns true if the message was sent; otherwise return false.

    example

    See also: Accurate &quot2-Clicks&quot Ethereum Mining and Profit Calculator (2022 updated)

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button