Xphere — web3, net, eth (3/3)
API reference for Xphere. All methods ->
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,blockHashwill 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 blocknumber with hash blockHash. IfblockHashis present in the filter criteria, then neitherfromBlocknortoBlockare allowed.
-
-
Returns
removed(string; tag):truewhen the log was removed, due to a chain reorganization;falseif 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/xphere_mainnet/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x13452C2",
"toBlock": "0x13452C3"
}
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x730ad30e0a37c9ef3e38817365cab05fabf6a778",
"topics": [
"0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972"
],
"data": "0x",
"blockNumber": "0x13452c2",
"transactionHash": "0x7dc46269888ee4049b0ff1a3d096cb9af5261badf4c859a467e6496f2cb709e6",
"transactionIndex": "0x0",
"blockHash": "0x48e0fdec7ca5114d51781c1daa8f294a24f46eb9def9478959cc8e8e6b9e4242",
"logIndex": "0x0",
"removed": false
},
{
"address": "0xd64cd2aff75b156193fcc6dabcb17c4014675497",
"topics": [
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
"0x00000000000000000000000010aff64c17bbedb97086c3a13677e1ba42d9a3e8",
"0x00000000000000000000000049692095a22385110253cb8f6746b5719cbe0c57"
],
"data": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"blockNumber": "0x13452c2",
"transactionHash": "0x7dc46269888ee4049b0ff1a3d096cb9af5261badf4c859a467e6496f2cb709e6",
"transactionIndex": "0x0",
"blockHash": "0x48e0fdec7ca5114d51781c1daa8f294a24f46eb9def9478959cc8e8e6b9e4242",
"logIndex": "0x1",
"removed": false
},
{
"address": "0x68f250db5ac2457f430a32b25ed5ff80abf331cf",
"topics": [
"0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31",
"0x00000000000000000000000010aff64c17bbedb97086c3a13677e1ba42d9a3e8",
"0x00000000000000000000000049692095a22385110253cb8f6746b5719cbe0c57"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000000001",
"blockNumber": "0x13452c2",
"transactionHash": "0x7dc46269888ee4049b0ff1a3d096cb9af5261badf4c859a467e6496f2cb709e6",
"transactionIndex": "0x0",
"blockHash": "0x48e0fdec7ca5114d51781c1daa8f294a24f46eb9def9478959cc8e8e6b9e4242",
"logIndex": "0x2",
"removed": false
},
{
"address": "0x730ad30e0a37c9ef3e38817365cab05fabf6a778",
"topics": [
"0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f",
"0xf35488dbc35c63477f2a0ebd34ed3ee474192eae37de17eb66be3c1a300580c8",
"0x00000000000000000000000010aff64c17bbedb97086c3a13677e1ba42d9a3e8",
"0x00000000000000000000000029f4771750a71716336f8bded6c6064546563e29"
],
"data": "0x0000000000000000000000000000000000000199f19935b70000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000004e1693ee73c8000000000000000000000000000000000000000000000000000000000000d19dcc8",
"blockNumber": "0x13452c2",
"transactionHash": "0x7dc46269888ee4049b0ff1a3d096cb9af5261badf4c859a467e6496f2cb709e6",
"transactionIndex": "0x0",
"blockHash": "0x48e0fdec7ca5114d51781c1daa8f294a24f46eb9def9478959cc8e8e6b9e4242",
"logIndex": "0x3",
"removed": false
}
]
}