avalanche-docs icon indicating copy to clipboard operation
avalanche-docs copied to clipboard

adds a brief explanation of the genesis json

Open gall0x opened this issue 2 years ago • 7 comments

Hi, it adds a brief explanation of the genesis json. It should close the issue #798 created by @kirillt. Please let me know if you want me to change anything.

gall0x avatar Jun 20 '22 22:06 gall0x

Nice start, could you also explain how to provide proper NodeIDs for arbitrary private network installation? More details in the issue thread: https://github.com/ava-labs/avalanche-docs/issues/798#issuecomment-1162175550

kirillt avatar Jun 21 '22 18:06 kirillt

Hi @kirillt , the nodeID is generated from your crt and key files, so always will be the same. It's documented here.

You can generate them programatically using a library or use the info.getNodeID as you have already done (in step 3) and use them in the config file.

The error you have is because you already generated a genesis in the Step 1.

gall0x avatar Jun 22 '22 01:06 gall0x

@gall0x thank you for the link, need some time to try it.

kirillt avatar Jun 22 '22 18:06 kirillt

@gall0x thanks, this hint helped me. What exactly I did:

  1. Generate the keys using OpenSSL.
  2. Run the nodes, extract their NodeIDs.
  3. Stop the nodes, erase all data.
  4. Create Genesis JSON.
  5. Run with the same keys and fresh Genesis.

Now the network starts, but here are still some issues... Bootstrap process fails with:

[06-23|14:27:02.780] FATAL node/node.go:251 Failed to connect to bootstrap nodes. Node shutting down...

At the same time, I'm pretty sure that values passed into --bootstrap-ids and --bootstrap-ips options are valid. But I suspect that some of these 3 points might be cause of the failure (one of them, or all of them):

  1. Too few nodes: just 2 nodes. Is it enough or it's mandatory to use 3f+1 assuming f > 0?
  2. Nodes refer to each other for bootstrap: --bootstrap-ids=NodeID-A,NodeID-B --bootstrap-ips=IP-A,IP-B Is it OK or only 1 "beacon" node must be used?
  3. Genesis needs to be configured properly, but I'm not sure that exactly this is the culprit at the moment. If we start fresh network without any history, do stakes of potential validators matter already?

Could you please help me to clarify these questions? I think answers on those would be also very useful in the docs.

kirillt avatar Jun 23 '22 19:06 kirillt

Regarding question 2: if I specify bootstrap options the way that Node-B refers to Node-A (beacon) and Node-A not referring to any node, I get the following log: (Node-A)

[06-23|19:20:34.706] INFO <P Chain> bootstrap/bootstrapper.go:530 waiting for the remaining chains in this subnet to finish syncing
[06-23|19:20:34.706] INFO server/server.go:238 adding route /ext/bc/2huFztbeB4LijVCoLrxP8NwFbRCdtLfUyvx4VXwD5VnVxzxkMX/events
[06-23|19:20:34.706] INFO server/server.go:164 HTTP API server listening on "0.0.0.0:9650"
[06-23|19:20:34.706] INFO server/server.go:238 adding route /ext/bc/11111111111111111111111111111111LpoYY
[06-23|19:20:44.706] INFO <P Chain> common/bootstrapper.go:282 Bootstrapping skipped due to no provided bootstraps

(Node-B)

[06-23|19:20:38.001] INFO <X Chain> avalanche/transitive.go:73 initializing consensus engine
[06-23|19:20:38.001] INFO <X Chain> bootstrap/bootstrapper.go:264 Starting bootstrap...
[06-23|19:20:38.001] INFO <P Chain> bootstrap/bootstrapper.go:530 waiting for the remaining chains in this subnet to finish syncing
[06-23|19:20:38.001] INFO server/server.go:238 adding route /ext/bc/2huFztbeB4LijVCoLrxP8NwFbRCdtLfUyvx4VXwD5VnVxzxkMX/events
[06-23|19:20:38.001] INFO server/server.go:238 adding route /ext/bc/2huFztbeB4LijVCoLrxP8NwFbRCdtLfUyvx4VXwD5VnVxzxkMX
[06-23|19:20:38.001] INFO server/server.go:238 adding route /ext/bc/2huFztbeB4LijVCoLrxP8NwFbRCdtLfUyvx4VXwD5VnVxzxkMX/wallet
<no further output after a night, the process is live>

kirillt avatar Jun 23 '22 19:06 kirillt

hey @cgcardona, just made the changes you requested, please check it!

gall0x avatar Aug 04 '22 21:08 gall0x

@gall0x just want to make it clear about GitCoin bounty: it's up to Avalanche team to decide if they want to merge this PR, but IMO changes made, while being good changes, are not enough to make it really clear how to create custom Genesis config. Here are unresolved questions in this discussion which must be resolved in order to the bounty be paid out.

kirillt avatar Aug 07 '22 13:08 kirillt

Closing in favor of https://github.com/ava-labs/avalanche-docs/pull/1097

cgcardona avatar Dec 05 '22 17:12 cgcardona