5

I know now how to get balances of Token with sudo geth --exec "eth.call({to: '0xad408ef944da873fe9b65f4e78e21ac2d489db90', data: '0x70a08231000000000000000000000000280e5dbe0d36be7344743ce034b104b94d930e51'})" attach

But for sending an ERC20 token, e.g. Golem the command would be

sudo geth --exec "eth.call({to: '0xa74476443119A942dE498590Fe1f2454d7D4aC0d', data: '0xNNNNNNNNNNNNNNNN'})" attach

So how to format the data part with sending address, receiving address, value, gas and gasPrice?

5

To properly execute a contract method you have to encode the method signature and parameters in the data field. See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI

To do that from the command line you could use a command line tool to do this encoding for you. For example: https://github.com/paritytech/ethabi

Also remember that eth.call is going to call the contract locally without creating a transaction. If you want to post a transaction calling a contract method use: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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