0

I am trying to subscribe to log events on ETH mainnet using alchemy provider as explained here

The subscription request returns successful response but I am not receiving any notifications at all

Here is the wscat logs:

wscat -c wss://eth-mainnet.alchemyapi.io/v2/<redacted>
Connected (press CTRL+C to quit)
{"method":"eth_subscribe","params":["logs", {"fromBlock":"latest","toBlock":"latest","address":"<redacted>","topics:["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],"id":1,"jsonrpc":"2.0"}
< {"id":1,"result":"0x646ea02a49d579f15112918d76983131","jsonrpc":"2.0"}

I did some ERC-20 transactions and checked their logs and the address and the topic matches but I get no notifications. Any idea if this works as intended or am I missing something?

1 Answer 1

0

For the way you subscribe to the event:

{"method":"eth_subscribe","params":["logs", {"fromBlock":"latest","toBlock":"latest","address":"<redacted>","topics:["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],"id":1,"jsonrpc":"2.0"}

You should remove "fromBlock" and "toBlock": {"method":"eth_subscribe","params":["logs", {"address":"<redacted>","topics:["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],"id":1,"jsonrpc":"2.0"}

To receive notifications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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