Solana
Bereit, das in der Produktion aufzurufen?
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Solana
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
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.| # | Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
| 1 | config | object | Nein | Options: commitment, minContextSlot. |
| Typ | Beschreibung |
|---|---|
| integer | u64 current block height. |
| Code | Meldung | Ursache |
|---|---|---|
-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.