Page 1 of 1

Offline signing on solana online rpc submission

Posted: Sun Mar 15, 2026 1:48 am
by aran
Prepare online a signature that remains live for 60-90 seconds:

prepare.sh (online)

Code: Select all

RPC_URL="https://api.devnet.solana.com"
BLOCKHASH=$(curl -s -X POST $RPC_URL -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0", "id": 1,
  "method": "getLatestBlockhash",
  "params": [{"commitment": "finalized"}]
}' | jq -r '.result.value.blockhash')

echo "Blockhash: $BLOCKHASH"
solana-cli software needed. (offline sign)

sign.sh

Code: Select all

RECIPIENT="GKvqsuNcnwWqPzzuhLmGi4rzzh55FhJtGizkhHaEJqiV"  # example pubkey
AMOUNT_LAMPORTS=100000000  # 0.1 SOL

solana transfer $RECIPIENT 0.1 \
  --blockhash $BLOCKHASH \
  --from ~/my-wallet.json \
  --fee-payer ~/my-wallet.json \
  --output-file signed-tx-base58.txt \
  --url none
  

Online submission with curl

Code: Select all

curl -s -X POST $RPC_URL \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "sendTransaction",
    "params": [
      "PASTE_YOUR_FULL_BASE58_SIGNED_TX_HERE",
      {
        "skipPreflight": false,
        "preflightCommitment": "confirmed",
        "maxRetries": 5
      }
    ]
  }' | jq
  
Verify transaction with response signature

Code: Select all

curl -s -X POST $RPC_URL -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0", "id": 1,
  "method": "getSignatureStatuses",
  "params": [["YOUR_SIGNATURE_FROM_RESPONSE"], {"searchTransactionHistory": true}]
}' | jq