Solana
Solana
Solana
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Submitting a transaction to Solana is never a single step. When sendTransaction returns a signature it means only that https://solana.therpc.io/YOUR_API_KEY accepted the bytes and forwarded them to the leader — not that the transaction landed in a block or succeeded. Acceptance and settlement are two distinct phases, and treating the returned signature as proof of success is the most common way developers lose money or ship double-spends. This guide walks through a send-and-confirm loop that holds up under network congestion: simulate first, attach a priority fee, submit, then poll the signature's status until it reaches your target commitment or the blockhash expires.
getLatestBlockhash and keep both the blockhash and the lastValidBlockHeight it returns — the latter is the expiry deadline you will check against later.simulateTransaction to catch program errors before paying any fee and to size the compute units the transaction will actually consume.getRecentPrioritizationFees and attach a compute-unit price so your transaction competes for block space when the cluster is busy.sendTransaction. The signature you get back means accepted for forwarding — never confirmed.getSignatureStatuses for that signature, or subscribe once with signatureSubscribe over WebSocket, until it reaches confirmed or finalized.getBlockHeight passes the lastValidBlockHeight you saved, the blockhash has expired and the transaction can never land — stop retrying and rebuild with a new blockhash.sendTransaction as a receipt, not a result. Poll getSignatureStatuses (or use signatureSubscribe) every step; never assume acceptance equals confirmation.getRecentPrioritizationFees so your transaction is picked up rather than dropped.base64 and pair sendTransaction with a matching maxRetries so a transient drop is re-broadcast while the blockhash is still valid.