برای ساخت بلاکچین خصوصی میخواهیم با دستورات geth ( go ethereum ) d یک بلاکچین با اولین نود بسازیم
برای این کار باید geth را نصب نمایید
این ویديو آموزش برنامه نویسی بلاکچین به شما این مورد را کامل آموزش میدهد
و کد های زیر در این ویديو استفاده شده است
{
"config": {
"chainId": 4568,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"difficulty" : "400",
"extraData" : "",
"gasLimit" : "15000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}
geth --datadir . init genesis.json
geth --datadir . account new
geth --datadir . account new
geth --allow-insecure-unlock --datadir . --keystore keystore --networkid 4568 --http --http.corsdomain "*" --http.port 8502 --http.api personal,eth,net,web3,txpool,miner --mine --miner.etherbase=
///////////////////////
new terminal
geth attach \\.\pipe\geth.ipc
eth.accounts
eth.getBalance(eth.coinbase)
miner.start()
miner.stop()
eth.getBalance(eth.coinbase)
personal.unlockAccount(eth.coinbase)
eth.sendTransaction({to: eth.accounts[1], from: eth.accounts[0], value: 100})
eth.getBalance(eth.accounts[1])
miner.start()
miner.stop()
eth.getBalance(eth.accounts[1])