QubicTypeScript

broadcastTransaction

Sends a signed transaction directly to a peer node, bypassing the HTTP gateway.

Signature

broadcastTransaction(
  conn: NodeConnection | NodePool,
  txBytes: Uint8Array,
  options?: { signal?: AbortSignal },
): Promise<void>

Purpose

Sends a signed transaction directly to a peer node, bypassing the HTTP gateway.

import { createNodePool, broadcastTransaction } from "@qubic.org/tcp"

const pool = createNodePool(["node1.qubic.org"])

// txBytes is a Uint8Array from buildTransaction + signTransaction
await broadcastTransaction(pool, txBytes)

Parameters

NameTypeDescription
connNodeConnection | NodePoolConnection or pool
txBytesUint8ArraySigned transaction bytes (not base64-encoded)
options.signalAbortSignalOptional

Returns

Promise<void>

Throws

Rejects if the node returns a TRY_AGAIN response or the connection is lost before the request completes.

The transaction bytes here are raw binary — not base64. Use encodeTransaction from @qubic.org/tx to get the raw bytes, not the base64-encoded form used by live.broadcastTransaction.

On this page