I'm looking to use the JSON RPC API to automate the sending of ERC20 tokens. Here is the documentation for it: https://github.com/ethereum/wiki/wiki/JSON-RPC
Does anyone know where the documentation is as it relates to sending ERC20 tokens? Thanks
I'm looking to use the JSON RPC API to automate the sending of ERC20 tokens. Here is the documentation for it: https://github.com/ethereum/wiki/wiki/JSON-RPC
Does anyone know where the documentation is as it relates to sending ERC20 tokens? Thanks
Sending erc-20 tokens are just calling a transfer
function for a token smart code. It's just like calling any othe function of any other smart contract.
To call a function of a contract, you need to use sendTransaction
api.
A sample code snippet for calling transfer function of a smart contract is:
var contractAbi = eth.contract(AbiOfContract);
var myContract = contractAbi.at(contractAddress);
// suppose you want to call a function named myFunction of myContract
var getData = myContract.transfer.getData(function parameters);
//finally paas this data parameter to send Transaction
web3.eth.sendTransaction({to:Contractaddress, from:Accountaddress, data: getData});
You can add other parameters like gas, gasPrice
in send transaction as well.
This is the documentation for ERC20 token: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
On this github repo you will find quite a few implementations written in Solidity by a reputable Ethereum company, ConsenSys: https://github.com/ConsenSys/Tokens/tree/master/contracts
However, keep in mind that JSON RPC and ERC20 Tokens do not belong to the same level of the stack. So you will not find any mention of ERC20 tokens in the JSON RPC documentation.
JSON RPC defines a set of method calls to let outside entities interact with the Ethereum network and Ethereum nodes. Some of those method calls are related to the Ethereum Virtual Machine, like eth_sendTransaction
. Among those methods, none of them make any assumptions about the code that you will run on the EVM. The fact that you will run an ERC20 token contract is just a detail of the data of your contract deployment transaction, and JSON RPC doesnt not deal with this.