0

I'm developing an Ethereum platform and need to fetch the events log of a desired address. I found a code like this:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"topics":["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"]}],"id":74}'

but when I replace my own address in this code, I receive an empty result as below:

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

May you tell me what is my mistake here?

0

An ethereum log entry contains a list of topics. This list contains the contract address, event's signature and indexed parameters.

If you want to filter events with your address then it has to be included in an event as an indexed parameter.

For example standard ERC-20 tokens have the event event Transfer(address indexed _from, address indexed _to, uint256 _value), and you can filter by sender and recipient address.

If your address wasn't included as an indexed parameter getLogs will return an empty list.

| improve this answer | |
  • Ismael, I have not any problem with ERC-20 tokens logs, the issue I have face with is logs of ETH itself. – Mohammad Saberi Jun 14 at 16:30
  • @MohammadSaberi Since ether transfers do not generate any events you cannot use getLogs to retrieve them. I answered similar question here ethereum.stackexchange.com/a/84275. – Ismael Jun 14 at 16:33
  • thank you so much... – Mohammad Saberi Jun 14 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.