GOAT
GOAT API is available on Web3 API platform (opens in a new tab).
GOAT Network is a Layer 2 blockchain solution designed to enhance Bitcoin's scalability, transaction speed, and functionality. By operating atop Bitcoin's primary blockchain (Layer 1), it aims to transform Bitcoin from a passive asset into an active participant in decentralized finance (DeFi), enabling users to earn sustainable yields on their BTC holdings.
In order for your Web3 application to interact with GOAT — either by reading blockchain data or sending transactions to the network — it must connect to a GOAT node. Developers interact with the blockchain using the methods provided by the API.
The API interaction follows the JSON-RPC (opens in a new tab) which is a stateless, light-weight remote procedure call (RPC) protocol. It defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in other message-passing environments. It uses JSON (RFC 4627) as data format.
Methods supported
web3_clientVersion
— returns the current client version.web3_sha3
— returns Keccak-256 (not the standardized SHA3-256) of the given data.net_version
— returns the current network ID.net_listening
— returns true if client is actively listening for network connections.eth_syncing
— returns data on the sync status or false.eth_gasPrice
— returns the current price per gas in wei.eth_accounts
— returns a list of addresses owned by client.eth_blockNumber
— returns the number of most recent block.eth_getBalance
— returns the balance of the account specified by address.eth_getStorageAt
— returns the value from a storage position at an address specified.eth_getTransactionCount
— returns the number of transactions sent from an address.eth_getBlockTransactionCountByHash
— returns the number of transactions in a block specified by block hash.eth_getBlockTransactionCountByNumber
— returns the number of transactions in the block specified by number.eth_getUncleCountByBlockHash
— returns the number of uncles in a block specified by block hash.eth_getUncleCountByBlockNumber
— returns the number of uncles in a block specified by block number.eth_getCode
— returns code at an address specified.eth_sendRawTransaction
— creates a new message call transaction or a contract creation for signed transactions.eth_call
— executes a new message call immediately without creating a transaction on the blockchain.eth_estimateGas
— generates and returns an estimate of how much gas is necessary to allow the transaction to complete.eth_getBlockByHash
— returns information for the block specified by block hash.eth_getBlockByNumber
— returns information for the block specified by block number.eth_getTransactionByHash
— returns information on a transaction specified by transaction hash.eth_getTransactionByBlockHashAndIndex
— returns information on a transaction specified by block hash and transaction index position.eth_getTransactionByBlockNumberAndIndex
— returns information on a transaction by block number and transaction index position.eth_getTransactionReceipt
— returns the receipt of a transaction by transaction hash.eth_getUncleByBlockHashAndIndex
— returns information about an uncle of a block by hash and uncle index position.eth_getUncleByBlockNumberAndIndex
— returns information about an uncle of a block by number and uncle index position.eth_getLogs
— returns logs matching the parameters specified.
web3_clientVersion
Returns the current client version.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): none.
Returns
<string>
: the current client version.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "web3_clientVersion",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "Geth/v1.14.12-stable/linux-amd64/go1.23.3",
"id": 1
}
web3_sha3
Returns Keccak-256 (not the standardized SHA3-256) of the given data.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data): the data to convert into a SHA3 hash.
Returns
<string>
(data): the SHA3 result of the given string.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": ["0x68656c6c6f20776f726c64"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"
}
net_version
Returns the current network ID.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): none.
Returns
<string>
: the current network ID.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "48816"
}
net_listening
Returns
true
if client is actively listening for network connections.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): none.
Returns
<boolean>
:true
when listening, otherwisefalse
.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "net_listening",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
eth_syncing
Returns an object with data about the sync status or false.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): none.
Returns
<object>
|<boolean>
: an object with sync status data orfalse
, when not syncing:startingBlock
(quantity): the block at which the import started (will only be reset, after the sync reached its head).currentBlock
(quantity): the current block, same aseth_blockNumber
.highestBlock
(quantity): the estimated highest block.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_syncing",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": false
}
eth_gasPrice
Returns the current price per gas in wei.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): none.
Returns
<string>
(quantity): the current gas price in wei.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x186a7"
}
eth_accounts
Returns a list of addresses owned by client.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): none.
Returns
<array>
(string; data, 20 bytes): addresses owned by the client.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_accounts",
"params": [],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": []
}
eth_blockNumber
Returns the number of most recent block.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): none.
Returns
<string>
(quantity): the current block number the client is on.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x7e407"
}
eth_getBalance
Returns the balance of the account specified by address.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 20 bytes): an address to check for balance.<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
Returns
<string>
(quantity): the current balance in wei.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x2Cd8DF8a2eDfe83cD2ba6064D23B47736B79fC85", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5af3107a4000"
}
eth_getStorageAt
Returns the value from a storage position at an address specified.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):-
<string>
(data, 20 bytes): an address of the storage (hex encoded). -
<string>
(quantity): a slot position in the storage (hex encoded unsigned integer). -
<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(data): the value at this storage position.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getStorageAt",
"params": ["0x2Cd8DF8a2eDfe83cD2ba6064D23B47736B79fC85", "0x0", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
eth_getTransactionCount
Returns the number of transactions sent from an address.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):-
<string>
(data, 20 bytes): an address. -
<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(quantity): the number of transactions send from this address.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": ["0x2Cd8DF8a2eDfe83cD2ba6064D23B47736B79fC85", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0"
}
eth_getBlockTransactionCountByHash
Returns the number of transactions in a block specified by block hash.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): a block hash.
Returns
<string>
(quantity): the number of transactions in this block.
Request example:
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": ["0x0a803103e3d8add36912289278ee282dc917c968d3becd61af0766086cf62584"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1"
}
eth_getBlockTransactionCountByNumber
Returns the number of transactions in the block specified by number.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
Returns
<string>
(quantity): the number of transactions in this block.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": ["0x7DEB6"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1"
}
eth_getUncleCountByBlockHash
Returns the number of uncles in a block specified by block hash.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): a block hash.
Returns
<string>
(quantity): the number of uncles in this block.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleCountByBlockHash",
"params": ["0x0a803103e3d8add36912289278ee282dc917c968d3becd61af0766086cf62584"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0"
}
eth_getUncleCountByBlockNumber
Returns the number of uncles in a block specified by block number.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
Returns
<string>
(quantity): the number of uncles in this block.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleCountByBlockNumber",
"params": ["latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0"
}
eth_getCode
Returns code at a given address.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 20 bytes): an address to get the code from.<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
Returns
<string>
(data): the code from the given address.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": ["0x2Cd8DF8a2eDfe83cD2ba6064D23B47736B79fC85", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x"
}
eth_sendRawTransaction
Creates new message call transaction or a contract creation for signed transactions.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data): the signed transaction data.
Returns
<string>
(data, 32 bytes): the transaction hash, or the zero hash if the transaction is not yet available.
Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["hex_signed_transaction"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}
eth_call
Executes a new message call immediately without creating a transaction on the blockchain.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):-
<object>
(hex encoded): the transaction object:from
(string; data, 20 bytes; optional): the address the transaction is sent from.to
(string; data, 20 bytes): the address the transaction is directed to.gas
(string; quantity; optional): the gas provided for the transaction execution.eth_call
consumes zero gas, but this parameter may be needed by some executions.gasPrice
(string; quantity; optional): the gas price willing to be paid by the sender in wei.value
(string; quantity; optional): the value sent with this transaction, in wei.data
(string; data; optional): the hash of the method signature and encoded parameters.
-
<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(hex encoded bytes): the return value of executed contract.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0x2Cd8DF8a2eDfe83cD2ba6064D23B47736B79fC85",
"data": "0x70a082310000000000000000000000005a93a3f8c5e3eae603b36e3e0805a2e2290b1e82"
},
"latest"
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x"
}
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
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):-
<object>
(hex encoded): the transaction object:from
(string; data, 20 bytes; optional): the address the transaction is sent from.to
(string; data, 20 bytes; optional): the address the transaction is directed to.gas
(string; quantity; optional): the gas provided for the transaction execution.eth_call
consumes zero gas, but this parameter may be needed by some executions.gasPrice
(string; quantity; optional): the gas price willing to be paid by the sender in wei.value
(string; quantity; optional): the value sent with this transaction, in wei.data
(string; data; optional): the hash of the method signature and encoded parameters.
-
<string>
(quantity|tag; optional): either a HEX value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(quantity): the amount of gas used.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0xa482AE7d753b33cB06Fd6872443E902cB6BEe592",
"data": "0x70a082310000000000000000000000005a93a3f8c5e3eae603b36e3e0805a2e2290b1e82"
},
"latest"
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x"
}
eth_getBlockByHash
Returns information for the block specified by block hash.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): the block hash.<boolean>
: iftrue
it returns the full transaction objects, iffalse
— only the hashes of the transactions.
Returns
<object>
: a block object, or null when no block was found:number
(string; quantity): the block number; null when it's a pending block.hash
(string; data, 32 bytes): the hash of the block; null when it's a pending block.parentHash
(string; data, 32 bytes): the hash of the parent block.nonce
(string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.sha3Uncles
(string; data, 32 bytes): SHA3 of the uncles data in the block.logsBloom
(string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.transactionsRoot
(string; data, 32 bytes): the root of the transaction trie of the block.stateRoot
(string; data, 32 bytes): the root of the final state trie of the block.receiptsRoot
(string; data, 32 bytes): the root of the receipts trie of the block.miner
(string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.difficulty
(string; quantity): the difficulty for this block.totalDifficulty
(string; quantity): the total difficulty of the chain until this block.extraData
(string; data): the extra data field of this block.size
(string; quantity): the size of this block in bytes.gasLimit
(string; quantity): the maximum gas allowed in this block.gasUsed
(string; quantity): the total used gas by all transactions in this block.timestamp
(string; quantity): the unix timestamp for when the block was collated.transactions
(array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.uncles
(array of strings): an array of uncle hashes.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": ["0x0a803103e3d8add36912289278ee282dc917c968d3becd61af0766086cf62584", false],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"baseFeePerGas": "0x7",
"blobGasUsed": "0x0",
"difficulty": "0x0",
"excessBlobGas": "0x0",
"extraData": "0x0056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"gasLimit": "0x1c9c380",
"gasUsed": "0x5208",
"hash": "0x0a803103e3d8add36912289278ee282dc917c968d3becd61af0766086cf62584",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x9f5a293be75cab701cd199a4fa97cb12703b1d03",
"mixHash": "0x0785fc01df0072f88a1724ed15856f19aa6cf37b912a601ab700ec796accb81c",
"nonce": "0x0000000000000000",
"number": "0x7deb6",
"parentBeaconBlockRoot": "0x98f3080c4d6bd9925ba72d2413b5d8840a23f0c22b30e47fe542644989591530",
"parentHash": "0xf29453dcfd3d98cf6548ce1821b5297ef22b5b2d4695c3258b468689a2c4f2f4",
"receiptsRoot": "0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa",
"requestsRoot": "0xb1bd483066a9383baa74eec48520e0cf0fb5f58d4316b73a241c354ce0ba5baf",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x303",
"stateRoot": "0x253d9143a55292d4e843fc11ef7aa09864d802594edbf7e7f6458e59af6d64f7",
"timestamp": "0x67502b08",
"transactions": [
"0xddadd048ee141619897211ad394dedf0753504f11330373f7818d80b054088ef"
],
"transactionsRoot": "0xb59e9656cc8d2a102ba01842521f6ed8f3807f8f8784e65547a862639f1c6e12",
"uncles": [],
"withdrawals": [],
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}
}
eth_getBlockByNumber
Returns information for the block specified by block number.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
<boolean>
: iftrue
it returns the full transaction objects, iffalse
— only the hashes of the transactions.
Returns
<object>
: a block object, or null when no block was found:number
(string; quantity): the block number; null when it's a pending block.hash
(string; data, 32 bytes): the hash of the block; null when it's a pending block.parentHash
(string; data, 32 bytes): the hash of the parent block.nonce
(string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.sha3Uncles
(string; data, 32 bytes): SHA3 of the uncles data in the block.logsBloom
(string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.transactionsRoot
(string; data, 32 bytes): the root of the transaction trie of the block.stateRoot
(string; data, 32 bytes): the root of the final state trie of the block.receiptsRoot
(string; data, 32 bytes): the root of the receipts trie of the block.miner
(string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.difficulty
(string; quantity): the difficulty for this block.totalDifficulty
(string; quantity): the total difficulty of the chain until this block.extraData
(string; data): the extra data field of this block.size
(string; quantity): the size of this block in bytes.gasLimit
(string; quantity): the maximum gas allowed in this block.gasUsed
(string; quantity): the total used gas by all transactions in this block.timestamp
(string; quantity): the unix timestamp for when the block was collated.transactions
(array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.uncles
(array of strings): an array of uncle hashes.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": ["latest", true],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"baseFeePerGas": "0x7",
"blobGasUsed": "0x0",
"difficulty": "0x0",
"excessBlobGas": "0x0",
"extraData": "0x0056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"gasLimit": "0x1c9c380",
"gasUsed": "0x0",
"hash": "0xd024a69d8502e84f5049e3e8268439c81ff8f506fe0c4df340b744bf90c571e7",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x5d88d68542f262d52463e962781bc5758fdcde06",
"mixHash": "0x6b9655291de8feeb510f74791b48adb97dff0759a1be15b6d6d1b8cfbfc4058b",
"nonce": "0x0000000000000000",
"number": "0x7e4e5",
"parentBeaconBlockRoot": "0x38fabd58ebb680a399d311b16c492f4dd42e115f703fbd39d3149a630e7db0fb",
"parentHash": "0xa01ed04a156ddf5a6c5798b5e7f6641a8e6ee791494515bca99e7c54f80c74c6",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"requestsRoot": "0xabc149717b3f8f2c6c8a6942c768f9f3635d5c2c9b838bf099849b6bcd7cf0b7",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x288",
"stateRoot": "0x253d9143a55292d4e843fc11ef7aa09864d802594edbf7e7f6458e59af6d64f7",
"timestamp": "0x675040c5",
"transactions": [],
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncles": [],
"withdrawals": [],
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}
}
eth_getTransactionByHash
Returns information on a transaction specified by transaction hash.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): a transaction hash.
Returns
blockHash
(string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.blockNumber
(string; quantity): a number of the block containing the transaction; null when it's pending.from
(string; data, 20 bytes): an address of the sender.gas
(string; quantity): the gas provided by the sender.gasPrice
(string; quantity): the gas price provided by the sender in wei.hash
(string; data, 32 bytes): the hash of the transaction.input
(string; data): the data send along with the transaction.nonce
(string; quantity): the number of transactions made by the sender prior to this one.to
(string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.transactionIndex
(string; quantity): the transaction index position in the block; null when it's pending.value
(string; quantity): the value transferred in wei.v
(string; quantity): ECDSA recovery ID.r
(string; quantity): ECDSA signature r.s
(string; quantity): ECDSA signature s.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": ["0xddadd048ee141619897211ad394dedf0753504f11330373f7818d80b054088ef"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0x0a803103e3d8add36912289278ee282dc917c968d3becd61af0766086cf62584",
"blockNumber": "0x7deb6",
"from": "0xa482ae7d753b33cb06fd6872443e902cb6bee592",
"gas": "0x5208",
"gasPrice": "0x77359407",
"maxFeePerGas": "0x174876e800",
"maxPriorityFeePerGas": "0x77359400",
"hash": "0xddadd048ee141619897211ad394dedf0753504f11330373f7818d80b054088ef",
"input": "0x",
"nonce": "0x16",
"to": "0x2cd8df8a2edfe83cd2ba6064d23b47736b79fc85",
"transactionIndex": "0x0",
"value": "0x5af3107a4000",
"type": "0x2",
"accessList": [],
"chainId": "0xbeb0",
"v": "0x1",
"r": "0x99934731a218345edb7a28088378b7345816133cc3c8eadffbd3e548ba401d4b",
"s": "0x4639bdb8564a7a0f945f00172711470f31f5cce3206413273b7e87aa328b0bc3",
"yParity": "0x1"
}
}
eth_getTransactionByBlockHashAndIndex
Returns information on a transaction specified by block hash and transaction index position.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): a block hash.<string>
(quantity): a transaction index position.
Returns
blockHash
(string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.blockNumber
(string; quantity): a number of the block containing the transaction; null when it's pending.from
(string; data, 20 bytes): an address of the sender.gas
(string; quantity): the gas provided by the sender.gasPrice
(string; quantity): the gas price provided by the sender in wei.hash
(string; data, 32 bytes): the hash of the transaction.input
(string; data): the data send along with the transaction.nonce
(string; quantity): the number of transactions made by the sender prior to this one.to
(string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.transactionIndex
(string; quantity): the transaction index position in the block; null when it's pending.value
(string; quantity): the value transferred in wei.v
(string; quantity): ECDSA recovery ID.r
(string; quantity): ECDSA signature r.s
(string; quantity): ECDSA signature s.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": ["0x0a803103e3d8add36912289278ee282dc917c968d3becd61af0766086cf62584", "0x0"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0x0a803103e3d8add36912289278ee282dc917c968d3becd61af0766086cf62584",
"blockNumber": "0x7deb6",
"from": "0xa482ae7d753b33cb06fd6872443e902cb6bee592",
"gas": "0x5208",
"gasPrice": "0x77359407",
"maxFeePerGas": "0x174876e800",
"maxPriorityFeePerGas": "0x77359400",
"hash": "0xddadd048ee141619897211ad394dedf0753504f11330373f7818d80b054088ef",
"input": "0x",
"nonce": "0x16",
"to": "0x2cd8df8a2edfe83cd2ba6064d23b47736b79fc85",
"transactionIndex": "0x0",
"value": "0x5af3107a4000",
"type": "0x2",
"accessList": [],
"chainId": "0xbeb0",
"v": "0x1",
"r": "0x99934731a218345edb7a28088378b7345816133cc3c8eadffbd3e548ba401d4b",
"s": "0x4639bdb8564a7a0f945f00172711470f31f5cce3206413273b7e87aa328b0bc3",
"yParity": "0x1"
}
}
eth_getTransactionByBlockNumberAndIndex
Returns information on a transaction by block number and transaction index position.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
<string>
(quantity): the transaction index position.
Returns
blockHash
(string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.blockNumber
(string; quantity): a number of the block containing the transaction; null when it's pending.from
(string; data, 20 bytes): an address of the sender.gas
(string; quantity): the gas provided by the sender.gasPrice
(string; quantity): the gas price provided by the sender in wei.hash
(string; data, 32 bytes): the hash of the transaction.input
(string; data): the data send along with the transaction.nonce
(string; quantity): the number of transactions made by the sender prior to this one.to
(string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.transactionIndex
(string; quantity): the transaction index position in the block; null when it's pending.value
(string; quantity): the value transferred in wei.v
(string; quantity): ECDSA recovery ID.r
(string; quantity): ECDSA signature r.s
(string; quantity): ECDSA signature s.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": ["0x7DEB6", "0x0"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0x0a803103e3d8add36912289278ee282dc917c968d3becd61af0766086cf62584",
"blockNumber": "0x7deb6",
"from": "0xa482ae7d753b33cb06fd6872443e902cb6bee592",
"gas": "0x5208",
"gasPrice": "0x77359407",
"maxFeePerGas": "0x174876e800",
"maxPriorityFeePerGas": "0x77359400",
"hash": "0xddadd048ee141619897211ad394dedf0753504f11330373f7818d80b054088ef",
"input": "0x",
"nonce": "0x16",
"to": "0x2cd8df8a2edfe83cd2ba6064d23b47736b79fc85",
"transactionIndex": "0x0",
"value": "0x5af3107a4000",
"type": "0x2",
"accessList": [],
"chainId": "0xbeb0",
"v": "0x1",
"r": "0x99934731a218345edb7a28088378b7345816133cc3c8eadffbd3e548ba401d4b",
"s": "0x4639bdb8564a7a0f945f00172711470f31f5cce3206413273b7e87aa328b0bc3",
"yParity": "0x1"
}
}
eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash.
The receipt is not available for pending transactions.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): a hash of the transaction.
Returns
-
object
: a transaction receipt object, or null when no receipt was found:-
transactionHash
(string; data, 32 bytes): a hash of the transaction. -
transactionIndex
(string; quantity): the transactions index position in the block. -
blockHash
(string; data, 32 bytes): a hash of the block containing the transaction. -
blockNumber
(string; quantity): a number of the block containing the transaction. -
from
(string; data, 20 bytes): an address of the sender. -
to
(string; data, 20 bytes): an address of the receiver; null when it's a contract creation transaction. -
cumulativeGasUsed
(string; quantity): the total amount of gas used when this transaction was executed in the block. -
effectiveGasPrice
(string; quantity): the sum of the base fee and tip paid per unit of gas. -
gasUsed
(string; quantity): the amount of gas used by this specific transaction alone. -
contractAddress
(string; data, 20 bytes): the contract address created, if the transaction was a contract creation, otherwise null. -
logs
(array): an array of log objects, which this transaction generated. -
logsBloom
(string; data, 256 bytes): a bloom filter for light clients to quickly retrieve related logs. -
type
(string; data): the transaction type,0x00
for legacy transactions,0x01
for access list types,0x02
for dynamic fees. It also returns either of the following:root
(string; data, 32 bytes): a post-transaction stateroot (pre Byzantium).status
(string; quantity): either 1 (success) or 0 (failure).
-
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0xddadd048ee141619897211ad394dedf0753504f11330373f7818d80b054088ef"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0x0a803103e3d8add36912289278ee282dc917c968d3becd61af0766086cf62584",
"blockNumber": "0x7deb6",
"contractAddress": null,
"cumulativeGasUsed": "0x5208",
"effectiveGasPrice": "0x77359407",
"from": "0xa482ae7d753b33cb06fd6872443e902cb6bee592",
"gasUsed": "0x5208",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0x2cd8df8a2edfe83cd2ba6064d23b47736b79fc85",
"transactionHash": "0xddadd048ee141619897211ad394dedf0753504f11330373f7818d80b054088ef",
"transactionIndex": "0x0",
"type": "0x2"
}
}
eth_getUncleByBlockHashAndIndex
Returns information about an uncle of a block by hash and uncle index position.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): the hash of a block.<string>
(quantity): the uncle's index position.
Returns
<object>
: a block object, or null when no block was found:number
(string; quantity): the block number; null when it's a pending block.hash
(string; data, 32 bytes): the hash of the block; null when it's a pending block.parentHash
(string; data, 32 bytes): the hash of the parent block.nonce
(string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.sha3Uncles
(string; data, 32 bytes): SHA3 of the uncles data in the block.logsBloom
(string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.transactionsRoot
(string; data, 32 bytes): the root of the transaction trie of the block.stateRoot
(string; data, 32 bytes): the root of the final state trie of the block.receiptsRoot
(string; data, 32 bytes): the root of the receipts trie of the block.miner
(string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.difficulty
(string; quantity): the difficulty for this block.totalDifficulty
(string; quantity): the total difficulty of the chain until this block.extraData
(string; data): the extra data field of this block.size
(string; quantity): the size of this block in bytes.gasLimit
(string; quantity): the maximum gas allowed in this block.gasUsed
(string; quantity): the total used gas by all transactions in this block.timestamp
(string; quantity): the unix timestamp for when the block was collated.transactions
(array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.uncles
(array of strings): an array of uncle hashes.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockHashAndIndex",
"params": ["0x7e7e37b5a654e07548d54c2f8c28796b901a1202cf7979758e6b249f34d4dbbf", "0x0"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": null
}
eth_getUncleByBlockNumberAndIndex
Returns information about an uncle of a block by number and uncle index position.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
<string>
(quantity): the uncle's index position.
Returns
<object>
: a block object, or null when no block was found:number
(string; quantity): the block number; null when it's a pending block.hash
(string; data, 32 bytes): the hash of the block; null when it's a pending block.parentHash
(string; data, 32 bytes): the hash of the parent block.nonce
(string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.sha3Uncles
(string; data, 32 bytes): SHA3 of the uncles data in the block.logsBloom
(string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.transactionsRoot
(string; data, 32 bytes): the root of the transaction trie of the block.stateRoot
(string; data, 32 bytes): the root of the final state trie of the block.receiptsRoot
(string; data, 32 bytes): the root of the receipts trie of the block.miner
(string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.difficulty
(string; quantity): the difficulty for this block.totalDifficulty
(string; quantity): the total difficulty of the chain until this block.extraData
(string; data): the extra data field of this block.size
(string; quantity): the size of this block in bytes.gasLimit
(string; quantity): the maximum gas allowed in this block.gasUsed
(string; quantity): the total used gas by all transactions in this block.timestamp
(string; quantity): the unix timestamp for when the block was collated.transactions
(array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.uncles
(array of strings): an array of uncle hashes.
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockNumberAndIndex",
"params": ["latest", "0x0"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": null
}
eth_getLogs
Returns an array of all logs matching a given filter object.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):-
object
: the filter options:-
fromBlock
(string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:latest
: for the last mined block.earliest
: for the lowest numbered block available on the client.pending
: for not yet mined transactions.
-
toBlock
(string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:latest
: for the last mined block.earliest
: for the lowest numbered block available on the client.pending
: for not yet mined transactions.
-
address
(array of strings; data, 20 bytes; optional): a contract address or a list of addresses from which logs should originate. -
topics
(array of strings; data; optional): an array of 32 bytes data topics. Topics are order-dependent. Each topic can also be an array of data with "or" options. -
blockhash
(string; data, 32 bytes; optional; future): with the addition of EIP-234,blockHash
will be a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent tofromBlock = toBlock = the block
number with hash blockHash. IfblockHash
is present in the filter criteria, then neitherfromBlock
nortoBlock
are allowed.
-
-
Returns
removed
(string; tag):true
when the log was removed, due to a chain reorganization;false
if it's a valid log.logIndex
(string; quantity): the log index position in the block; null when it's a pending log.transactionIndex
(string; quantity): the transactions index position log was created from; null when it's a pending log.transactionHash
(string; data, 32 bytes): a hash of the transactions this log was created from; null when it's a pending log.blockHash
(string; data, 32 bytes): a hash of the block containing the log; null when it's pending; null when it's a pending log.blockNumber
(string; quantity): the number of the block containing the log; null when it's pending; null when it's a pending log.address
(string; data, 20 bytes): an address from which this log originated.data
(string; data): contains one or more 32 bytes non-indexed arguments of the log.topics
(array of strings; data): an array of 0 to 4 32 bytes data of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
Request example
curl -X POST https://rpc.ankr.com/goat_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x1",
"toBlock": "latest",
"address": "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
}
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": []
}