0

i am hosting a node and fully sync it. how i can call its api endpoints to figure out when DGX is received in certain wallet addresses.

1 Answer 1

0

For communicating with an ethereum e.g. geth, you can call its json-rpc api. For your case the eth_getLogs Function

ERC20 smart Contracts have the "transfer" event. You can query your node for the events of the smart contract address and filter for this log.

   /** 
 * @dev Emitted when `value` tokens are moved from one account (`from`) to
 * another (`to`).
 *
 * Note that `value` may be zero.
 */
event Transfer(address indexed from, address indexed to, uint256 value);

Link for openZeppelin IERC20 contract Interface

7
  • it will give me list of events but i want a last event on particular address. Dec 11, 2019 at 6:59
  • The eth_getLogs call provides these filter options: "address" for events originating from the smart contract. When you look in the code example above, you see that "from" and "to" are indexed. Indexed parameters will be accepted into the "topic" field of a log, so you can filter for these too. Dec 11, 2019 at 7:09
  • will it give me the time when last token was transfered on this address ? Dec 11, 2019 at 7:33
  • Unfortunatly this is limited to the block when the event was created. So you need to make a second lookup for when the block was mined to get an approximation. Dec 11, 2019 at 7:41
  • can i use getPastEvents method for same? Dec 11, 2019 at 11:16

Your Answer

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

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