3

I need to check for customers' deposits and need to scan for receiving transactions for those addresses for Ether and in next step ERC-20 tokens. What's the most efficient way to do this with go-ethereum?

jeff
  • 603
  • 7
  • 16

3 Answers3

1

No easy to answer to this. You'll need to run a node or use infura and index every event log topic and data in every new transaction in every new block. You may use a pub/sub mechanism such as redis to publish new events when your indexing worker comes across events that you're interested in.

Miguel Mota
  • 5,143
  • 29
  • 47
0

I am looking for the same solution, as far as I know, web3js can watch events, but after received the events, also need to wait for more confirmations(say 30) in case of rollback(double spending). My target solution is to use golang to interactive with geth(installed in local and open rpc service), but haven't find the way. Node may do the work.

Don't use javascript to do it.

Shiming
  • 11
  • 3
0

One options is to run your own node and enable tracing.

With this, code can :

  1. Listen for new blocks (E.g.: Event on Mining of a new block )
  2. For each new block, iterate over all transactions ("transactions" property of Block)
  3. For each transaction, trace the transaction to find out all value transfers (geth : https://github.com/ethereum/go-ethereum/wiki/Tracing:-Introduction ; parity : https://github.com/paritytech/wiki/blob/master/JSONRPC-trace-module.md#trace_replaytransaction. Some details : Instrumenting EVM)
  4. This should provide list of all addresses that were impacted by a particular transaction (By direct value transfer or internal transactions as part of contract)
  5. For each address; Either implement your own code to reconstruct value from trace or query value as of that block
  6. Update your own DB / Storage with these changes
Shamit Verma
  • 534
  • 2
  • 5