OSSR
DAPP INTEGRATION GUIDE

Make sBTC transfers
feel gasless.

OSSR lets your users authorize one exact sBTC transfer while an independent relay supplies the STX network fee, signs as sponsor, and broadcasts the completed transaction.

sponsored-transfer.ts
const quote = await requestQuote({
  relayUrl, origin, recipient,
  amountSats: "1000",
  maxSponsorFeeSats: "20",
});

const call = prepareWalletContractCall({
  quote: quote.quote,
  recipient, amountSats: "1000",
});

const signed = await request(
  "stx_callContract",
  { ...call, network: "testnet" }
);
THE INTEGRATION FLOW

One user approval. Six verifiable steps.

01

Load trusted relay metadata

Fetch GET /v1/info. Pin or validate the relay ID, testnet network, sponsor principal, adapter contract, sBTC contract, limits, and active quote public key.
02

Request an exact quote

Send the origin, recipient, amount in sats, maximum acceptable sponsor fee, and optional memo to POST /v1/quotes. Display the returned fee, expiry, and maximum token outflow.
03

Build the adapter call

Construct the allowlisted sponsored-transfer call and an exact-deny sBTC post-condition for amount + sponsorFee. Do not permit arbitrary contract calls.
04

Ask the wallet to approve

Use a compatible wallet’s stx_callContract request with sponsored: true. The wallet signs only the origin authorization and returns raw transaction bytes without broadcasting.
05

Submit to the quoted relay

POST the quote ID, raw origin-signed transaction, and origin principal to /v1/sponsorships. The relay validates, simulates, adds its sponsor authorization, and broadcasts.
06

Track the outcome

Poll the returned transaction ID until a terminal status. Treat chain success as completion; surface post-condition aborts, contract errors, dropped transactions, and quote expiry distinctly.
RELAY API

A deliberately narrow surface.

Version 1 is testnet-only and supports the reviewed sBTC transfer adapter. Public deployments must use HTTPS and an explicit browser-origin allowlist.

GET
/v1/info

Read relay identity, contracts, limits, and quote keys.

POST
/v1/quotes

Request a signed, expiring offer for one exact transfer.

POST
/v1/sponsorships

Submit the origin-signed transaction for sponsorship and broadcast.

GET
/v1/sponsorships/{txid}

Track relay and observed Stacks chain status.

SECURITY INVARIANTS

Keep the wallet in control.

Never handle keys

Use an installed wallet. Your dapp must never request or transmit seed phrases or private keys.

Bind the exact intent

Amount, recipient, sponsor fee, adapter, expiry, and quote ID must match the signed quote.

Fail closed

Reject unknown networks, contracts, quote keys, protocol versions, and malformed relay responses.

Submit once

Send an origin-signed transaction to only its quoted relay and use the quote ID as the idempotency boundary.

Build against the reference flow.

The current repository contains working quote, wallet-call, submission, and status helpers. Treat them as reference implementation code while the public SDK and API remain draft.