QubicTypeScript

exchangePublicPeers

Requests the node's known peer list, useful for bootstrapping peer discovery.

Signature

exchangePublicPeers(
  conn: NodeConnection | NodePool,
  options?: { signal?: AbortSignal },
): Promise<ExchangePublicPeers>

Purpose

Requests the node's known peer list. Useful for bootstrapping your own peer discovery.

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

const pool = createNodePool(["node1.qubic.org"])
const { peers } = await exchangePublicPeers(pool)
console.log("Known peers:", peers)

Parameters

NameTypeDescription
connNodeConnection | NodePoolConnection or pool
options.signalAbortSignalOptional. Abort the request early.

Returns

Promise<ExchangePublicPeers>{ peers: string[] }

FieldTypeDescription
peersstring[]IP addresses of known peers reported by the node

On this page