3

I have implemented the NPOS with EVM blockchain using the substrate.

NPOS working fine but after adding EVM to Genesis config in node the NPOS is not working and the staking election failed.

Smart Contracts working fine on the chain.

GenesisConfig {
        system: SystemConfig {
            // Add Wasm runtime to storage.
            code: wasm_binary.to_vec(),
        },
        balances: BalancesConfig {
            // Configure endowed accounts with initial balance of 1 << 60.
            balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
        },
        babe: BabeConfig {
            authorities: vec![],
            epoch_config: Some(nfid_runtime::BABE_GENESIS_EPOCH_CONFIG),
        },
        grandpa: GrandpaConfig { authorities: vec![] },
        session: SessionConfig {
            keys: initial_authorities
                .iter()
                .map(|x| {
                    (
                        x.0.clone(),
                        x.0.clone(),
                        SessionKeys { babe: x.1.clone(), grandpa: x.2.clone() },
                    )
                })
                .collect::<Vec<_>>(),
        },
        staking: StakingConfig {
            validator_count: initial_authorities.len() as u32,
            minimum_validator_count: initial_authorities.len() as u32,
            invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
            slash_reward_fraction: sp_runtime::Perbill::from_percent(10),
            stakers,
            ..Default::default()
        },
        sudo: SudoConfig {
            // Assign network admin rights.
            key: Some(root_key),
        },
        transaction_payment: Default::default(),
        evm: Default::default(),
        ethereum: Default::default(),
        base_fee: Default::default(),
        dynamic_fee: Default::default(),
        node_authorization: NodeAuthorizationConfig {
            nodes: vec![
                (
                    OpaquePeerId(
                        bs58::decode("12D3KooWBmAwcd4PJNJvfV89HwE48nwkRmAgo8Vy3uQEyNNHBox2")
                            .into_vec()
                            .unwrap(),
                    ),
                    endowed_accounts[0].clone(), // Alice
                ),
                (
                    OpaquePeerId(
                        bs58::decode("12D3KooWQYV9dGMFoRzNStwpXztXaBUjtPqi6aU76ZgUriHhKust")
                            .into_vec()
                            .unwrap(),
                    ),
                    endowed_accounts[1].clone(), // Bob
                ),
            ],
        },
    }
4
  • 1
    You need to provide some MVP code example. What do you mean by NPoS? pallet-staking?
    – kianenigma
    Aug 19, 2022 at 6:58
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Aug 19, 2022 at 13:53
  • Sure, NPoS means Nomimated Proof of Stake with pallet-babe and pallet-staking Aug 20, 2022 at 6:08
  • hi @MuhammadZaryabRafique i am also trying to add EVM pallet in NPOS can you tell which branch of substrate you have used to add EVM pallet ??? i am facing dependency erros. Sep 14, 2022 at 5:40

0

Your Answer

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

Browse other questions tagged or ask your own question.