sendTransaction

Learn sendTransaction use cases, code examples, request parameters, response structure, and tips.

The sendTransaction RPC method in CoinVera submits a signed transaction to the Solana network for processing. This is the primary method used to send payments, execute instructions, interact with smart contracts, and perform any on-chain action.

Once sent, the transaction is forwarded to the leader node for inclusion in a block. The method returns a transaction signature that can be used to monitor confirmation status.


✅ Common Use Cases

  • SOL Transfers Sending SOL from one wallet to another.

  • SPL Token Transfers Sending tokens between token accounts.

  • Smart Contract Calls Invoking on-chain programs with custom instructions.

  • Batch or Multi-instruction Transactions Grouping multiple actions (e.g., transfer + memo) into one atomic transaction.

  • DeFi & DEX Integrations Submitting transactions to liquidity pools, AMMs, lending protocols, and other dApps.


🧾 Request Parameters

[
  encodedTransaction: string,      // Required – base64-encoded signed transaction
  options?: {
    encoding?: string,             // Optional – "base58" or "base64" (default: "base64")
    preflightCommitment?: string,  // Optional – pre-submission simulation ("processed", "confirmed", "finalized")
    skipPreflight?: boolean,       // Optional – skip simulation step (default: false)
    maxRetries?: number,           // Optional – retry count on leader forwarding failure
    minContextSlot?: number        // Optional – minimum slot for node context
  }
]

Key Fields:

  • encodedTransaction (required): The fully signed transaction in base64 format.

  • encoding: Format of the encoded transaction (default is "base64").

  • skipPreflight: If true, skips preflight simulation. Use with caution.

  • preflightCommitment: The level of commitment to simulate the transaction before sending. Recommended: "confirmed".

  • maxRetries: How many times to retry sending if the leader node doesn’t respond.


📦 Response Structure

Returns a base-58 encoded transaction signature if accepted:

{
  "result": "5nqPU3r5evAMY3Q6E3gZHmRMAsi67k1nRxkk2eJyxJKZPFnQvEvMG4oKXKDLfhVzevY5LfkuNqYz2T3uCkvVQUrh"
}
  • Use this signature with getSignatureStatuses, getTransaction, or confirmTransaction to track the transaction.


🧪 Example

Send a Signed Transaction (Base64-encoded)

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sendTransaction",
  "params": [
    "Base64EncodedSignedTransactionHere",
    {
      "preflightCommitment": "confirmed",
      "skipPreflight": false
    }
  ]
}

Code Examples

const fetch = require('node-fetch');

async function sendTransaction(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'sendTransaction',
        "params": [

            "4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT"
     
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

sendTransaction(RPC_URL);

Example Response

{
  "jsonrpc": "2.0",
  "result": "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8rkxwPYPe8cSwE5GzhEgJA2y8fVjDEo6iR6ykBvDxrTQrtpb",
  "id": 1
}

💡 Developer Tips

  • Preflight Simulation Enabled by default, it helps catch errors early—e.g., insufficient funds, missing signatures, or compute budget overruns.

  • Set maxRetries for Resilience Helps handle leader-forwarding issues or temporary network disruptions.

  • Confirm Transaction Use confirmTransaction, getSignatureStatuses, or getTransaction to verify that the transaction was finalized on-chain.

  • Use base64 Encoding Always encode the transaction as base64 unless your RPC explicitly supports base58.

  • Handle Versioned Transactions When working with versioned transactions (e.g., v0), ensure all required address lookup tables are properly included and resolved before sending.


The sendTransaction method is the gateway to executing real actions on Solana. Whether you're transferring SOL, interacting with DeFi protocols, or calling custom programs, this method—backed by CoinVera—ensures reliable and performant transaction submission.

Last updated