We bend the meaning of the word offline here a bit. We still communicate with Ethereum network to get the gas cost and the next transaction nonce. However, the private key never leaves the computer.
This blog post serves mostly as an example. Advanced users can use the script presented here for doing Ether cold wallet and offline transactions.
Ethereum transaction dissemination
Each Ethereum transaction consists of
Target address, either a contract or an Ethereum account.
Nonce, incremented once per transaction per account, to prevent double spend attacks.
Value, how many Ethers are transferred. Can be 0 for contract calls, but you still need to pay for the gas.
The maximum gas the transaction is allowed pull from the sending account.
The gas price if the transaction needs a preferential treatment.
Optional data payload that would include any function call and arguments encoded.
Transaction is signed with the private key of the sending account address. Based on these arguments you can create a raw transaction, as a hex string, that can be pushed to the network.
Pushing can happen either through EtherScan.io service or through web3.eth.sendRawTransaction API.
Furthermore in this particular example we also need
EtherScan.io API key – we use their API to communicate with the network Example script
The example script is available on TokenMarket Github repository.
To run the script
You need to understand Node.js and Babel basic
Node 7 or newer
Clone the git repository
Install dependencies with