Skip to main content

eth_getLogs

Returns an array of all logs matching the specified filter.

Parameters (by position)

Filter object or object required


Show Option 1 Filter by block range object

Filter by block range fields

Filter object required

Filter by block range


Show Filter object

Filter fields

  • fromBlock string

    from block

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


  • toBlock string

    to block

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


  • address null or string or array<string>


    Show Option 1 Any Address null

    Any Address fields

    address null

    Any Address


    Show Option 2 Address string

    Address fields

    address string

    Address

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


    Show Option 3 Addresses array

    Addresses fields

    address array<string>

    hex encoded address

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


  • topics null or array<unknown>


    Show Option 1 Any Topic Match null

    Any Topic Match fields

    topics null

    Any Topic Match


    Show Option 2 Specified Filter Topics array

    Specified Filter Topics fields

    topics string or array<string>


    Show Option 1 Single Topic Match string

    Single Topic Match fields

    topics array<string>

    Single Topic Match

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


    Show Option 2 Multiple Topic Match array

    Multiple Topic Match fields

    topics array<string>

    32 hex encoded bytes

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


  • additionalProperties true


Show Option 2 Filter by block hash object

Filter by block hash fields

Filter object required

Filter by block hash


Show Filter object

Filter fields

  • blockHash string required

    block hash

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


  • address null or string or array<string>


    Show Option 1 Any Address null

    Any Address fields

    address null

    Any Address


    Show Option 2 Address string

    Address fields

    address string

    Address

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


    Show Option 3 Addresses array

    Addresses fields

    address array<string>

    hex encoded address

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


  • topics null or array<unknown>


    Show Option 1 Any Topic Match null

    Any Topic Match fields

    topics null

    Any Topic Match


    Show Option 2 Specified Filter Topics array

    Specified Filter Topics fields

    topics string or array<string>


    Show Option 1 Single Topic Match string

    Single Topic Match fields

    topics array<string>

    Single Topic Match

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


    Show Option 2 Multiple Topic Match array

    Multiple Topic Match fields

    topics array<string>

    32 hex encoded bytes

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


  • additionalProperties true


Result

Log objects array<string> or array<object>


Show Option 1 new block or transaction hashes array

new block or transaction hashes fields

Log objects array<string>

32 byte hex value

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


Show Option 2 new logs array

new logs fields

Log objects array<object>

log


Show Log objects object

Log objects fields

  • removed boolean

    removed


  • logIndex string

    log index

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


  • transactionIndex string

    transaction index

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


  • transactionHash string required

    transaction hash

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


  • blockHash string

    block hash

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


  • blockNumber string

    block number

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


  • blockTimestamp string

    block timestamp

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


  • address string

    address

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


  • data string

    data

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


  • topics array<string>

    32 hex encoded bytes

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


  • additionalProperties false


Errors

Error code: 4444

  • code

    4444

  • message

    Pruned history unavailable

Examples

eth_getLogs example

Request

{
"params": [
{
"fromBlock": "0x137d3c2",
"toBlock": "0x137d3c3",
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"topics": []
}
]
}

Response

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