I'm trying to understand how the private blockchain network concept works.
Scenario:
- Lets say I have two nodes connected to the internet but not in the
same network - On the first node using geth I initialize using a new
genesis config - Then I start the first node with network id set to
5501 - Now on second node I don't initialize any genesis config
- Just start the second node geth with same network id i.e. 5501
- As you can see I am using network id starting with 5 so the block chain is
started in a private network
Questions:
- Will the second node get connected with the first as a peer and be part of that private blockchain?
- How to create a private block chain network where one can only join after getting the approval or am I thinking in wrong perspective
Best Answer
Private blockchain Everyone is equal, and can mine the transactions. Basically you need to share your genesis block with the other party and once they initialize their chain, you have to add their enode addrees as peer.
Permissioned blockchain Permission is built into your blockchain client, where you can decide based on the other party cryptographic information what access will they have. Monax, Hyperledger fabric, jpmorgan quorum are some examples of permissioned chains.. Based on your comment , you are trying to create a private blockchain.
Note, Once geth starts in console mode, enable personal API and create your 1st account, seed your account with some ether in your genesis alloc block. For adding a peer via console you should enable admin API.
replace the [::] with your IP of Node A. Now you are ready to connect to another Node B.
4.In Node B,keep your genesis.json , your A node's enode address handy. Initialize the chain with the genesis block that you have from A.
Once initialized, you can check in either machines if they have any peers
Once this is done, the two Nodes now are connected and would receive any contracts or events happening in either A or B.
You can check this by,
References -
https://github.com/ethereum/go-ethereum/wiki/Connecting-to-the-network How to use static-nodes.json / trusted-nodes.json to prevent connection loss on private network? https://github.com/ethereum/go-ethereum/wiki/Management-APIs