I think I can identify it by parsing input data of then transaction then checking it declares the required functions and events. Are there any good ways or tools?

Update 1

Sebastian gave me the answer.

I can identify whether a transaction is for creating token or not by the following.

block := ethrpc.EthGetBlockByNumber(blockNumber)
for key, value := range block.Transactions {
    if value.Input != "0x" && strings.Contains(value.Input, "18160ddd") && strings.Contains(value.Input, "70a08231") && strings.Contains(value.Input, "dd62ed3e") && strings.Contains(value.Input, "a9059cbb") && strings.Contains(value.Input, "095ea7b3") && strings.Contains(value.Input, "23b872dd") {
        fmt.Println("key:", key, " value.Hash:", value.Hash)

However the above check is not enough. Etherscan says it is Not ERC-20 Compliant for some cases. I guess it is due to lack of information like token name and symbol.

e.g. https://etherscan.io/tokens?q=0x1e025340d6f75a2a4ef81139049cfbf976782eeb

Now I'm trying to find out whether transaction is fully valid ERC20 Token standard. Do you have any good idea?

Update 2

I think I need to know how the input data is created. I will try to understand getData method of web3.eth.contract. well, I have a long way to go.

var ST = web3.eth.contract(HumanStandardToken.abi);
var creation_data = ST.new.getData(args[0], args[1], args[2], args[3], {from: addr, data: "0x" + HumanStandardToken.prototype.binary, gasPrice: 50000000000, gas: 3100000});


1 Answer 1


I do not think there are dedicated tools for that. On high level, you could use e.g. MyEtherWallet, interface the contract address with a generic ERC20 ABI and try it out.

On lower level you could try the following approach: An ERC20 implements the following functions


You can use some tool to calculate the function identifier which is the first 4 bytes of the keccak hash of the function identifier as pasted above. These identifiers are thus:

18160ddd -> totalSupply()
70a08231 -> balanceOf(address)
dd62ed3e -> allowance(address,address)
a9059cbb -> transfer(address,uint256)
095ea7b3 -> approve(address,uint256)
23b872dd -> transferFrom(address,address,uint256)

You can now take some token creating transaction (e.g. this on here creating the Tend token) and check if the function identifiers are present in the bytecode (input data of the contract creating transaction). This is not guaranteed to really be an ERC20 (because the 4 bytes could pop up somewhere randomly) but it is probably a good way to be relatively sure by just looking at the bytecode (which nobody can hide).

  • Note that there will also be a lot of contracts that this wont work for. Uniswap, for example, has each of their exchange contracts be an ERC20 token, but they're also delegateproxy contracts so don't contain those hashes in their bytecode.
    – natewelch_
    May 15, 2019 at 20:07

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.