Swell
Swell API is available on Web3 API platform (opens in a new tab).
Swell is a non-custodial staking protocol with a mission to deliver the world’s best liquid staking and restaking experience, simplify access to DeFi, while securing the future of Ethereum and restaking services.
With Swell, users are able to earn passive income by staking or restaking ETH to earn both blockchain rewards and restaked AVS rewards, and in return be provided with a yield-bearing liquid token (LST or LRT) to hold or participate in the wider DeFi ecosystem to earn additional yield.
In order for your Web3 application to interact with Swell — either by reading blockchain data or sending transactions to the network — it must connect to a Swell 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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "web3_clientVersion",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "Geth/v1.101411.0-stable-d5a96613/linux-amd64/go1.23.2",
"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/swell \
-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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "1923"
}
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/swell \
-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/swell \
-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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xf433b"
}
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/swell \
-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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x35e0e"
}
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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x4200000000000000000000000000000000000015", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0"
}
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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getStorageAt",
"params": ["0x4200000000000000000000000000000000000015", "0x0", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000674d96e30000000001453ba2"
}
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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": ["0x4200000000000000000000000000000000000015", "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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": ["0x1482b3da285d0460baae28e5c104946f375fd6383f5a8c56e3f234da8130463a"],
"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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": ["0x35E83"],
"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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleCountByBlockHash",
"params": ["0x1482b3da285d0460baae28e5c104946f375fd6383f5a8c56e3f234da8130463a"],
"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/swell \
-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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": ["0x4200000000000000000000000000000000000015", "latest"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100be5780638f283970146100f8578063f851a440146101185761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61012d565b005b6..."
}
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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],
"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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0x1234567890abcdef1234567890abcdef12345678",
"data": "0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcd"
},
"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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"to": "0x1234567890abcdef1234567890abcdef12345678",
"data": "0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcd",
"value": "0x0"
}
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x542e"
}
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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": ["0x769826b11c626e76e7a0ec7a3291a84ae1aedad7cd3c15f77457883c037b3586", false],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"baseFeePerGas": "0xfb",
"blobGasUsed": "0x0",
"difficulty": "0x0",
"excessBlobGas": "0x0",
"extraData": "0x",
"gasLimit": "0x3938700",
"gasUsed": "0xabae",
"hash": "0x769826b11c626e76e7a0ec7a3291a84ae1aedad7cd3c15f77457883c037b3586",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x4200000000000000000000000000000000000011",
"mixHash": "0x9e9afe7303914b5bc097077e2be0857eab4216b64e6352f251125496749035df",
"nonce": "0x0000000000000000",
"number": "0x35f23",
"parentBeaconBlockRoot": "0x7b06539c54dbd61653356c4d6c08fb3607d0449e98b72ff89d76b160f27f591c",
"parentHash": "0xf10fa814903d0ef7228bfbcdccc96b0d525a86572ee8e6b2a38828cfed1f5c18",
"receiptsRoot": "0x6d924b9af9cfeceb2e50af1eba38429fe3b70dc2760a40f0f5c394edca8bd9e2",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x347",
"stateRoot": "0x634f29146c0fa964f512dc8f758dad1465f4897fee65f441e8c845b2ecedd2ae",
"timestamp": "0x674d98c5",
"transactions": [
"0xde6075fc8e8ce8bde41e8912de54be564e4cce7aec4cda4a985a10b4fb5f975c"
],
"transactionsRoot": "0xa4e1a0b5ab0573b3b7225bb8048b36586710707f7071b5538ae3478774bdaee4",
"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/swell \
-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": "0xfb",
"blobGasUsed": "0x0",
"difficulty": "0x0",
"excessBlobGas": "0x0",
"extraData": "0x",
"gasLimit": "0x3938700",
"gasUsed": "0xaba2",
"hash": "0x2b20a26bb658529221dfb50ebffe41b2b1f4ff39f05edf539cac01783cc20d5f",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x4200000000000000000000000000000000000011",
"mixHash": "0xb3e0c9c39af6f6dfe601cd9b8572cd0e35938a36829e2fad16693afb24ac8fe4",
"nonce": "0x0000000000000000",
"number": "0x36153",
"parentBeaconBlockRoot": "0x74b8d4358ebe4ec4ff1b2f55955b4fa49df3416561f9a1f7d18a4188bfb98a46",
"parentHash": "0x6da3ab14e60e6b7a6877fb4ce9c280f246d0362d7b9fcf4d90d84b315eb34340",
"receiptsRoot": "0xeb7140663802eceb3b94ca80013b126215cbadda40021996755ea8a3161bb34d",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x347",
"stateRoot": "0x3de5e46eb5d377cc5728d079cbc3139f8496d371e6575810dd0cc13dbba2778b",
"timestamp": "0x674d9d25",
"transactions": [
{
"blockHash": "0x2b20a26bb658529221dfb50ebffe41b2b1f4ff39f05edf539cac01783cc20d5f",
"blockNumber": "0x36153",
"from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
"gas": "0xf4240",
"gasPrice": "0x0",
"hash": "0x78470f5ee366204f270ea885a75766bb2052b63ac85a25cd5b877e7860d465d0",
"input": "0x440a5e2000000558000c5fc5000000000000000300000000674d9c5f0000000001453c150000000000000000000000000000000000000000000000000000000278f1173200000000000000000000000000000000000000000000000000000002325f0a24d25206ae1e32bf7993f8ade201b44bddb9543cca013e9deaaba9562a6d3dae00000000000000000000000000f854cd5b26bfd73d51236c0122798907ed65b1f2",
"nonce": "0x36152",
"to": "0x4200000000000000000000000000000000000015",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x7e",
"v": "0x0",
"r": "0x0",
"s": "0x0",
"sourceHash": "0xbdae1a568841db7c8938d4c3bacb6a9e5065caf68c889d0d0831531b0d50f9b4",
"mint": "0x0",
"depositReceiptVersion": "0x1"
}
],
"transactionsRoot": "0xf09a2a740879a46d38a610333ec9f7d32ad4aa6c62b04bb8bd7300a2669765e7",
"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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": ["0xde6075fc8e8ce8bde41e8912de54be564e4cce7aec4cda4a985a10b4fb5f975c"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0x769826b11c626e76e7a0ec7a3291a84ae1aedad7cd3c15f77457883c037b3586",
"blockNumber": "0x35f23",
"from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
"gas": "0xf4240",
"gasPrice": "0x0",
"hash": "0xde6075fc8e8ce8bde41e8912de54be564e4cce7aec4cda4a985a10b4fb5f975c",
"input": "0x440a5e2000000558000c5fc5000000000000000100000000674d98030000000001453bba00000000000000000000000000000000000000000000000000000003ef584454000000000000000000000000000000000000000000000000000000018af8a63999c6722a30f5a0cdd7622716d9d815c1dbac2983a989b8f8538de98f0b496676000000000000000000000000f854cd5b26bfd73d51236c0122798907ed65b1f2",
"nonce": "0x35f22",
"to": "0x4200000000000000000000000000000000000015",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x7e",
"v": "0x0",
"r": "0x0",
"s": "0x0",
"sourceHash": "0x57913ce50e6f4dca31cf61369737e6d13271fc8d50fdf74e542437a16e1b8883",
"mint": "0x0",
"depositReceiptVersion": "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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": ["0x769826b11c626e76e7a0ec7a3291a84ae1aedad7cd3c15f77457883c037b3586", "0x0"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0x769826b11c626e76e7a0ec7a3291a84ae1aedad7cd3c15f77457883c037b3586",
"blockNumber": "0x35f23",
"from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
"gas": "0xf4240",
"gasPrice": "0x0",
"hash": "0xde6075fc8e8ce8bde41e8912de54be564e4cce7aec4cda4a985a10b4fb5f975c",
"input": "0x440a5e2000000558000c5fc5000000000000000100000000674d98030000000001453bba00000000000000000000000000000000000000000000000000000003ef584454000000000000000000000000000000000000000000000000000000018af8a63999c6722a30f5a0cdd7622716d9d815c1dbac2983a989b8f8538de98f0b496676000000000000000000000000f854cd5b26bfd73d51236c0122798907ed65b1f2",
"nonce": "0x35f22",
"to": "0x4200000000000000000000000000000000000015",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x7e",
"v": "0x0",
"r": "0x0",
"s": "0x0",
"sourceHash": "0x57913ce50e6f4dca31cf61369737e6d13271fc8d50fdf74e542437a16e1b8883",
"mint": "0x0",
"depositReceiptVersion": "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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": ["latest", "0x0"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0x1b5eef1c675007f8939b68524bc6f38eb010cd2c695bdf89c1fdd72eeb0aa9c8",
"blockNumber": "0x361ab",
"from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
"gas": "0xf4240",
"gasPrice": "0x0",
"hash": "0xbbb818ceb584ce7b62b7a6c3b5d2ada60c0b49882cf5da282d87ec88fc5c0ec9",
"input": "0x440a5e2000000558000c5fc5000000000000000000000000674d9d130000000001453c24000000000000000000000000000000000000000000000000000000025de66ed500000000000000000000000000000000000000000000000000000001f3e2b33dbe5e0a51b94dcd58e0451944be920baaf602c5f2ae01e88f57d08253d9a85895000000000000000000000000f854cd5b26bfd73d51236c0122798907ed65b1f2",
"nonce": "0x361aa",
"to": "0x4200000000000000000000000000000000000015",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x7e",
"v": "0x0",
"r": "0x0",
"s": "0x0",
"sourceHash": "0x755da4065a732fd8cbf1599b00795c7ec8028bc8e2809fbcf7cee129db81da75",
"mint": "0x0",
"depositReceiptVersion": "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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0xde6075fc8e8ce8bde41e8912de54be564e4cce7aec4cda4a985a10b4fb5f975c"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0x769826b11c626e76e7a0ec7a3291a84ae1aedad7cd3c15f77457883c037b3586",
"blockNumber": "0x35f23",
"contractAddress": null,
"cumulativeGasUsed": "0xabae",
"depositNonce": "0x35f22",
"depositReceiptVersion": "0x1",
"effectiveGasPrice": "0x0",
"from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
"gasUsed": "0xabae",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0x4200000000000000000000000000000000000015",
"transactionHash": "0xde6075fc8e8ce8bde41e8912de54be564e4cce7aec4cda4a985a10b4fb5f975c",
"transactionIndex": "0x0",
"type": "0x7e"
}
}
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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockHashAndIndex",
"params": ["0x9ef9df0cb786de577e9d474b3eeb9e7bd795ebb740188ef2454ff3a70de8b4c1", "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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockNumberAndIndex",
"params": ["0x36200", "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/swell \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{"address": "0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001"}],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": []
}