Last active
November 21, 2017 02:31
-
-
Save rajcspsg/25c6bc7b152c65d87b35060293a78de4 to your computer and use it in GitHub Desktop.
setting up single/multi node Ethereum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. miner.start(true) | |
2. miner.stop() | |
3. eth.blockNumber (this returns the id of last/latest block of ethereum) | |
4. eth.getBalance (to view the miner's account balance) | |
5. eth.getBlock(eth.blockNumber).miner (returns the id of the last/latest block miner) | |
6. eth.getBalance(eth.getBlock(eth.blockNumber).miner) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. start the first node using above logic (please remember to add networkid).Networkid can be anything. | |
`./build/bin/geth --datadir=DATADIR1/data init "GENESIS/genesis.json" --networkid=1234 --ipcpath=DATADIR1/data/geth.ipc` | |
2. now run the second node using below command. | |
`./build/bin/geth --datadir=DATADIR2/data init "GENESIS/genesis.json" -port 30304 --nodiscover --networkid=1234 --ipcpath=DATADIR1/data/geth.ipc` | |
3. run `admin.nodeInfo` and copy the enode value. | |
4. go to first node console and run admin.addPeer("enode_value"). | |
5. then verify `admin.peers` to validate the list of peers in both nodes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. export ETHEREUM_HOME = <Directory ethereum is installed> | |
2. create genesis.json and store it in genesis(i.e.,GENESIS) folder | |
3. start the single ethereum node | |
`./build/bin/geth --datadir=DATADIR1/data init "GENESIS/genesis.json"` | |
4. to attach the console to the existing geth | |
`./build/bin/geth --datadir=DATADIR1/data console 2>console1.log` | |
5. In console try | |
a.) admin.nodeInfo | |
b.) personal.newAccount() | |
c.) personal.listAccounts() | |
6. Come out of geth console and stay in the same directory. | |
7. open a new terminal and then run | |
geth attach ipc:DATADIR1/data/gethipc | |
This command with attach any new terminal to the one already running on the console. | |
8. data of the node would be stored at `DATADIR1/data/geth/chaindata/*.ldb` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment