API Reference
DocumentationLog In

This document describes the native Ethereum API methods that are supported by Coinbase Node.

Servers

This is the server endpoint URL for Ethereum Mainnet.

Authentication:

This endpoint uses HTTP Basic Auth.

To authenticate to this API:

  • Create a project in the Coinbase Cloud Console
  • Grab your project-specific API Access Token username and password from the project overview page
  • Include your username and password as auth in each HTTP request

Methods

web3_clientVersion

Gets the version of the current client.

Parameters

None

Returns

TypeDescription
StringThe client version.

net_version

Gets the network ID associated with the network.

Parameters

None

Returns

TypeDescription
StringThe network ID associated with the network.

eth_blockNumber

Gets the number of most recent block.

Parameters

None

Returns

TypeDescription
StringThe block number.

eth_call

Executes a new message call (locally) immediately without creating a transaction on the block chain.

Parameters

NameTypeDescription
transactionTransactionREQUIRED. The transaction.
blockNumberStringREQUIRED. The block number.

Returns

TypeDescription
StringThe return value of the executed contract.

eth_chainId

Gets the currently configured chain ID, a value used in replay-protected transaction signing as introduced by EIP-155.

Parameters

None

Returns

TypeDescription
StringHex format integer of the current chain ID. Defaults are ETC=61, ETH=1, Morden=62.

eth_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

Parameters

NameTypeDescription
transactionTransactionREQUIRED. The transaction.

Returns

TypeDescription
StringThe amount of gas used.

eth_feeHistory

Gets transaction base fee per gas and effective priority fee per gas for the requested/supported block range.

Parameters

NameTypeDescription
blockCountStringREQUIRED. Requested range of blocks. Clients will return less than the requested range if not all blocks are available.
newestBlockStringREQUIRED. Highest block of the requested range.
rewardPercentilesNumber[]REQUIRED. A monotonically increasing list of percentile values. For each block in the requested range, the transactions will be sorted in ascending order by effective tip per gas and the coresponding effective tip for the percentile will be determined, accounting for gas consumed.

Returns

TypeDescription
FeeHistoryResultsFee history for the returned block range. This can be a subsection of the requested range if not all blocks are available.

eth_gasPrice

Gets the current price per gas in wei

Parameters

None

Returns

TypeDescription
StringInteger of the current gas price in wei.

eth_getCode

Gets code at a given contract address

Parameters

NameTypeDescription
addressStringREQUIRED. The address of the contract.
blockNumberStringA BlockNumber of which the code existed.

Returns

TypeDescription
StringThe code from the given address.

eth_getBalance

Gets Ether balance of a given or account or contract.

Parameters

NameTypeDescription
addressStringREQUIRED. The address of the account or contract.
blockNumberStringA BlockNumber at which to request the balance.

Returns

TypeDescription
String | NullInteger of the current balance in wei or null.

eth_getBlockByHash

Gets a block for a given hash.

Parameters

NameTypeDescription
blockHashStringREQUIRED. The hash of a block.
includeTransactionsBooleanREQUIRED. If true it returns the full transaction objects, if false only the hashes of the transactions.

Returns

TypeDescription
Block | NullThe block, or null when no block is found.

eth_getBlockByNumber

Gets a block for a given number.

Parameters

NameTypeDescription
blockNumberStringREQUIRED. The block number.
includeTransactionsBooleanREQUIRED. If true it returns the full transaction objects, if false only the hashes of the transactions.

Returns

TypeDescription
Block | NullThe block, or null when no block is found.

eth_getBlockTransactionCountByHash

Gets the number of transactions in a block from a block matching the given block hash.

Parameters

NameTypeDescription
blockHashStringREQUIRED. The hex representation of the Keccak 256 of the RLP encoded block.

Returns

TypeDescription
String | NullThe number of total transactions in the given block, or null.

eth_getBlockTransactionCountByNumber

Gets the number of transactions in a block from a block matching the given block number.

Parameters

NameTypeDescription
blockNumberStringREQUIRED. The block number.

Returns

TypeDescription
String | NullThe number of total transactions in the given block, or null.

eth_getLogs

Gets an array of all logs matching a given filter object. Block range must be less than 2,000 blocks.

Parameters

NameTypeDescription
filterFilterREQUIRED. A filter used to monitor the blockchain for log/events. Block range must be less than 2,000 blocks.

Returns

TypeDescription
Log[]An array of all logs matching filter with given id.

eth_getTransactionByBlockHashAndIndex

Gets the information about a transaction requested by the block hash and index of which it was mined.

Parameters

NameTypeDescription
blockHashStringREQUIRED. The hex representation of the Keccak 256 of the RLP encoded block.
indexStringREQUIRED. The ordering in which a transaction is mined within its block.

Returns

TypeDescription
Transaction | NullA transaction or null.

Examples

Null Example

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockHashAndIndex",
  "params": {
    "blockHashExample": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "indexExample": "0x0"
  }
}'
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockHashAndIndex",
  "params": {
    "blockHashExample": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "indexExample": "0x0"
  }
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": null
}

eth_getTransactionByBlockNumberAndIndex

Gets the information about a transaction requested by the block number and index of which it was mined.

Parameters

NameTypeDescription
blockNumberStringREQUIRED. The block number.
indexStringREQUIRED. The ordering in which a transaction is mined within its block.

Returns

TypeDescription
Transaction | NullA transaction or null.

eth_getTransactionByHash

Gets the information about a transaction requested by transaction hash.

Parameters

NameTypeDescription
transactionHashStringREQUIRED. Keccak 256 Hash of the RLP encoding of a transaction.

Returns

TypeDescription
Transaction | NullA transaction or null.

eth_getTransactionCount

Gets the number of transactions sent from an address.

Parameters

NameTypeDescription
addressStringREQUIRED. An address.
blockNumberStringREQUIRED. The block number.

Returns

TypeDescription
String | NullThe number of transactions send from the given address, or null.

eth_getTransactionReceipt

Gets the receipt information of a transaction by its hash.

Parameters

NameTypeDescription
transactionHashStringREQUIRED. Keccak 256 Hash of the RLP encoding of a transaction.

Returns

TypeDescription
Receipt | NullA receipt or null.

eth_getUncleByBlockHashAndIndex

Gets information about a uncle of a block by hash and uncle index position.

Parameters

NameTypeDescription
blockHashStringREQUIRED. The hex representation of the Keccak 256 of the RLP encoded block.
indexStringREQUIRED. The ordering in which a uncle is included within its block.

Returns

TypeDescription
Block | NullThe uncle block, or null when no block is found.

eth_getUncleByBlockNumberAndIndex

Gets information about a uncle of a block by hash and uncle index position.

Parameters

NameTypeDescription
uncleBlockNumberStringREQUIRED. The block in which the uncle was included.
indexStringREQUIRED. The ordering in which a uncle is included within its block.

Returns

TypeDescription
Block | NullThe uncle block, or null when no block is found.

Examples

Null Example

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getUncleByBlockNumberAndIndex",
  "params": {
    "uncleBlockNumberExample": "0x0",
    "uncleBlockNumberIndexExample": "0x0"
  }
}'
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getUncleByBlockNumberAndIndex",
  "params": {
    "uncleBlockNumberExample": "0x0",
    "uncleBlockNumberIndexExample": "0x0"
  }
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": null
}

eth_getUncleCountByBlockHash

Gets the number of uncles in a block from a block matching the given block hash.

Parameters

NameTypeDescription
blockHashStringREQUIRED. The hex representation of the Keccak 256 of the RLP encoded block.

Returns

TypeDescription
String | NullThe number of total uncles in the given block, or null.

eth_getUncleCountByBlockNumber

Gets the number of uncles in a block from a block matching the given block number.

Parameters

NameTypeDescription
blockNumberStringREQUIRED. The block number.

Returns

TypeDescription
String | NullThe Number of total uncles in the given block.

eth_protocolVersion

Gets the current Ethereum protocol version.

Parameters

None

Returns

TypeDescription
StringThe current Ethereum protocol version.

eth_sendRawTransaction

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

Parameters

NameTypeDescription
signedTransactionDataStringREQUIRED. The signed transaction data

Returns

TypeDescription
StringThe transaction hash, or the zero hash if the transaction is not yet available.

eth_syncing

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

Parameters

None

Returns

TypeDescription
SyncingData | BooleanAn object with sync status data, or false when not syncing.

Types

Transaction

Properties

NameTypeDescription
blockHashString | NullThe block hash or null when its the pending block.
blockNumberString | NullThe block number or null when its the pending block
fromStringThe origin address of the transaction.
gasStringREQUIRED. The gas limit provided by the sender in Wei.
gasPriceStringREQUIRED. The gas price willing to be paid by the sender in Wei.
hashStringKeccak 256 Hash of the RLP encoding of a transaction.
inputStringThe data field sent with the transaction.
nonceStringREQUIRED. The total number of prior transactions made by the sender.
toString | NullThe destination address of the transaction. null if it was a contract create.
transactionIndexString | NullThe index of the transaction. null when its pending.
valueStringValue of Ether being transferred in Wei.
vStringECDSA recovery id.
rStringECDSA signature r.
sStringECDSA signature s.

FeeHistoryResults

Properties

NameTypeDescription
oldestBlockStringLowest number block of returned range.
baseFeePerGasString[]REQUIRED. An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks.
rewardString[][]A two-dimensional array of effective priority fees per gas at the requested block percentiles.

Block

Properties

NameTypeDescription
numberString | NullThe block number or null when its the pending block.
hashString | NullThe block hash or null when its the pending block.
parentHashStringKeccak hash of the parent block.
nonceString | NullRandomly selected number to satisfy the proof-of-work or null when its the pending block
sha3UnclesStringKeccak hash of the uncles data in the block.
logsBloomStringThe bloom filter for the logs of the block or null when its the pending block.
transactionsRootStringThe root of the transactions trie of the block.
stateRootStringThe root of the final state trie of the block
receiptsRootStringThe root of the receipts trie of the block
minerString | NullThe address of the miner, or null.
difficultyStringInteger of the difficulty for this block.
totalDifficultyString | NullInteger of the total difficulty of the chain until this block, or null.
extraDataStringThe 'extra data' field of this block.
sizeStringInteger the size of this block in bytes.
gasLimitStringThe maximum gas allowed in this block.
gasUsedStringThe total used gas by all transactions in this block.
timestampStringThe unix timestamp for when the block was collated.
transactionsTransaction | String[]Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
unclesString[]Array of uncle hashes.

Filter

Properties

NameTypeDescription
fromBlockStringThe block number for the start block of the block range.
toBlockStringThe block number for the end block of the block range.
addressString | String[]An address or list of addresses.
topicsString[]Topics are order-dependent. Each topic can also be an array of DATA with 'or' options.

Log

Properties

NameTypeDescription
addressStringSender of the transaction.
blockHashStringThe hex representation of the Keccak 256 of the RLP encoded block.
blockNumberStringThe hex representation of the block's height.
dataStringThe data/input string sent along with the transaction.
logIndexStringThe index of the event within its transaction, null when its pending.
removedBooleanWhether or not the log was orphaned off the main chain.
topicsString[]Topics are order-dependent. Each topic can also be an array of DATA with 'or' options.
transactionHashStringKeccak 256 Hash of the RLP encoding of a transaction.
transactionIndexString | NullThe index of the transaction. null when its pending.

Receipt

Properties

NameTypeDescription
blockHashStringREQUIRED. The hex representation of the Keccak 256 of the RLP encoded block.
blockNumberStringREQUIRED. The hex representation of the block's height.
contractAddressString | NullREQUIRED. The contract address created, if the transaction was a contract creation, otherwise null.
cumulativeGasUsedStringREQUIRED. The gas units used by the transaction.
fromStringREQUIRED. The sender of the transaction.
gasUsedStringREQUIRED. The total gas used by the transaction.
logsLog[]REQUIRED. An array of all the logs triggered during the transaction.
logsBloomStringREQUIRED. A 2048 bit bloom filter from the logs of the transaction. Each log sets 3 bits though taking the low-order 11 bits of each of the first three pairs of bytes in a Keccak 256 hash of the log's byte series
toString | NullREQUIRED. Destination address of the transaction. Null if it was a contract create.
transactionHashStringREQUIRED. Keccak 256 Hash of the RLP encoding of a transaction.
transactionIndexString | NullREQUIRED. The index of the transaction. null when its pending.
postTransactionStateStringThe intermediate stateRoot directly after transaction execution.
statusBooleanWhether or not the transaction threw an error.

SyncingData

Properties

NameTypeDescription
startingBlockStringBlock at which the import started (will only be reset, after the sync reached his head).
currentBlockStringThe current block, same as eth_blockNumber.
highestBlockStringThe estimated highest block.
knownStatesStringThe known states.
pulledStatesStringThe pulled states.