sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
https://www.digitalocean.com/community/tutorials/how-to-install-go-on-ubuntu-20-04
cd go-ethereum
git checkout release/1.11
git pull
make geth
sudo cp build/bin/geth /usr/local/bin/
mkdir private-ethereum
cd private-ethereum
geth --datadir ./datadir account new
paste the following code and replace the address in alloc with the account you prev made
{
"config": {
"chainId": 4785,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
"difficulty": "400",
"gasLimit": "2000000",
"alloc": {
"Daa9D9230fA7d30831dC2cfc624155120Bcf1793": {
"balance": "100000000000000000000"
},
"7fFFA35Ddd1Dcf33648F8F61C8a712bDBd8d52D2": {
"balance": "120000000000000000000000"
}
}
}
geth --datadir ./blockchainData init ./genesis.json
geth --datadir ./blockchainData --networkid 4785 console 2>> eth.log
eth.accounts
- create a new folder like blockchainData with another name
- initialize the genesis block for this folder
- run the following command to run a new node in sperate terminal
geth --datadir ./blockchainData2 --networkid 4785 --port 30305 --authrpc.port 8553 console
- the port and authrpc port must be change for every node if running on same machine
- In node 1 run
admin.nodeInfo
- copy encode value and open terminal of node 2 and run the command and paste the value as a strign in param
admin.addPeer()
- now open terminal of node 1 or node 2 and run admin.peers to see if node is added
admin.peers
- if its return an array of objects its means nodes are peers. if empty array its mean node are not peer
- now we will start mining
miner.setEtherbase(eth.accounts[0])
miner.start()
- to stop minning
miner.stop()