guide to set up private block chain:
- https://souptacular.gitbooks.io/ethereum-tutorials-and-tips-by-hudson/content/private-chain.html
- https://github.com/ethereum/homestead-guide/blob/master/source/network/test-networks.rst
- https://github.com/ethereum/go-ethereum
prerequisites:
- install golang
install geth using go:
go get -d github.com/ethereum/go-ethereum
cd $GOPATH/src/github.com/ethereum/go-ethereum
make geth
(installs geth to~/go/src/github.com/ethereum/go-ethereum/build/bin/geth
)
set up and run private blockchain:
- alternate private blockchain with
gethdev
https://github.com/amacneil/gethdev - copy
private-chain.sh
andmy-genesis.json
to~/go/src/github.com/ethereum/go-ethereum
- make
private-chain.sh
executablechmod +x private-chain.sh
- execute
./private-chain.sh
and use js console- note: js console commands: https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console
create new private block chain account
- from terminal: in a new terminal window run
${HOME}/go/src/github.com/ethereum/go-ethereum/build/bin/geth account new --datadir <your private chain directory>
- from js console:
personal.newAccount("<password>")
- back in the geth console you can now see the account by running:
eth.accounts[0]
mine some ether to your account
- locate the ipc file on disk. Can be found when first starting local geth. (/Users/aaron/ethereum/privatechain/geth.ipc). This will allow you access to the miner.
- attach to the running geth IPC node on localhost
./build/bin/geth attach "/Users/aaron/ethereum/privatechain/geth.ipc" --datadir "/Users/aaron/ethereum/privatechain"
- unlock the eth acccount to mine if necessary
personal.unlockAccount(eth.accounts[0], "<your account password>")
- in the console set your account for the miner
miner.setEtherbase(eth.accounts[0]);
this should returntrue
- finally run
miner.start(1)
(1 thread) - check balances with
balance = web3.fromWei(eth.getBalance(eth.accounts[0]), "ether");
Is identity some secret?