0

I am still having issues with this tutorial. https://docs.substrate.io/tutorials/build-a-blockchain/authorize-specific-nodes/

I have spent today trying to find a solution but have been unable to do so. At step 7 of "Add genesis storage for authorized nodes" it directs to the below code to the GenesisConfig declaration for fn testnet_genesis

 node_authorization: NodeAuthorizationConfig {
   nodes: vec![
     (
       OpaquePeerId(bs58::decode("12D3KooWBmAwcd4PJNJvfV89HwE48nwkRmAgo8Vy3uQEyNNHBox2").into_vec().unwrap()),
       endowed_accounts[0].clone()
     ),
     (
       OpaquePeerId(bs58::decode("12D3KooWQYV9dGMFoRzNStwpXztXaBUjtPqi6aU76ZgUriHhKust").into_vec().unwrap()),
       endowed_accounts[1].clone()
     ),
   ],
 },

but in the file I have, it doesn't have that declaration. What I have is

/// Configure initial storage state for FRAME modules.
fn testnet_genesis(
        initial_authorities: Vec<(AuraId, GrandpaId)>,
        root_key: AccountId,
        endowed_accounts: Vec<AccountId>,
        _enable_println: bool,
) -> serde_json::Value {
        serde_json::json!({
                "balances": {
                        // Configure endowed accounts with initial balance of 1 << 60.
                        "balances": endowed_accounts.iter().cloned().map(|k| (k, 1u64 << 60)).collect::<Vec<_>>(),
                },  
                "aura": {
                        "authorities": initial_authorities.iter().map(|x| (x.0.clone())).collect::<Vec<_>>(),
                },  
                "grandpa": {
                        "authorities": initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect::<Vec<_>>(),
                },  
                "sudo": {
                        // Assign network admin rights.
                        "key": Some(root_key),
                },  
        })  
}

Thanks in advance to anyone who can help. I am trying to learn this by doing it, but it is difficult when the steps don't work. I am trying to get some basic examples up and running so that I can try to illustrate a PoC of the ease of using Polkadot and Substrate, so it is frustrating that I can't get the basic examples working "out of the box" by following the guides. I'm a C++/Linux programmer but not familiar with Rust. The idea was that once I could get them running, I could then modify and add pallets etc. to show what it can do.

When I left it the way it is, it built ok. But when I ran it later, the nodes appeared to be able to see each other, but each said "Peers 0" in the output and I expected to see "Peers 1".

1 Answer 1

1

I struggled through these tutorials too! I have taken the time to attempt an update. Maybe you can check out the changes Ive made and see if they help.

updated Authorize Specific Nodes tutorial

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.