10

https://docs.solana.com/developing/clients/jsonrpc-api#getlatestblockhash provides a way to get the latest blockhash and last valid block height for a given commitment.

https://docs.solana.com/developing/clients/jsonrpc-api#isblockhashvalid provides a way to know if a given blockhash is valid.

I'm looking for a way to obtain the last valid block height for a given blockhash. Does this exist?

Edit: to add a little about the use case --

Transactions may have a recent blockhash provided by a wallet. Apps and helper libraries that have only the signature of the transaction need to know if they should continue to retry it or look for confirmation. If there was a way to determine the last valid height for a given hash, this would be easy for them.

2
  • 5
    Gunning for the ‘student’ badge, I see. Aug 15, 2022 at 2:31
  • @steveluscher nooo I actually really need this!
    – Jordan
    Aug 15, 2022 at 15:58

1 Answer 1

3

In the current state, there's no way to figure out the last valid block height for a given blockhash.

Most dapps manage this by tracking the blockhash's context in the app, but this does not help in your case where a wallet provides the blockhash without the slot context.

There's an issue to track potential work on github.

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.