Configuring ethereum private network
(Erszbat (v1.11.5), 4/15/2023)
https://geth.ethereum.org/docs/fundamentals/private-network
Setup two nodes on Windows 11 pro
create a directory to hold the nodes
create password.txt file and put the password text in the file. Just the password with nothing else
startup cmd (run as administrator) and go to directory you just created
geth account new --datadir node1
put in password twice (you need to remember what you set)
creates a node1 directory with secret key file and returns your public key
returns public address of the key: 0x4FB0032AA225a94EdB257ae1d2338DfDc6d23e7F
geth account new --datadir node2
put in password twice
creates a node1 directory with secret key file and returns your public key
returns public address of the key: 0xa6AE721942e7fa6b5e6c280Ad41439eb27da521d
Setup the genesis file now that we have the two public keys.
addresses in both the extradata and alloc areas
chainId set ot 12345
Create Genesis.json file
{
"config": {
"chainId": 12345,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"clique": {
"period": 5,
"epoch": 30000
}
},
"difficulty": "1",
"gasLimit": "0x1fffffffffffffff",
"extradata": "0x00000000000000000000000000000000000000000000000000000000000000004FB0032AA225a94EdB257ae1d2338DfDc6d23e7Fa6AE721942e7fa6b5e6c280Ad41439eb27da521d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"alloc": {
"4FB0032AA225a94EdB257ae1d2338DfDc6d23e7F": { "balance": "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" },
"a6AE721942e7fa6b5e6c280Ad41439eb27da521d": { "balance": "300000000" }
}
}
geth init --datadir node1 genesis.json
geth init --datadir node2 genesis.json
bootnode -genkey boot.key
startup the bootnode
bootnode -nodekey boot.key -addr :30305
returns the enode that is used to start the other nodes
enode://dd56ba62106a591288316f5b487ac0fc84046ba5438fc4e18e8d1b24bd33a6f024e32dacaf76d90912aaa198a8bebb5b8b9d53ffa47ebfeef4fd25430e21a10a@127.0.0.1:0?discport=30305
Open up second cmd window (as administrator) to start node 1. Remember to go top directory
put in address of create for first node
we are using --http.port 8546 which is where we connect via metamask
we are using --ipcpath=node1/geth.ipc which is what we connect to with geth client
we are using --rpc.enabledeprecatedpersonal which is now required for geth client to use personal commands
geth --datadir node1 --port 30308 --bootnodes enode://dd56ba62106a591288316f5b487ac0fc84046ba5438fc4e18e8d1b24bd33a6f024e32dacaf76d90912aaa198a8bebb5b8b9d53ffa47ebfeef4fd25430e21a10a@127.0.0.1:0?discport=30305 --networkid 12345 --unlock 0x4FB0032AA225a94EdB257ae1d2338DfDc6d23e7F --password password.txt --http --allow-insecure-unlock --http.corsdomain "*" --http.vhosts "*" --http.addr "0.0.0.0" --authrpc.port 8560 --http.port 8546 --ipcpath=node1/geth.ipc --http.api="eth,net,web3,personal,web3" --rpc.enabledeprecatedpersonal --rpc.gascap 0 --rpc.txfeecap 0 --verbosity "4"
After starting this notice that we have not started mining yet. Just started blockchain engine
Open up third cmd window (as administrator) to startup the geth client. Remember to go to top directory.
geth attach \\.\pipe\node1\geth.ipc
eth.accounts[0]
eth.getBalance(eth.accounts[0])
personal.unlockAccount(eth.accounts[0])
enter your password: password
to start mining
miner.setEtherbase("0x4FB0032AA225a94EdB257ae1d2338DfDc6d23e7F")
miner.start(1)
eth.sendTransaction({from: eth.accounts[0], to: "0x9cfc7E44757529769A28747F86425C682fE64653", value: "100000", gasLimit: 21000, gas: 100000, gasPrice: 1000})
eth.sendTransaction({from: eth.accounts[0], to: "0xa6AE721942e7fa6b5e6c280Ad41439eb27da521d", value: "100000", gasLimit: 21000, gas: 100000, gasPrice: 1000})
eth.getBalance("0x4FB0032AA225a94EdB257ae1d2338DfDc6d23e7F")
eth.getBalance("0xa6AE721942e7fa6b5e6c280Ad41439eb27da521d")
eth.getBalance("0x9cfc7E44757529769A28747F86425C682fE64653")
eth.sendTransaction({from: "0xa6AE721942e7fa6b5e6c280Ad41439eb27da521d", to: "0xa6AE721942e7fa6b5e6c280Ad41439eb27da521d", value: "100000", gasLimit: 21000, gas: 100000, gasPrice: 1000})
personal.unlockAccount("0xa6AE721942e7fa6b5e6c280Ad41439eb27da521d")
personal.newAccount()
set password
address returned: "0x4FB0032AA225a94EdB257ae1d2338DfDc6d23e7F"
eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: "100000", gasLimit: 21000, gas: 100000, gasPrice: 1000})
eth.sendTransaction({from: eth.accounts[0], to: 0x102f07628C7A1Fb36387908742E529fE47728094, value: "100000", gasLimit: 21000, gas: 100000, gasPrice: 1000})
eth.getBalance("0x102f07628C7A1Fb36387908742E529fE47728094")
VueJs Client Talking to private network
C:\ethereum\DemoProjects\web3-project2
go to directory and run app: yarn serve --port 3000
Connect to EVM (select connect button in demo)
Connect via metamask wallet. Make sure you are on correct EVM 8546, node1 with correct address via metamask
view connected sites and remove yourself. go to "..." in metamask and select connected sites
Connect to NFT Collection Wallet and get collection information (App.vue has this code)
Retrieve NFT's and associated NFT metadata, Get TokenUrl
Retrieve IPFS metadata from TokenUrl (IpfsInfo.vue has this code)
IPFS is running on localhost:8080
ODOO integration to private network
https://www.youtube.com/watch?v=zvbolXy7xI0
Agustin Wisky
bloopark Systems
https://github.com/awisky/odoo-avax
python web3 library