raresats.net API
Guides View as Markdown

Affiliates

An affiliate is paid half of the platform fee of the purchases it refers, in the purchase transaction itself, on chain, as it confirms. There is no account and no sign-up: any bitcoin address of the market's network (Taproot, SegWit, nested SegWit or legacy) is an affiliate, except the platform's fee address. Put it in a referral link and share it; the site's /affiliates page builds the link for you.

  • https://raresats.net/?ref=<your address>: any page of the site takes ?ref=.
  • https://raresats.net/r/<your address>: a short form, to the home page.

The server remembers the referrer (any usable address, never the fee address) in a first-party cookie, rs_ref=<address> (Path=/, SameSite=Lax, Secure), for 24 hours (affiliate_cookie_seconds in GET /api/market/config), and redirects to the same page without the referral, so the visitor never sees it in the address bar. The last link followed wins: a newer referral replaces yours. When the buyer prepares a purchase, the server reads the cookie.

From the API #

A client of the API names the affiliate directly with the optional affiliate field of Prepare a purchase. It wins over the cookie.

Request
{
  "listing_ids": ["1031931af1592e1c"],
  "buyer": { "payment_address": "…", "payment_public_key": "…", "ordinals_address": "…" },
  "fee_rate": 4,
  "affiliate": "bc1p4qhjn9zdvkux4e44uhx8tc55attvtyu358kutcqkudyccelu0was9fqzwh"
}

The split #

The buyer's platform fee is 2.5% of the prices (at least 546 sats), the same with or without a referrer: there is no discount. With an applied referral it is paid as two outputs instead of one:

OutputPays
2k+1platform_share to the fee address
2k+2affiliate_fee to the affiliate: floor(fee × affiliate_share_bps / 10000), half by default

Everything else in the transaction layout is unchanged: the sellers' signed pairs keep their indexes, and the marker stays last. The summary of prepare says what happened:

affiliate_statusMeaning
noneNo referrer.
appliedPaid: affiliate_fee sats to affiliate_address.
below_minimumEach part must be at least 546 sats (and above its script's dust limit), so a fee under 1,092 sats (prices under about 44,000 sats) is not split: the platform keeps it.
ignored_selfA self-referral; affiliate_reason says which (below).
invalidNot a usable address of the network, or the fee address itself. Never a reason to refuse the purchase.
summary (excerpt)
{
  "prices": 60546,
  "platform_fee": 1514,
  "platform_share": 757,
  "affiliate_fee": 757,
  "affiliate_address": "bc1p4qhjn9zdvkux4e44uhx8tc55attvtyu358kutcqkudyccelu0was9fqzwh",
  "affiliate_status": "applied",
  "affiliate_reason": null,
  "affiliate_share_bps": 5000
}

A purchase is finalized only under the terms it was prepared with: if they change in between, submit answers 409 config_changed.

Self-referral #

Self-referrals are not paid. A referral is ignored_self when:

affiliate_reasonThe check
same_addressThe referrer is the buyer's payment or ordinals address.
affiliate_walletThe buyer's address is one of the wallet addresses recorded when the affiliate registered (only for an address that used the optional registration).
linked_fundsThe buyer's coins chosen for the purchase came from a transaction that spent from the affiliate's address (or its registering wallet's, when it registered), or the affiliate's unspent coins came from the buyer's.
uncheckedThat check could not finish in time (it reads a handful of transactions): no split, rather than a split it could not check.
sellerThe referrer is a seller's address or payout in the purchase.

What cannot be detected: one person using two wallets that never share an address and never exchange coins looks like two unrelated people on chain.

Your earnings #

GET /api/market/affiliates/{address} gives your totals (confirmed and pending earnings, volume) and your newest referred purchases: Get an affiliate. Sold events in the activity name the affiliate they paid. The site's /affiliates page builds your link and shows the same.

Registration (optional) #

Registering is no longer needed and pays nothing more. Register an affiliate still works, for clients written when it was required: the wallet addresses it records only ever count as the affiliate's own wallet (affiliate_wallet above).