Skip to content

I cannot get results from api eth_getLogs sometimes #6037

Closed
@liuyifei001

Description

@liuyifei001

Software Versions

OS : Linux
JVM : Oracle Corporation 1.8.0_161 amd64
Git : a8ad2a169e58946b5b8de6ecf7b7ef5b8db05aff
Version : 4.7.5
Code : 18306

Expected behavior

If the JSON-RPC service is enabled, users should be able to search for events based on contract addresses and topics. However, after I enabled the service, there should be an address-related log in a certain block, but I couldn't find it.

Actual behavior

I use the following interface to get events:

curl --location 'http://localhost:8545/jsonrpc' --header 'Content-Type:application/json' --data '{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [
        {
            "address":[
                "0x034e5a6bbf5d4bacd1c92c4a9bd2a67554c755a5"
            ],
            "fromBlock": "0x30f22c0",
            "toBlock":"0x30f22c0"
        }
    ],
    "id": 1
}'

And get nothing:

{"jsonrpc":"2.0","id":1,"result":[]}

But the following log really exists in block 51323584("0x30f22c0"):

        {
            "address": "0x034e5a6bbf5d4bacd1c92c4a9bd2a67554c755a5",
            "blockHash": "0x00000000030f22c0a2db59c5b94ca345ef97ff3ec3eef3cd45863907cabd04f8",
            "blockNumber": "0x30f22c0",
            "data": "0x0000000000000000000000006e0617948fe030a7e4970f8389d4ad295f249b7e0000000000000000000000000000000000000000000000000000000000000000",
            "logIndex": "0x44",
            "removed": false,
            "topics": [
                "0xcdee897399ab5e465acb1bd3ed5e32c695f196321764546c59720fa6c9ce4c69"
            ],
            "transactionHash": "0xb2c4a682fdfe6352b93ef79fa7b890ac5daf7f6a240f52e2b528c5f1c817a96f",
            "transactionIndex": "0xe5"
        },

I used the same interface with the JSON parameter and dropped the ‘address’ to verify it:

curl --location 'http://localhost:8545/jsonrpc' --header 'Content-Type:application/json' --data '{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [
        {
            "fromBlock": "0x30f22c0",
            "toBlock":"0x30f22c0"
        }
    ],
    "id": 1
}'

I tried to use another address 0xa614f803b6fd780986a42c78ec9c7f77e6ded13c and got the log successfully.

Frequency

I have no idea. But I have not gotten logs using the address 0x034e5a6bbf5d4bacd1c92c4a9bd2a67554c755a5 in other blocks yet.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions