1

I am trying to start my own development cluster and would like to stake additional nodes during genesis. I need to use the flag --primordial-accounts-file <FILENAME> but need to know the proper syntax to separate the identity account and balance of the accounts I need to add.

Is there a more in-depth help file description besides solana-genesis --primordial-accounts-file <FILENAME> --help? The location of pubkey for primordial accounts and balance

I can get my bootstrap validator to start voting and slots are confirming but I can't get the bootstrap validator to process transactions (like transfer or airdrop) the signature is shown but never finalized.

I am hoping that is I can get my second remote node staked in genesis it will allow the cluster to process transactions.

4
  • Thanks @Jon C, do you know what the executable and data fields are for?
    – T3chie
    Commented Apr 26, 2023 at 1:08
  • I had gotten this far from trial and error: val_accounts: owner: "<stake acct pubkey>" balance: 500000000 withdrawer: "<withdraw auth pubkey>" But it was throwing an error wanting data Can you help me decipher that a bit more? Withdrawer must be wrong...and what would executable mean in this context?
    – T3chie
    Commented Apr 26, 2023 at 1:12
  • @jon-c would you know why a local cluster would process slots but not finalize transactions? I can see the slots moving and have a remote node syncing the chain as well. I can initiate airdrop or transfer but it shows me the signature and never finalizes the tx...
    – T3chie
    Commented Apr 26, 2023 at 2:56
  • 1
    Please comment on my answer next time, since I don't get notifications here! "Executable" is whether the account is a program, and "data" is the data in the account, in base-64. If it's a stake account, you'll need to encode the stake account information as base-64. You can get some example account data by running solana account --output json <ACCOUNT_ADDRESS>
    – Jon C
    Commented Jun 2, 2023 at 23:19

1 Answer 1

1

It's unfortunately undocumented, but looking at the code, you need to create a Hashmap<Pubkey, Base64Account>, where account data is a base-64 encoded string, and then dump it to yaml, ie:

        let mut genesis_accounts = HashMap::new();
        genesis_accounts.insert(
            solana_sdk::pubkey::new_rand().to_string(),
            Base64Account {
                owner: solana_sdk::pubkey::new_rand().to_string(),
                balance: 2,
                executable: false,
                data: String::from("aGVsbG8="),
            },
        );
        genesis_accounts.insert(
            solana_sdk::pubkey::new_rand().to_string(),
            Base64Account {
                owner: solana_sdk::pubkey::new_rand().to_string(),
                balance: 1,
                executable: true,
                data: String::from("aGVsbG8gd29ybGQ="),
            },
        );
        genesis_accounts.insert(
            solana_sdk::pubkey::new_rand().to_string(),
            Base64Account {
                owner: solana_sdk::pubkey::new_rand().to_string(),
                balance: 3,
                executable: true,
                data: String::from("bWUgaGVsbG8gdG8gd29ybGQ="),
            },
        );

        let serialized = serde_yaml::to_string(&genesis_accounts).unwrap();
        let path = Path::new("test_append_primordial_accounts_to_genesis.yml");
        let mut file = File::create(path).unwrap();
        file.write_all(b"---\n").unwrap();
        file.write_all(&serialized.into_bytes()).unwrap();

This was lovingly copied from one of the solana-genesis tests https://github.com/solana-labs/solana/blob/cc6c4540766d595a3720e39346b4500f2e2d982c/genesis/src/main.rs#L713

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.