Solana
هل أنت مستعد لاستدعاء هذا في الإنتاج؟
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
Solana
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
getBlockTime returns the estimated production time of a slot on Solana, the Proof-of-History and Proof-of-Stake chain whose native token is SOL. The value is an i64 Unix timestamp (seconds) derived from the stake-weighted timestamps that validators attach when they vote, so it reflects roughly when the block was produced rather than an exact wall clock. Since Solana itself orders events by slot rather than by time, this method is how you map a slot back to a human-readable moment. It returns null when the node cannot determine a time for the slot. Call it against https://solana.therpc.io/YOUR_API_KEY as a JSON-RPC 2.0 POST passing the slot as the single positional param.
| # | الاسم | النوع | مطلوب | الوصف |
|---|---|---|---|---|
| 1 | slot | integer | نعم | Slot number to read the time for. |
| النوع | الوصف |
|---|---|
| integer | i64 Unix timestamp of the block, or null if unavailable. |
| الكود | الرسالة | السبب |
|---|---|---|
-32602 | Invalid params | A param is missing, of the wrong type, or malformed (e.g. a non-base58 pubkey or a bad config field). |
-32004 | Block not available for slot | The slot is not in this node's ledger (purged, skipped, or behind first available block). Use an archival endpoint for deep history. |
-32603 | Internal error | The node hit an internal error serving the request — retry, and reduce the requested range/encoding if it persists. |
null for slots the node cannot time, such as skipped or purged slots. Always handle the null case instead of assuming a number comes back.