go-ethereum/docs/_legacy/sending-ether.md
Felix Lange 7416b05b81
[DOCS] massive documentation update (#20229)
This PR:

- reorganizes all documentation pages so they live in the right category
- removes lots of legacy docs
- contains many improvements to active documentation pages

Geth user documentation is now spread across five major categories:

- Install and Build: installation and compile instructions
- Using Geth: this is for pages about general geth usage.
- For dApp Developers: this is for programming guides and functionality specific
   to dapp development. All the dev guides for mobile framework and Go APIs live here.
- JSON-RPC APIs: this has its own section because there is now a sub-page for
   every name space. I have also added an overview text that explains how to set
   up the API servers.
- For Geth Developers: this is for geth contributors
2019-11-05 13:46:00 +01:00

984 B

title
Sending ether

The basic way of sending a simple transaction of ether with the console is as follows:

> eth.sendTransaction({from:sender, to:receiver, value: amount})

Using the built-in JavaScript, you can easily set variables to hold these values. For example:

> var sender = eth.accounts[0];
> var receiver = eth.accounts[1];
> var amount = web3.toWei(0.01, "ether")

Alternatively, you can compose a transaction in a single line with:

> eth.sendTransaction({from:eth.coinbase, to:eth.accounts[1], value: web3.toWei(0.05, "ether")})
Please unlock account d1ade25ccd3d550a7eb532ac759cac7be09c2719.
Passphrase: 
Account is now unlocked for this session.
'0xeeb66b211e7d9be55232ed70c2ebb1bcc5d5fd9ed01d876fac5cff45b5bf8bf4'

The resulting transaction is 0xeeb66b211e7d9be55232ed70c2ebb1bcc5d5fd9ed01d876fac5cff45b5bf8bf4

If the password was incorrect you will instead receive an error:

error: could not unlock sender account