Overlay Networks

Overlay networks let you broadcast transactions to topic-specific services and query lookup services for data. @bsv/simple wraps the BSV SDK's TopicBroadcaster and LookupResolver into a clean API.

Core Concepts

Concept
Prefix
Description

Topic

tm_

A category of transactions (e.g., tm_payments, tm_tokens)

Lookup Service

ls_

A query endpoint for finding data (e.g., ls_payments)

SHIP

Protocol for advertising topic hosting

SLAP

Protocol for advertising lookup services

Important: Topics must start with tm_ and lookup services must start with ls_. The library enforces these prefixes and throws if they're missing.

Creating an Overlay

import { Overlay } from '@bsv/simple/browser'

const overlay = await Overlay.create({
  topics: ['tm_payments', 'tm_tokens'],
  network: 'mainnet'
})

Configuration

Parameter
Type
Default
Description

topics

string[]

required

Topics to broadcast to (must start with tm_)

network

string

'mainnet'

'mainnet', 'testnet', or 'local'

slapTrackers

string[]

SDK default

Custom SLAP tracker URLs

hostOverrides

Record<string, string[]>

Override hosts for specific topics

additionalHosts

Record<string, string[]>

Add extra hosts for specific topics

Managing Topics

Broadcasting

Submit a pre-built transaction to overlay topics:

Broadcast to Specific Topics

Querying

Raw Query

Get Parsed Outputs

Wallet-Integrated Methods

Advertise SHIP (Topic Hosting)

Tell the network that you host a specific topic at a domain:

Advertise SLAP (Lookup Service)

Tell the network that you provide a lookup service at a domain:

Broadcast Action

Create a transaction and broadcast to overlay in one step:

Double-Spend Retry

Wrap an operation with automatic retry on double-spend:

Advanced: Raw SDK Access

For operations not covered by the simple API:

Complete Example

Last updated