Fetching new transactions

I’ve given out my Ethereum address to a customer. now I need to watch for when a deposit lands. I believe I can do that with:

wscat -c wss://ropsten.infura.io/ws/v3/XXX96a254XXX42508edXXXXf4cd14e34 --no-color
> {"jsonrpc":"2.0", "id": 1, "method": "eth_subscribe", "params": ["logs", {"address": "0xA0b8699XXXXX8b36c1d19XXXXX9Eb0cE3606eB48"}]}

(I’ve obfuscated the address and project ID in use)

however, when I send funds to the address I never see any output. is there a better way to do this?

Hello, @ekkis ! Welcome to the community! Have you taken a look at the eth_getBalance?

with: wscat -c wss://ropsten.infura.io/ws/v3/5c896XXXXb7942XXXXd028ef4cXXXX34 --no-color

Connected (press CTRL+C to quit)
{“jsonrpc”:“2.0”, “id”: 1, “method”: “eth_subscribe”, “params”: [“logs”]}

I get:

< {“jsonrpc”:“2.0”,“id”:1,“error”:{“code”:-32602,“message”:“invalid log filter: not enough parameters to decode position”}}

but in the documentation (https://infura.io/docs/ethereum/wss/eth-subscribe) both address and topics are optional. I’ve tried supplying my address but I don’t see any transactions, and I have no idea what a topics is and where I would get one. zero documentation on this on the site

help?

thanks for responding but: 1) why did you repost my original message with a subject that is less relevant to my question, and 2) what does eth_getBalance have to do with my question? why would I look at it?

thanks

hi @ekkis, logs are emitted by smart contracts, I don’t think it would work to accomplish your need. You’ll probably need to subscribe for pendingTransactions and filter out your address, see an example here:

Traian

I’m picking up pending transactions right now but it’s not a solution for the following reasons:

  1. the transactions haven’t been completed so now I have to monitor the transaction until it’s no longer pending, and
  2. since all I get is a transaction ID, I need to look it up via a getTransaction() call. that means I have to call that method for every transaction that happens i.e. there’s no way to filter. so I’m exceeding the 100,000 call quota

there must be a better way. help?

I had a look at the link you provided. sadly, for the pub/sub version of the example, the code is missing. I just see a black empty box. so I can’t see how he has implemented the solution

never mind about the article. something was wrong with the website and the images eventually came through. however, his implementation is what I currently have, which leads me to the problem of calling getTransaction() 100,000 times, leading to the quote problem I mentioned. so that’s not going to work