eth_getLogs - Linea

Returns an array of all logs matching a given filter object. For more information about eth_getLogs check out our Deep Dive into eth_getLogs page.

Parameters

Object - The filter options:

  • fromBlock: QUANTITY|TAG - (optional, default: "latest") Value:
    • Integer block number
    • "latest" for the last mined block
    • "pending", "earliest" for not yet mined transactions.
  • toBlock: QUANTITY|TAG - (optional, default: "latest") Value:
    • Integer block number
    • "latest" for the last mined block
    • "pending", "earliest" for not yet mined transactions.
  • address: DATA|Array, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate.
  • topics: Array of DATA, - (optional) Array of 32 Bytes DATA topics.
    • Topics are order-dependent. Each topic can also be an array of DATA with "or" options.
    • Check out more details on how to format topics in eth_newFilter.
  • blockHash: DATA, 32 Bytes - (optional) With the addition of EIP-234 (Geth >= v1.8.13 or Parity >= v2.1.0), blockHash is 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 the filter criteria, then neither fromBlock nor toBlock are allowed.
curl --location 'https://linea-mainnet.unifra.io/v1/{your-api-key}' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [
        {
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ],
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114"
        }
    ],
    "id": 0
}'

Returns

Array - Array of log objects, or an empty array if nothing has changed since last poll.

  • For filters created with eth_newBlockFilter the return are block hashes (DATA, 32 Bytes), e.g. ["0x3454645634534..."].
  • For filters created with eth_newPendingTransactionFilter the return are transaction hashes (DATA, 32 Bytes), e.g. ["0x6345343454645..."].
  • For filters created with eth_newFilter logs are objects with following params:
    • removed: TAG - True when the log was removed, due to a chain reorganization. False if its a valid log.
    • logIndex: QUANTITY - Integer of the log index position in the block. Null when its pending log.
    • transactionIndex: QUANTITY - Integer of the transactions index position log was created from. Null when its pending log.
    • transactionHash: DATA, 32 Bytes - Hash of the transactions this log was created from. Null when its pending log.
    • blockHash: DATA, 32 Bytes - Hash of the block where this log was in. Null when its pending. Null when its pending log.
    • blockNumber: QUANTITY - The block number where this log was in. Null when its pending. Null when its pending log.
    • address: DATA, 20 Bytes - Address from which this log originated.
    • data: DATA - Contains one or more 32 Bytes non-indexed arguments of the log.
    • topics: Array of DATA - 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 declare the event with the anonymous specifier.

Example

Request

curl --location 'https://linea-mainnet.unifra.io/v1/{your-api-key}' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [
        {
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ],
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114"
        }
    ],
    "id": 0
}'

Result

{
    "jsonrpc": "2.0",
    "id": 0,
    "result": [
        {
            "address": "0x808d7c71ad2ba3fa531b068a2417c63106bc0949",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x0000000000000000000000008a12cf9a984f749231f52c8715b53c5dfa0e13ee",
                "0x0000000000000000000000000000000000000000000000000000000000000000"
            ],
            "data": "0x00000000000000000000000000000000000000000000000000470de4df820000",
            "blockNumber": "0x47ff0",
            "transactionHash": "0x8b4b28aa23f7aec87df554c9df765e62c372dd4aea392563b944213eed99ee75",
            "transactionIndex": "0x9",
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114",
            "logIndex": "0x20",
            "removed": false
        },
        {
            "address": "0x224d8fd7ab6ad4c6eb4611ce56ef35dec2277f03",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x0000000000000000000000008731d54e9d02c286767d56ac03e8037c07e01e98",
                "0x000000000000000000000000aad094f6a75a14417d39f04e690fc216f080a41a"
            ],
            "data": "0x00000000000000000000000000000000000000000000000000005af3107a4000",
            "blockNumber": "0x47ff0",
            "transactionHash": "0x43bce2bdbe802790560546ca8293e8b654cc9e54a1cbb56824805af9bcf635c6",
            "transactionIndex": "0xa",
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114",
            "logIndex": "0x29",
            "removed": false
        },
        {
            "address": "0x808d7c71ad2ba3fa531b068a2417c63106bc0949",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x0000000000000000000000004e7b88f726464944a7524f75a2ca515f9265b3bc",
                "0x0000000000000000000000000000000000000000000000000000000000000000"
            ],
            "data": "0x000000000000000000000000000000000000000000000574c0de7d25cfd3a000",
            "blockNumber": "0x47ff0",
            "transactionHash": "0xe9ef4a28b836769bc7aa07d9a71cd71354438f427328d3e18fc7d38d12fc7e3d",
            "transactionIndex": "0xb",
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114",
            "logIndex": "0x30",
            "removed": false
        },
        {
            "address": "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x000000000000000000000000d5539d0360438a66661148c633a9f0965e482845",
                "0x000000000000000000000000678aa4bf4e210cf2166753e054d5b7c31cc7fa86"
            ],
            "data": "0x000000000000000000000000000000000000000000000000006647eabf63fcf8",
            "blockNumber": "0x47ff0",
            "transactionHash": "0xcd36deeb8d87d49878c67752d202f831a3b1d35a0c1beb81385f6625d4b86bfa",
            "transactionIndex": "0xe",
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114",
            "logIndex": "0x37",
            "removed": false
        },
        {
            "address": "0x176211869ca2b568f2a7d4ee941e073a821ee1ff",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x00000000000000000000000099c21c6083c4738b9e1976429455fce80a578729",
                "0x000000000000000000000000d5539d0360438a66661148c633a9f0965e482845"
            ],
            "data": "0x0000000000000000000000000000000000000000000000000000000002d5ccd3",
            "blockNumber": "0x47ff0",
            "transactionHash": "0xcd36deeb8d87d49878c67752d202f831a3b1d35a0c1beb81385f6625d4b86bfa",
            "transactionIndex": "0xe",
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114",
            "logIndex": "0x38",
            "removed": false
        },
        {
            "address": "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x000000000000000000000000e8190c17f5071b98e3d3ab1d6a8e711884e10d22",
                "0x000000000000000000000000272e156df8da513c69cb41cc7a99185d53f926bb"
            ],
            "data": "0x000000000000000000000000000000000000000000000000000fc35acbd945c5",
            "blockNumber": "0x47ff0",
            "transactionHash": "0x2edfd7f88f41d6c106545abf2c049ba253a9231d8e7cb6b5009351efb457b2fb",
            "transactionIndex": "0x10",
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114",
            "logIndex": "0x3c",
            "removed": false
        },
        {
            "address": "0x176211869ca2b568f2a7d4ee941e073a821ee1ff",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x000000000000000000000000d6c994cfc3d38343baf152a25f9ce13580e7e564",
                "0x000000000000000000000000e8190c17f5071b98e3d3ab1d6a8e711884e10d22"
            ],
            "data": "0x00000000000000000000000000000000000000000000000000000000006fcab5",
            "blockNumber": "0x47ff0",
            "transactionHash": "0x2edfd7f88f41d6c106545abf2c049ba253a9231d8e7cb6b5009351efb457b2fb",
            "transactionIndex": "0x10",
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114",
            "logIndex": "0x3d",
            "removed": false
        },
        {
            "address": "0x5f45cd59ba7f2f6bcd935663f68ee1debe3b8a10",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000005d1f1a39b270852b80a4c09f5aa0b28bd8bf77ff"
            ],
            "data": "0x0000000000000000000000000000000000000000000000015af1d78b58c40000",
            "blockNumber": "0x47ff0",
            "transactionHash": "0xac64a7fcf20651c861b9dfd68341f07e6344f253b8721a722e9e5e9efa402b1d",
            "transactionIndex": "0x11",
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114",
            "logIndex": "0x40",
            "removed": false
        },
        {
            "address": "0x176211869ca2b568f2a7d4ee941e073a821ee1ff",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x00000000000000000000000009c7c14e61a2b3ce924ac27e6b110c46f255f536",
                "0x000000000000000000000000bc7f67fa9c72f9fccf917cbcee2a50deb031462a"
            ],
            "data": "0x00000000000000000000000000000000000000000000000000000000002dc6c0",
            "blockNumber": "0x47ff0",
            "transactionHash": "0x4b6b7fe776a8759e7b1ff4e348d635765bd16a8ab4f39bc7369ade5d3ffe501c",
            "transactionIndex": "0x12",
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114",
            "logIndex": "0x41",
            "removed": false
        },
        {
            "address": "0xa219439258ca9da29e9cc4ce5596924745e12b93",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x000000000000000000000000bc7f67fa9c72f9fccf917cbcee2a50deb031462a",
                "0x00000000000000000000000009c7c14e61a2b3ce924ac27e6b110c46f255f536"
            ],
            "data": "0x00000000000000000000000000000000000000000000000000000000002dcb12",
            "blockNumber": "0x47ff0",
            "transactionHash": "0x4b6b7fe776a8759e7b1ff4e348d635765bd16a8ab4f39bc7369ade5d3ffe501c",
            "transactionIndex": "0x12",
            "blockHash": "0x375de30db8192560e57ed5c6de13e263f6fb98e725bcc008185ee73c07a9a114",
            "logIndex": "0x42",
            "removed": false
        }
    ]
}
Language
Click Try It! to start a request and see the response here!