2

I go through all functions in the API, but I didn't find how can I obtain a block slot number by block hash via Web3js.

2 Answers 2

2

There's no great way to do it unfortunately. The only possibility is to query the recent blockhashes sysvar account and see where yours falls on the list. It only maintains the last 150 blockhashes though.

Here's the sysvar in the explorer: https://explorer.solana.com/address/SysvarRecentB1ockHashes11111111111111111111/blockhashes

0

It might be useful to know that getLatestBlockHash returns both the latest blockhash and the slot for that blockhash.

This can be useful to track the number of slots between when a transaction is built (using latest blockhash) and when it lands on chain.

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.