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
| Name | Type | Description |
|---|---|---|
conn | NodeConnection | NodePool | Connection or pool |
txBytes | Uint8Array | Signed transaction bytes (not base64-encoded) |
options.signal | AbortSignal | Optional |
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.