5

Is it possible to start a local validator with my Solana program already deployed?

Or do I have to do 2 separate commands? One first starting the validator, another for deploying?

1 Answer 1

3

Example scenario: Say you wanted to load the spl stake-pool program and you had its shared-object file saved at fixtures/spl-stake-pool.so.

If you're running tests with anchor then adding:

[[test.genesis]]
address = "SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy"
program = "fixtures/spl_stake_pool.so"

to your Anchor.toml file would load the program under the specified address.

If not then:

solana-test-validator --bpf-program SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy fixtures/spl_stake_pool.so"

would do the same.

Note: The --bpf-program flag also accepts a keypair path as its first argument. So instead of a pubkey like "SPoo1..", you can specify fixtures/address-kp.json and solana-test-validator will retrieve the address from it. The anchor config file should likely allow that also

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.