> ## Documentation Index
> Fetch the complete documentation index at: https://docs.counsel.markets/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction to counsel: XRP Ledger Prediction Markets

> How counsel's parimutuel pools work, why odds are indicative until close, and how the non-custodial on-chain design keeps every bet and payout verifiable.

counsel is an L1-native parimutuel prediction market that runs on the XRP Ledger. There is no bridge, no smart contract, and no database of record. The ledger is the registry, the pool, and the audit trail. The price truth (the native XLS-47 oracle), the money (XRP), and the attribution (SourceTag) are all native ledger primitives, so anyone with access to a ledger node can recompute every split from first principles.

> Take counsel of your pillow.

## How a bet works

You bet by sending a native XRP Payment to a market's pool account. Two tags carry the meaning:

<ParamField path="DestinationTag" type="integer">
  The outcome index you are backing.
</ParamField>

<ParamField path="SourceTag" type="integer">
  counsel's attribution tag, which marks the Payment as a counsel bet.
</ParamField>

You sign that Payment yourself, in your own wallet (Xaman, GemWallet, or Crossmark). counsel constructs the unsigned Payment and returns it; your wallet signs and submits it. counsel never holds, requests, or touches your private key.

## Parimutuel pools

Bettors stake into outcome pools. When the market resolves, the participants on the winning side split the entire pool, including the losing stakes, after a flat 3% protocol fee. There is no order book and no counterparty matching. The pool itself is the market, and the pool is the odds.

The payout formula is exact:

| Symbol | Meaning                                               |
| ------ | ----------------------------------------------------- |
| `T`    | Gross pool, the sum of all stakes across all outcomes |
| `r`    | Fee rate, typically `0.03`                            |
| `W`    | Total staked on the winning outcome                   |
| `sᵢ`   | An individual winning stake                           |

```
N        = T × (1 − r)         net pool after the 3% takeout
payoutᵢ  = floor(sᵢ × N / W)    rounded down to whole XRP drops
dust     = N − Σ payoutᵢ        rounding residue, to operator reserve
```

<Note>
  The fee is taken from the whole gross pool before the split. It is never applied selectively on winners' returns.
</Note>

## Indicative odds and the final line

counsel shows a live tote board. While a market is open, each outcome displays an indicative implied probability and an indicative payout per unit, recomputed in real time as XRP flows in:

* `implied_prob` = `outcome_drops / total_drops`
* `payout_per_unit` = indicative XRP returned per 1 XRP staked if that outcome wins, after the fee

These figures are indicative only. Because counsel is a true parimutuel market and not fixed-odds, every new stake shifts every outcome's odds. The final line is set by the pool state at `bet_cutoff`. An early bettor cannot lock a price seen before close.

## Resolution

Markets resolve in one of two ways, by family.

<CardGroup cols={2}>
  <Card title="Family A: crypto price" icon="bitcoin-sign">
    Resolves automatically against the native XLS-47 price oracle.
  </Card>

  <Card title="Family B: real world" icon="globe">
    Resolves by an operator-proposed outcome, then a bonded dispute window, then a multisig committee finalization.
  </Card>
</CardGroup>

### Voided pools

A pool is voided and fully refunded, with no fee taken, when it cannot resolve cleanly. This covers a one-sided pool (no losing side to split), a market with no winner, a cancelled event, and a stale oracle. In every void case, stakes are returned in full.

## Fully on-chain and verifiable

Every action in counsel's lifecycle leaves an on-chain trace:

* Market definitions are JSON memos on a Payment to the registry account.
* Bets are tagged XRP Payments (`DestinationTag` = outcome index, `SourceTag` = counsel attribution).
* Resolutions are published as memos referencing the oracle value or evidence hash.
* Payouts are committee-multisigned XRP Payments with a payout memo attached.

The application rebuilds its entire state from the ledger. There is no database of record, so anyone can verify a payout split by reading the same transactions.

## Trust model

counsel is custodial-transparent, not trustless. Stakes sit in per-market pool accounts secured by a multisig `SignerList` with the master key disabled. No single key can move funds from a pool: settlement requires a committee threshold of signatures. Everything is on-chain and recomputable, so the custody is transparent and auditable even though it is not fully trustless.

## The canonical developer path

Bots are first-class in counsel. A bot is an ordinary XRPL client: it reads a market, fetches an unsigned bet Payment, signs it with its own key, and submits it. The public API is read-only REST with no API key.

<Steps>
  <Step title="Find a market and outcome">
    `GET /markets` lists open markets and their outcome indices.
  </Step>

  <Step title="Fetch an unsigned bet intent">
    `GET /markets/:id/bet-intent?account=...&outcome=...&amount=...` returns an unsigned XRPL Payment plus the projected odds after your stake.
  </Step>

  <Step title="Sign it in your own wallet">
    Sign the returned Payment with your own key. counsel never sees it.
  </Step>

  <Step title="Submit it to the XRPL">
    Submit the signed Payment. The pool updates and the tote board moves.
  </Step>
</Steps>

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.counsel.markets/markets
  ```

  ```ts counsel-js theme={null}
  import { Counsel } from "counsel-js";

  const counsel = new Counsel({ baseUrl: "https://counsel.markets" });
  const { markets } = await counsel.markets();

  // fetch an unsigned bet intent, sign with your own key, submit
  const hash = await counsel.placeBet(process.env.BOT_SEED, markets[0].id, 0, 5);
  console.log("bet placed:", hash);
  ```
</CodeGroup>

## What you can do

* Bet on markets: open crypto-price and real-world markets at [counsel.markets](https://counsel.markets).
* Copy-trade: mirror a leader's open bets non-custodially. You sign each mirror in your own wallet, sized to your own stake, with projected odds shown before you sign.
* Run bots: the public API returns unsigned bet Payments with projected post-stake odds, and a bot is an ordinary XRPL client.

## Next steps

<CardGroup cols={2}>
  <Card title="How it works" icon="circle-nodes" href="/how-it-works">
    The bet, close, resolve, and payout lifecycle, with oracle and multisig mechanics.
  </Card>

  <Card title="Place a bet" icon="hand-pointer" href="/placing-a-bet">
    Connect a wallet, select an outcome, and submit a bet Payment.
  </Card>

  <Card title="API reference" icon="code" href="/api-reference">
    Read-only REST endpoints for markets, positions, feeds, profiles, and the leaderboard.
  </Card>

  <Card title="counsel-js SDK" icon="cube" href="/sdk/overview">
    Fetch an unsigned intent, sign with your own key, and submit.
  </Card>

  <Card title="Copy trading" icon="copy" href="/guides/copy-trading">
    Mirror a leader's open bets non-custodially, sized to your own stake.
  </Card>

  <Card title="Discord" icon="discord" href="https://discord.gg/gjhUxUgv9r">
    Ask questions and follow development with the counsel community.
  </Card>
</CardGroup>
