0

I use web3 and I would like to know when somebody sent me any kind of ERC20 token. With web3, I can get the "to" and the "input" fields. With the "to", I get the contract address. With the "input", I get the recipient and the number of tokens transferred. Then, I want to spend those tokens. For that I need to connect to the contract so I need the ABI.

My questions: where can I find the ABI since I don't have the contract source ? It is possible to find the contract source ?

1 Answer 1

1

If you have the Ethereum address, you can go here: http://etherscan.io to get a list of all transactions and, if the person/people who wrote the smart contract posted such, you can get both the source code and the ABI.

The only trouble that I've had with this approach, and it's only a philosophical one, is that this is centralized. A better approach would be a fully decentralized source of this same information. I believe the people working in the ENS (http://ens.domains/) are working on this functionality, but I don't think it's yet available (or if it is, it's not widely implemented).

2
  • So it is not possible to automatize this process with web3 ?
    – jfjobidon
    Aug 28, 2017 at 16:45
  • I don't think so because the chain is public. Everyone can see everything. Aug 28, 2017 at 17:18

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.