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});
https://github.com/ConsenSys/Token-Factory/search?utf8=%E2%9C%93&q=ST&type=
Best Answer
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:
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).