1

I am learning substrate and just upgraded to the latest version 3.0. I have a fresh instance of the Substrate node template - using Substrate 3.0 and Frame 2.0 from GitHub.

I have built the library I am starting the node template with ./target/release/node-template --dev --tmp

the node starts fine creates blocks etc all looks fine.

I then go to Polkadot.js.org/app and the usual accounts we are used to seeing are there Alice Bob etc and a few stash accounts.

but all of the accounts have zero balance.

I cannot figure out how to set the account balances to non zero so that I can at least send transactions between accounts and I cannot figure out which Genesis block config is being used in chain_spec.rs as none of the account listings link up with the accounts shown in the polkadot.js app.

I am guessing that the config being used is this one since the accounts match the listing in the Polkadot.js app

The comment says prefunded accounts but I see no code to prefund them and I have no idea how to prefund them. With the previous version of the substrate-note-template the accounts where always just preloaded from the start.

I cannot even figure out which genesis config is being used as the accounts do not balance with any of these.

This is the closest but the Polkadot.js does not show the Charlie_Stash, Dave_Stash, Eve_Stash and Ferdie Stash accounts only the Alice and Bob Stash accounts are shown wherease this config has all Stash accounts for all of them.

pub fn local_testnet_config() -> Result<ChainSpec, String> {
    let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm binary not available".to_string())?;

    Ok(ChainSpec::from_genesis(
        // Name
        "Local Testnet",
        // ID
        "local_testnet",
        ChainType::Local,
        move || testnet_genesis(
            wasm_binary,
            // Initial PoA authorities
            vec![
                authority_keys_from_seed("Alice"),
                authority_keys_from_seed("Bob"),
            ],
            // Sudo account
            get_account_id_from_seed::<sr25519::Public>("Alice"),
            // Pre-funded accounts
            vec![
                get_account_id_from_seed::<sr25519::Public>("Alice"),
                get_account_id_from_seed::<sr25519::Public>("Bob"),
                get_account_id_from_seed::<sr25519::Public>("Charlie"),
                get_account_id_from_seed::<sr25519::Public>("Dave"),
                get_account_id_from_seed::<sr25519::Public>("Eve"),
                get_account_id_from_seed::<sr25519::Public>("Ferdie"),
                get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
                get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
                get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
                get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
                get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
                get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
            ],
            true,
        ),
        // Bootnodes
        vec![],
        // Telemetry
        None,
        // Protocol ID
        None,
        // Properties
        None,
        // Extensions
        None,
    ))
}[![enter image description here][1]][1]
GloryDev
  • 670
  • 5
  • 8
  • 1
    I was not able to reproduce your issue by cloning the template and building from scratch, It can be worth it cleaning your directory with `node-template purge-chain` and trying again. I know you are using `--tmp` flag, but maybe from previous runs... edit: I am assuming you are connecting your js apps to the right node – Alejandro Martínez May 25 '21 at 10:39
  • Alejandro thank you for looking at this. Neither of these worked. I did manage to find a solution on one of the Polkadot Discord groups. It turns out that you have to add this JSON to the Polkadot.JS app in the settings -> Developer. { "AccountInfo": "AccountInfoWithDualRefCount" } – GloryDev May 26 '21 at 12:18
  • 1
    Hi GloryDev, Can you please support our Substrate StackExchange proposal: https://area51.stackexchange.com/proposals/126136 – Shawn Tabrizi Dec 16 '21 at 13:16

1 Answers1

2

Navigate to Polkadot js app's /#/settings/developer. Paste the following custom type JSON in Setting > Developer >

{"AccountInfo": "AccountInfoWithDualRefCount"}

enter image description here

not 0x12
  • 19,360
  • 22
  • 67
  • 133
GloryDev
  • 670
  • 5
  • 8