4

I just want to simply add an account in the development config but have no idea how to do it, i tried simply adding the seed in the development_config function but it dosent work, what can i do to add an account names Max for it to show in the runtimeenter image description here

1
  • How did you do that before? Providing more info that I can help you correct your steps. Jun 5 at 13:15

1 Answer 1

3

You are close. You could do something like this:

// 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>("Alice//stash"),
        get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
        hex!("c02563505b8fc10f0acb3e97982d663424d4617baced9bcf51c847bd879ff827").into(),
    ],

You will need to import hex crate:

use hex_literal::hex;

And add it to your Cargo.toml:

hex-literal = "0.4.1"

If needed use subkey to get the Account ID:

subkey inspect 5GQeA6J8XqtX7hvZy5JNyTyzYxfK5UD9tLoUPpa47CNm8dvS
5GQeA6J8XqtX7hvZy5JNyTyzYxfK5UD9tLoUPpa47CNm8dvS
Public Key URI `5GQeA6J8XqtX7hvZy5JNyTyzYxfK5UD9tLoUPpa47CNm8dvS` is account:
  Network ID/Version: substrate
  Public key (hex):   0xc02563505b8fc10f0acb3e97982d663424d4617baced9bcf51c847bd879ff827
  Account ID:         0xc02563505b8fc10f0acb3e97982d663424d4617baced9bcf51c847bd879ff827
  Public key (SS58):  5GQeA6J8XqtX7hvZy5JNyTyzYxfK5UD9tLoUPpa47CNm8dvS
  SS58 Address:       5GQeA6J8XqtX7hvZy5JNyTyzYxfK5UD9tLoUPpa47CNm8dvS

Worth noting, if you're also using PolkadotJs Apps and do not see the account appear. It is because PolkadotJs Apps shows predefined accounts in the UI for development config. More info here:

1

Your Answer

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

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