agorix
AirdropMarketsCollectionsLeaderboardActivity
Agorix · Decentralized Marketplace
Independent · Resilient · Community-Run

A cross-chain marketplace, run by the community.

Discover, list, and trade across Bitcoin, Ethereum, and Solana on an open, community-run network.

Marketplace
CollectionsMarketsLeaderboardActivity
Network
GovernanceExplorerAirdropDocs
Account
ProfileSettings
Legal
Terms of ServicePrivacy PolicyYour Privacy Choices
agorix.io — Lasting Access
CID: 0xA60R1X · v0.1
AirdropMarketsCollections
D
Protocol Docs
Bitcoin & OrdinalsEthereum & L2sSolanaSettlement Flows
Docs/Multi-Chain/Bitcoin & Ordinals
Multi-Chain

Bitcoin & Ordinals

Non-custodial ordinal trading via PSBT shard distribution. 3-of-4 threshold Shamir secret sharing over GF(256). No private key storage anywhere.

#Bitcoin & Ordinals

The Bitcoin marketplace enables non-custodial trading of ordinal inscriptions using PSBTs (Partially Signed Bitcoin Transactions) with threshold secret sharing. Nobody ever holds a seller's private key. Not us, not the nodes, nobody.

#PSBT Signing: SIGHASH_SINGLE|ANYONECANPAY

The seller signs the PSBT with SIGHASH_SINGLE|ANYONECANPAY (flag byte 0x83). This signature type commits to exactly one input and one output, allowing the buyer to attach additional inputs (their payment UTXOs) and outputs (change) without invalidating the seller's signature. The ANYONECANPAY flag (0x80) is critical: it means the seller only signs their own input, giving the buyer permission to fund the transaction however they want.

PSBT validation enforces three hard rules:

  • Exactly one ordinal input. The PSBT must contain a single input referencing the ordinal UTXO.
  • ANYONECANPAY flag. The sighash byte must have bit 7 set (0x80).
  • SIGHASH_SINGLE. The sighash type must be 0x03, binding one input to one output.

Any PSBT that fails these checks gets rejected at submission time. No exceptions.

#Shamir Secret Sharing over GF(256)

The encryption key protecting the PSBT is split using Shamir's Secret Sharing over the Galois Field GF(256). This means each byte of the key is independently split into shares using polynomial interpolation over a finite field of 256 elements:

  • Random AES-256-GCM key. A 32-byte cryptographically random key is generated.
  • Encrypt PSBT. The seller-signed PSBT template gets encrypted with AES-256-GCM (authenticated encryption, prevents tampering).
  • Split key 3-of-4. The 32-byte AES key is split into 4 shares with a threshold of 3 using degree-2 polynomials over GF(256). Each share is a 32-byte blob (one field element per key byte).
  • Distribute shares. Each of the 4 shares goes to a different node in the assigned cohort.

Reconstruction requires any 3 of the 4 shares. Lagrange interpolation over GF(256) recovers each byte of the original AES key. With only 2 shares, an attacker has zero information about the key (information-theoretic security).

#Distribution to Node Cohort

Shard distribution targets a cohort of 4 nodes selected deterministically from the active node set. The distribution process has single-retry resilience built in:

  • Primary attempt. All 4 shards are sent to their target nodes in parallel.
  • Retry on failure. If any shard placement fails, the system retries up to 5 times with exponential backoff.
  • Fallback node. If a target node is persistently unreachable, the shard routes to a backup node from the standby pool.
  • Minimum coverage. Distribution is only considered successful when at least 3 of 4 shards are confirmed placed.

Nodes store shards in their local database, encrypted at rest. Each shard is tagged with the listing ID, cohort assignment epoch, and a monotonic sequence number for rebalancing.

#Reveal Challenge Protocol

When a buyer wants to reconstruct the PSBT, they must complete a reveal challenge with each shard-holding node:

  • Ed25519 signed. Every challenge request is signed with the buyer's Ed25519 keypair. The node verifies the signature before responding.
  • Unique nonce. Each challenge includes a cryptographically random nonce tied to the specific order. This prevents replay across orders.
  • TTL 30 seconds. Challenge responses expire after 30 seconds. If the buyer doesn't collect enough shards within the window, they must restart.
  • ID deduplication. Each order ID can only trigger one active reveal session per shard node. Duplicate requests within the TTL window return the same challenge (idempotent), preventing race conditions where multiple reveal attempts could leak information.

The reveal flow:

  • Buyer sends a signed reveal request with order ID and nonce to each shard node.
  • Node verifies signature, checks order validity, and returns the shard (encrypted with the challenge nonce as additional authenticated data).
  • Buyer collects 3+ shards within the 30-second window.
  • Buyer reconstructs the AES key via Lagrange interpolation.
  • Buyer decrypts the PSBT, adds their payment inputs, and broadcasts.

#Rebalancing on Node Set Changes

When the active node set changes (nodes join, leave, or get evicted), shard coverage must be maintained:

  • Coverage check. After every membership change, the protocol evaluates shard coverage for all active listings.
  • Redistribution. If a listing drops below 3-of-4 coverage, the remaining shard holders collaborate to generate a replacement shard for a new node. This uses the existing shares to evaluate the polynomial at a new x-coordinate without ever reconstructing the secret.
  • Epoch tagging. Redistributed shards carry the new epoch number, so stale shards from departed nodes cannot be mixed with current shards.

#Coverage Tracking

The network maintains a coverage map tracking which nodes hold shards for which listings:

  • Each node reports its shard inventory during heartbeat.
  • The coverage map is gossip-replicated across all nodes.
  • Listings with coverage below the threshold trigger automatic rebalancing.
  • The explorer UI shows real-time coverage status for every active listing.

#Proof-of-Access for Bitcoin

Bitcoin nodes get 5 PoA challenges (the most of any chain) because they need to prove access to two separate systems:

bitcoind challenges (3):

  • Block header at a random height (100-1000 blocks back)
  • Transaction details for a random txid from a recent block
  • UTXO set membership query for a known unspent output

ord indexer challenges (2):

  • Inscription content lookup by inscription ID
  • Ordinal transfer history for a specific sat range

Challenges query historical state (100 to 1000 blocks back) to verify real-time RPC access. Canned responses won't work because the challenge heights are unpredictable.

#Race Condition Protection

We had a critical race condition bug early on with shard distribution. It's now locked down with four interlocking safeguards:

  • Atomic distribution. All 4 shards must be confirmed distributed before checkout is enabled for the listing. The listing transitions from SHARD_DISTRIBUTING to ACTIVE only after confirmation.
  • Retry logic. 5 attempts with exponential backoff (100ms, 200ms, 400ms, 800ms, 1600ms) for each shard placement.
  • Coverage validation. Minimum 3-of-4 shard coverage is verified before reconstruction is allowed. The reveal endpoint checks the coverage map before issuing any challenge.
  • Per-order reveal nonce. Each order gets a unique nonce that is committed at order creation time. This prevents cross-order exploitation where a reveal session for order A could be hijacked to reconstruct shards for order B.

#Listing Policy

Each Bitcoin listing includes cryptographically bound policy fields:

typescript
interface BtcSale {
  assetOutpoint: string;    // The ordinal UTXO (txid:vout)
  priceSats: number;        // Price in satoshis
  sellerAddress: string;    // Seller's receiving address
  royaltyBps: number;       // Creator royalty (basis points)
  expiresAt: number;        // Listing expiration (unix ms)
  collectionId?: string;    // Optional collection binding
}

#Security Summary

  • Non-custodial. No entity holds the complete asset at any point.
  • Threshold security. Compromising 1 or 2 nodes reveals zero information about the key (information-theoretic, not just computational).
  • Forward secrecy. Each order uses a unique reveal nonce with a 30-second TTL.
  • Byzantine tolerance. Works as long as 3 of 4 shard holders are honest.
  • Rebalancing. Node departures trigger automatic shard redistribution without key reconstruction.
  • Authenticated encryption. AES-256-GCM prevents tampering with encrypted PSBTs.
PreviousReward Pool and EpochsNext Ethereum & L2s

On this page

  • Bitcoin & Ordinals
  • PSBT Signing: SIGHASHSINGLE|ANYONECANPAY
  • Shamir Secret Sharing over GF(256)
  • Distribution to Node Cohort
  • Reveal Challenge Protocol
  • Rebalancing on Node Set Changes
  • Coverage Tracking
  • Proof-of-Access for Bitcoin
  • Race Condition Protection
  • Listing Policy
  • Security Summary