[Ethereum] Transfer an amount between two ethereum accounts using json-rpc

json-rpcnoncetransactionswallet-transfer

I am trying to transfer some funds between 2 ethereum accounts of my own. I have a node and communicate with it using json-rpc protocol. I guess I need to use eth_sendTransaction method, but I find it quite confusing because data field is supposed to be filled with a smart contract, but I don't want to use any smart contract right now, just a simple transaction of a given amount between my ethereum accounts.

Do I have to call eth_sendTransaction method? How do I fill data field? What does nonce field is used for?

Best Answer

eth_sendTransaction can be used for sending Ether, for creating contracts and calling contract function. It all depends on the parameters.

  1. For just sending Ether, you'd want to fill the value, to and from fields.

  2. For creating contracts, you'd leave the to empty but fill in data.

  3. For calling a contract function, you'd fill in both to and data, and optionally value if you also want to transfer Ether to the contract.

Related Topic