2

I've been trying to deploy an Anchor program on devnet but it seems to be stuck in the process, and then gives the following error after a while,

$ anchor deploy --provider.cluster d

Error: Custom: Invalid blockhash
There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }.

Seems like its timing out, and could be devnet issue but the Explorer seems to show that devnet is working fine. I'm also able to deploy locally easily on solana-test-validator, so it shouldn't be an issue with the program itself right?

1
  • Very often it's the node (invalid blockhash) and you just need one that's not lagging solana.com/rpc
    – Ake
    Commented Dec 28, 2023 at 1:29

4 Answers 4

2

Devnet acts that way sometimes. Sometimes there's too many requests and if your network connection isn't fast enough it times out. I just use solana playground to deploy to devnet now. It's more convenient. https://beta.solpg.io.

  1. Import your solana cli wallet from keypair.json on your local environment. The playground wallet is located on the top right.
  2. Click on the 2nd icon on the top left and import your program keypair and .so file from the /target/deploy folder.
  3. Deploy.
1

In your project's root directory, there is an Anchor.toml file.

Within that file, there is a [provider] section.

[provider]
cluster = "devnet"
wallet = "~/.config/solana/id.json"

The cluster = "xyz" line needs to point to the same cluster that you are trying to deploy to.

There are four possible values: localnet, devnet, testnet and mainnet.

So when trying to deploy to devnet, make sure you have cluster = "devnet" in the [provider] section of your Anchor.toml.

0

Update your Anchor and Solana CLI.

For Solana:

sh -c "$(curl -sSfL https://release.solana.com/v1.10.32/install)"

For Anchor:

cargo install --git https://github.com/coral-xyz/anchor avm --locked --force

Update your Anchor.toml file accordingly with the new versions.

2
  • I updated them, but I'm not sure what you meant to update in Anchor.toml. I tried deploying again after updating the CLIs, but still same issue.
    – sayantank
    Commented Aug 13, 2022 at 15:28
  • The Anchor.toml is in your project folder (together with folders named ‘program’, ‘test’, etcetera. In this Anchor.toml file you need to change the versions to the version of Anchor and Solana that you just updated.
    – Nelis.sol
    Commented Aug 13, 2022 at 18:50
-1

Use a custom RPC , such as https://devnet.genesysgo.net the default public ones aren't suitable for that.

2
  • Doesn't seem to make a difference :(
    – sayantank
    Commented Aug 13, 2022 at 15:28
  • Need to put it in cluster="https://devnet.genesysgo.net" inside Anchor.toml.
    – Ohad Dahan
    Commented Aug 13, 2022 at 19:47

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.