ZeroCopyZeroCopy
API reference

sendTransaction

Submit one signed transaction.

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sendTransaction",
  "params": ["SIGNED_TRANSACTION", { "encoding": "base64" }]
}

Params

params holds one or two elements.

PositionTypeContent
0stringOne fully signed wire transaction, encoded as specified by options.encoding.
1object, optionalOptions, below.

Options

FieldTypeDefaultMeaning
encodingstring"base58""base58" or "base64". Any other value is refused as malformed, problem unknown_encoding.
skipPreflightbooleantruefalse simulates the transaction before sending it. Solana RPC defaults to false; SWQoS does not.
preflightCommitmentstring"finalized""processed", "confirmed" or "finalized". Read only when skipPreflight is false.
minContextSlotintegernonePassed to the simulation. Read only when skipPreflight is false.
maxRetriesintegernoneAccepted and ignored. SWQoS does not periodically resubmit.
tipinteger, lamportsnoneA declared tip. Used only when the transaction's own tip is below your minimum and your key may declare tips.

Fields not listed are ignored. A listed field of the wrong type is refused as invalid_request, problem invalid_options.

Size limits

EncodingLongest stringLargest transaction
base581,683 characters1,232 bytes, any version
base64, legacy and v01,644 characters1,232 bytes
base64, v15,464 characters4,096 bytes

A v1 transaction over 1,232 bytes needs base64 here, or raw bytes through /binary, QUIC or the agent's IPC. Transactions covers formats and the checks SWQoS makes.

Result

The base58 encoding of the transaction's first signature, as a string, with HTTP 200.

Result shape
{"jsonrpc":"2.0","result":"BASE58_SIGNATURE","id":1}

A result acknowledges acceptance, not landing. Confirm the signature with your Solana RPC provider. A duplicate can return the same result without being sent again.

Submission requirements

The transaction must be fully signed, meet the size limits and satisfy your key's tip requirement. Each submission counts against the send rate.

Errors

ReasonHTTPCodeWhen
unauthorized401-32000The key is missing, unknown or revoked.
invalid_request200see codesThe request is not a valid sendTransaction call. problem names the cause.
malformed200-32602The string does not decode to a transaction. problem names the cause.
too_large200-32602Over a size limit. limit and, when known, size are in bytes.
unsigned200-32602The first signature is all zeros.
signature_count200-32602The signatures do not match the number the message requires.
payment_required402-32003The key is suspended until its overdue invoice is paid.
rate_limited429-32001Over the key's send rate, with per_second and retry_after_ms; or the same signature is being sent right now, without numbers.
missing_tip200-32602The tip is below your minimum and no usable declaration covers it.
credit_exhausted200-32602Credit is unavailable for this declared-tip submission.
not_ready503-32603waiting_for is tip_vaults, declared_tips or leader_route.
simulation_failed200-32002The preflight simulation returned an error. Solana's fields are in data.
preflight_unavailable503-32603The simulation could not run within 150 ms, or the node was behind.
overloaded503-32603The region is temporarily busy.
forward_failed503-32603The transaction could not be dispatched.
internal503-32603An internal error.

Examples

Each example sends a transaction you signed. These calls go to SWQoS; read the blockhash you sign with from your own Solana RPC provider.

curl
curl -sS "https://sol.zerocopy.sh" \
  -H "x-api-key: $SWQOS_API_KEY" \
  -H 'content-type: application/json' \
  --data "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"sendTransaction\",\"params\":[\"$(base64 -w0 signed-tx.bin)\",{\"encoding\":\"base64\"}]}"

With @solana/kit, pass encoding: 'base64'; Kit's wire helper produces base64 and SWQoS defaults to base58. Kit reports refusals with limited detail, as Solana client libraries explains.

send-with-kit.ts
import { readFile } from 'node:fs/promises'
import {
  createSolanaRpc,
  getBase64EncodedWireTransaction,
  getTransactionDecoder,
} from '@solana/kit'
import { required, url } from './swqos.ts'

// A fully signed transaction in wire format, from your signing flow.
const transaction = getTransactionDecoder().decode(await readFile(required('SIGNED_TX_FILE')))

const swqos = createSolanaRpc(url, { headers: { 'x-api-key': required('SWQOS_API_KEY') } })
const signature = await swqos
  .sendTransaction(getBase64EncodedWireTransaction(transaction), { encoding: 'base64' })
  .send()
console.log(signature)

With the client helper, a refusal keeps its reason and fields. This call asks for a preflight simulation at confirmed commitment.

send-with-preflight.ts
import { readFile } from 'node:fs/promises'
import { call, required, SwqosError } from './swqos.ts'

const transaction = (await readFile(required('SIGNED_TX_FILE'))).toString('base64')

try {
  const signature = await call<string>('sendTransaction', [
    transaction,
    { encoding: 'base64', skipPreflight: false, preflightCommitment: 'confirmed' },
  ])
  console.log('accepted', signature)
} catch (error) {
  if (!(error instanceof SwqosError) || !error.rejection) throw error
  const { reason, retryable, message } = error.rejection
  console.error(error.status, reason, retryable, message)
  if (reason === 'simulation_failed') console.error(error.rejection.logs)
}

A key with declared tips enabled can declare the tip instead of carrying it. The tip value is in lamports.

send-declared.ts
import { readFile } from 'node:fs/promises'
import { call, required } from './swqos.ts'

const transaction = (await readFile(required('SIGNED_TX_FILE'))).toString('base64')
const tip = Number(required('DECLARED_TIP_LAMPORTS'))
if (!Number.isSafeInteger(tip) || tip <= 0) throw new Error('tip must be a positive safe integer')
const signature = await call<string>('sendTransaction', [
  transaction,
  { encoding: 'base64', tip },
])
console.log(signature)

On this page