sendTransaction - Solana

This method submits a fully signed transaction to the cluster and returns its first signature. The node forwards the transaction to the current leader without waiting for confirmation.

Parameters

ParameterTypeRequiredDescription
transactionstringYesFully signed transaction, base58 or base64 encoded
configobjectNoConfiguration object controlling preflight and retries

Config Object

FieldTypeRequiredDescription
encodingstringNoEncoding of the transaction string: base58 or base64. Defaults to base58
skipPreflightbooleanNoSkip the preflight simulation and signature verification checks
preflightCommitmentstringNoCommitment used for the preflight simulation. Defaults to finalized
maxRetriesnumberNoMaximum times the node rebroadcasts to the leader
minContextSlotnumberNoMinimum slot at which preflight should be evaluated

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "sendTransaction",
    "params": ["4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT", {"skipPreflight": false, "preflightCommitment": "confirmed", "maxRetries": 3}],
    "id": "getblock.io"
}'

example.js

javascriptconst { Connection } = require('@solana/web3.js');

const connection = new Connection('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', 'confirmed');

const txSignature = await connection.sendRawTransaction(
  signedTransaction.serialize(),
  { skipPreflight: false, maxRetries: 3 }
);

console.log(txSignature);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'sendTransaction',
        'params': ["4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT", {"skipPreflight": false, "preflightCommitment": "confirmed", "maxRetries": 3}],
        'id': 'getblock.io'
    }
)

print(response.json()['result'])

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "sendTransaction",
            "params": ["4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT", {"skipPreflight": false, "preflightCommitment": "confirmed", "maxRetries": 3}],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "5wHu1qwD4kLwYqPmy1uDCgpiJ1qGpVYU3n5aHT6bSWUE1JzcbQCPSDLDPGrFyqmLLzQjLNPTPtRZbNbUJQNMkaWq"
}

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
resultstringBase58-encoded first signature of the submitted transaction

Use Cases

  • Transfer Submission: Broadcast a signed SOL or SPL Token transfer
  • Latency Tuning: Set skipPreflight to true once simulation has already passed
  • Retry Control: Cap node-side rebroadcasts with maxRetries and retry from the client
  • Swap Execution: Submit a Jupiter route transaction built and signed client-side
  • Program Invocation: Send an Anchor instruction bundle to a deployed program

Error Handling

Error CodeMessageDescription
-32602Invalid paramsTransaction cannot be deserialized or the encoding does not match
-32003Transaction signature verification failureOne or more signatures are missing or invalid
-32002Transaction simulation failedPreflight simulation reverted, most often BlockhashNotFound or InsufficientFundsForFee
-32013Transaction signature length mismatchSignature count does not match the message header
-32005Node is unhealthyThe node cannot reach the current leader