Solana
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Solana
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
getBlockHeight returns the current block height of Solana, the Proof-of-History and Proof-of-Stake network whose native token is SOL. Block height counts the blocks that have actually been produced, which is distinct from the slot number: Solana mints a new slot roughly every 400 ms, but skipped slots produce no block, so height always trails the latest slot. The method is most often used to compare against a transaction's lastValidBlockHeight and decide whether that transaction can still land before its recent blockhash expires. Call it against https://solana.therpc.io/YOUR_API_KEY as a JSON-RPC 2.0 POST; the optional config object accepts commitment and minContextSlot.
lastValidBlockHeight to know exactly when that transaction can no longer be confirmed and should be rebuilt with a fresh blockhash.| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | config | object | No | Options: commitment, minContextSlot. |
| Tipo | Descripción |
|---|---|
| integer | u64 current block height. |
| Código | Mensaje | Causa |
|---|---|---|
-32602 | Invalid params | A param is missing, of the wrong type, or malformed (e.g. a non-base58 pubkey or a bad config field). |
-32603 | Internal error | The node hit an internal error serving the request — retry, and reduce the requested range/encoding if it persists. |
commitment that matches how settled you need the value to be: processed for the freshest read, confirmed for a typical app, or finalized when the height must be irreversible.