I am trying to send ERC20 token using JSON RPC. I am very new in this step and learning. I am using eth_sendTransaction function. What is "value" and "data" option in this case ? Please help
Asked
Active
Viewed 2,354 times
2
-
There is an ethereum stackexchange where you might have better luck asking this question: https://ethereum.stackexchange.com/ – rickjerrity Apr 20 '18 at 15:21
-
@rickjerrity thanks – Haren Sarma Apr 20 '18 at 15:42
-
You can refer [Send ERC20 token with web3](https://stackoverflow.com/a/50019666/6521116) to have a good understand. – LF00 Apr 26 '18 at 04:42
2 Answers
0
From https://programtheblockchain.com/posts/2017/12/29/how-ethereum-transactions-work/:
The following values are encoded:
- recipient – The account address to which the transaction is being sent.
- value – The amount of ether to transfer from the sender to the recipient. This amount may be zero.
- data – Optional arbitrary binary data. During contract deployment, this is where the contract’s bytecode is sent. When calling a function on a contract, this specifies which function should be called and with what arguments. For simple transfers of ether, the data portion of the transaction is typically omitted.
- gas limit – The maximum amount of gas that can be consumed by the transaction.
- gas price – The amount the sender will pay for each unit of gas.
- nonce – A sequence number called a “nonce”. The sequence number is per sender and must match the next available sequence number exactly.
- signature – Data that identifies and authenticates the transaction’s sender.

user94559
- 59,196
- 6
- 103
- 103
-
where to know/set that ethereum transaction or erc20 token transaction ? – Haren Sarma Apr 20 '18 at 16:15
-
That question is unrelated. Please ask it separately (on https://ethereum.stackexchange.com). – user94559 Apr 20 '18 at 19:06
0
If you want to send ERC20 tokens via RPC calls, you need to call the transfer
function of the token contract with correct parameters.
Since ERC20 is not a well-defined standard, but rather an interface I would not recommend doing that blindly, you would have to study the contract source first to make sure it's possible.
To answer your question on a higher level:
value
is the amount of Ether transferred (in Wei) and should be0
because you do not want to transfer any ETH.data
is the hex-encoded execution of the ERC20transfer
, e.g., the method name called, and it's parameters.
I highly recommend using a wallet that supports ERC20 tokens, such as MyCrypto or Parity, but that is probably not what you are asking for :)
Note, I work for Parity.

q9f
- 11,293
- 8
- 57
- 96