4

I'm trying to call the connection.getLatestBlockhash(...) method in @solana/web3.js (version 1.50.1) on localnet but I keep encountering

Error: failed to get recent blockhash: Error: failed to get latest blockhash: Method not found

Is anyone else encountering this issue? Is this method unavailable on localnet? If it's just a problem with my local network, any known solutions?

1 Answer 1

4

The getLatestBlockhash function is new in Solana version 1.9, see here: https://docs.solana.com/developing/clients/jsonrpc-api#getlatestblockhash

NEW: This method is only available in solana-core v1.9 or newer. Please use getRecentBlockhash for solana-core v1.8

Are you on an earlier version by any chance? If you run solana-test-validator --version it'll tell you which version you have.

If you do have an earlier version you should be able to install the latest with solana-install update.

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.