I'm building a Solana SDK and I have a few integration tests that need SPL Programs that are running against live clusters (mainnet or devnet). However, I'd like to use a local testnet using testcontainers which works fine so far, as I'm running the container passing a few --clone which copy the data I need.

The problem is that one of the tests requires sending a transaction to create a DAO, using the governance program, which doesn't seem to come out of the box in the test validator. As a result, the test fails saying that it attempted to load a program that doesn't exist (this actually means it's not found by bpf loader). A possible fix to this is to checkout the program code (in my specific case I need the tag tags/governance-v2.2.6), run cargo build-bpf and pass the option --bpf-program GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw ./spl_governance.so when I run the test validator. I tried this and it works.

However, I'd like to avoid my workaround and download the .so into a file programatically, and instantiate the solana-test-validator pointing to that file. I know it's possible to download some executable data (from here if you navigate to it's executable data account) in a bin format. I don't know how to proceed from here, is it possible to get .so code from a bin executable? Should I just copy the bin file into my test ledger folder?

Hope the context and problem are clear. Any guidance will be helpful. Thank you!

1 Answer 1


You have a few options.

If you want to dump the *.so for a particular program, you can do:

solana config set -um # be sure you're on mainnet
solana program dump GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw spl_governance.so

Otherwise, you can use the --clone option for programs as well when instantiating your test validator:

solana-test-validator --clone GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw -um
  • --clone GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw copies the account data to the test ledger, but it doesn't load the program into the bpf. solana program dump works great. Thanks!
    – Mr Byte
    Commented Nov 1, 2022 at 8:43
  • ah my bad, that's right, you'll also need to clone BZYjZ2ZbtAawP9WPt5yXszcoMWTvNFFX4AMbnDojtSGL if you want to go that route
    – Jon C
    Commented Nov 1, 2022 at 16:32
  • Would you elaborate more on that? What is BZYjZ2ZbtAawP9WPt5yXszcoMWTvNFFX4AMbnDojtSGL?
    – Mr Byte
    Commented Nov 2, 2022 at 17:31
  • That's the program data account. You'll see it as the "Executable Data Account" at explorer.solana.com/address/…
    – Jon C
    Commented Nov 2, 2022 at 23:22

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.