$ sudo apt-get install software-properties-common
$ sudo add-apt-repository -y ppa:ethereum/ethereum
$ sudo apt-get update
$ sudo apt-get install ethereum
$ geth account new
$ vi genesis.json
Get genesis.json$ geth --datadir "/tmp/dev-geth/" init genesis.json
$ geth --identity "PixelsFire" --rpc --rpcport "8545" --rpccorsdomain "*" --datadir "/tmp/dev-geth/" --port "30303" --nodiscover --rpcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --networkid 15 --nat "any" --rpcaddr "<your-servers-ip>" --wsaddr "<your-servers-ip>"
$ git clone https://github.com/etherparty/explorer
$ cd explorer
$ apt-get install npm
$ npm install -g bower
$ bower install
$ cd app
$ vi app.js
search for localhost and change to your server's ip$ python -m SimpleHTTPServer 8001
$ geth attach http://<your-servers-ip>:8545
> personal.newAccount()
> miner.start(10)
> personal.unlockAccount("<insert-address-here>")
> eth.sendTransaction({from: '<insert-address-here>', to: '<insert-address-here>', value: web3.toWei(1, "ether")})
> var storageContract = web3.eth.contract([{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"}]);
var storage = simplestorageContract.new(
{
from: web3.eth.accounts[0],
data: '0x6060604052341561000c57fe5b5b60c68061001b6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b11460445780636d4ce63c146061575bfe5b3415604b57fe5b605f60048080359060200190919050506084565b005b3415606857fe5b606e608f565b6040518082815260200191505060405180910390f35b806000819055505b50565b600060005490505b905600a165627a7a72305820253ea8bd608383c96778b7f7b5dd88b8d4847320a64d31778e905180013baa200029',
gas: '400000'
}, function (e, contract){
console.log(e, contract);
if (typeof contract.address !== 'undefined') {
console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
}
})
- Set:
> storage.set(45,{from:eth.accounts[0]})
- Get:
> storage.get()