Skip to main content
Ethereum API
Multichain API

eth_getLogs

Summary: Returns an array of all logs matching the specified filter.

Parameters

Filter
object

filter

fromBlock
string

from block

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

toBlock
string

to block

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

address
oneOf

Address(es)

Any Address
null

Any Address

hex encoded address
string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

Addresses
array

Addresses

hex encoded address
string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

topics
oneOf

Topics

Any Topic Match
null

Any Topic Match

Specified Filter Topics
array

Specified Filter Topics

Filter Topic List Entry
oneOf

Filter Topic List Entry

32 hex encoded bytes
string

32 hex encoded bytes

Pattern: ^0x[0-9a-f]{64}$

Multiple Topic Match
array

Multiple Topic Match

32 hex encoded bytes
string

32 hex encoded bytes

Pattern: ^0x[0-9a-f]{64}$

Returns

Log objects
oneOf

Filter results

new block or transaction hashes
array

new block or transaction hashes

32 byte hex value
string

32 byte hex value

Pattern: ^0x[0-9a-f]{64}$

new logs
array

new logs

log
object
required

log

removed
boolean

removed

logIndex
string

log index

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

transactionIndex
string

transaction index

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

transactionHash
string

32 byte hex value

Pattern: ^0x[0-9a-f]{64}$

blockHash
string

32 byte hex value

Pattern: ^0x[0-9a-f]{64}$

blockNumber
string

block number

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

address
string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

data
string

data

Pattern: ^0x[0-9a-f]*$

topics
array

topics

32 hex encoded bytes
string

32 hex encoded bytes

Pattern: ^0x[0-9a-f]{64}$

Customize request
Parameter
Value
string
string
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
oneOf
oneOf

Connect your MetaMask wallet to run requests successfully.

Request

await window.ethereum.request({
"method": "eth_getLogs",
"params": [
{
fromBlock: "0x137d3c2",
toBlock: "0x137d3c3",
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
topics: []
}
],
});

Example response

[
{
"logIndex": "0x0",
"removed": false,
"blockNumber": "0x233",
"blockHash": "0xfc139f5e2edee9e9c888d8df9a2d2226133a9bd87c88ccbd9c930d3d4c9f9ef5",
"transactionHash": "0x66e7a140c8fa27fe98fde923defea7562c3ca2d6bb89798aabec65782c08f63d",
"transactionIndex": "0x0",
"address": "0x42699a7612a82f1d9c36148af9c77354759b210b",
"data": "0x0000000000000000000000000000000000000000000000000000000000000004",
"topics": [
"0x04474795f5b996ff80cb47c148d4c5ccdbe09ef27551820caa9c2f8ed149cce3"
]
},
{
"logIndex": "0x0",
"removed": false,
"blockNumber": "0x238",
"blockHash": "0x98b0ec0f9fea0018a644959accbe69cd046a8582e89402e1ab0ada91cad644ed",
"transactionHash": "0xdb17aa1c2ce609132f599155d384c0bc5334c988a6c368056d7e167e23eee058",
"transactionIndex": "0x0",
"address": "0x42699a7612a82f1d9c36148af9c77354759b210b",
"data": "0x0000000000000000000000000000000000000000000000000000000000000007",
"topics": [
"0x04474795f5b996ff80cb47c148d4c5ccdbe09ef27551820caa9c2f8ed149cce3"
]
}
]