Returns an array of all logs matching a given filter object.
Supported on Avalanche C-Chain (mainnet) only.
Parameters
object
- The filter options in the following shape:fromBlock
- Integer block number encoded as a hexadecimal, "latest","pending", or "earliest" tags.toBlock
- Integer block number encoded as a hexadecimal, "latest","pending", or "earliest" tags.address
- Contract address or a list of addresses from which logs should originate.topics
- Array of DATA topics. Topics are order-dependent.blockhash
- (optional) 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 to fromBlock = toBlock = the block number with hash blockHash. If blockHash is present in in the filter criteria, then neither fromBlock nor toBlock are allowed.
Returns
array
- Array of log objects, or an empty array if nothing has changed since last poll:removed
- Boolean true if log was removed, due to a chain reorganization. false if its a valid log.logindex
- Integer of log index position in the block encoded as a hexadecimal. null if pending.transactionindex
- Integer of transactions index position log was created from. null if pending.transactionhash
- Hash of the transactions this log was created from. null if pending.blockhash
- Hash of the block where this log was in. null when its pending. null if pending.blocknumber
- The block number where this log was, encoded as a hexadecimal. null if pending.address
- The address from which this log originated.data
- Contains one or more 32 Bytes non-indexed arguments of the log.topics
- Array of 0 to 4 32 Bytes of indexed log arguments.
API Endpoint
The format of an Avalanche C-Chain API endpoint is
https://open-platform.nodereal.io/{{apiKey}}/avalanche-c/ext/bc/C/rpc
- for RPC API
https://open-platform.nodereal.io/{{apiKey}}/avalanche-c/ext/bc/C/avax
- for AVAX API
Here is an example:
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/avalanche-c/ext/bc/C/rpc
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/avalanche-c/ext/bc/C/avax
Example
Request
curl https://open-platform.nodereal.io/{{apiKey}}/avalanche-c/ext/bc/C/rpc \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_getLogs","params":[{"address": "0xdAC17F958D2ee523a2206206994597C13D831ec7"}],"id":1,"jsonrpc":"2.0"}'
Result
{
"jsonrpc": "2.0",
"id": 1,
"result": []
}