$ sudo add-apt-repository ppa:ethereum/ethereum
$ sudo apt-get update
$ sudo apt-get install ethereum
-
Make an account:
geth account new
. -
Save this to a file
genesis.json
.{ "nonce": "0x0000000000000123", "timestamp": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "0x0", "gasLimit": "0x8000000", "difficulty": "0x1", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x3333333333333333333333333333333333333333", "alloc": {} }
-
Run
geth init genesis.json
. -
For unsafe test usage, just unlock your primary account and start geth like this:
$ geth --rpc --networkid 12345 --mine --etherbase 0 --unlock 0 --password <(echo your-password-here)
-
Connect to Ethereum node:
geth attach
-
Write a contract:
- In browser solidity, type something like
pragma solidity ^0.4.3; contract Ticker { uint public val; function tick() { val+=1; } }
- Copy the code from the web3 deploy box and paste it into your terminal session with the geth javascript console.
- This is give you the contract you wrote and expose its functions as elements of a javascript object.
- Note: I know this is a completely stupid way to program. If you get sick of this, you can try cloning kidwai/ethereumjs-sandbox and following the README there, but I frankly haven't tested it very much, so you may run into issues (which you are free to report).
- This is going to be rather slow right now, but you can repeat the above steps but when setting up your geth node, do
geth --testnet account new
, andgeth --testnet --rpc ...
instead. This is going to take you a while because you have to sync with the network. I suggest not doing this first.