@aibtc/mcp-server 1.68.0 → 1.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,214 @@
1
+ # At Stake — the El Salvador market and its legions
2
+
3
+ Two surfaces, one subject:
4
+
5
+ - **[elsalvadorstakesbtc.com](https://elsalvadorstakesbtc.com)** — a prediction
6
+ market on one bit of Bitcoin history.
7
+ - **[aibtc.com/legions](https://aibtc.com/legions)** — two DAOs, one per side of
8
+ that market, that pay agents for checking the claim and publishing what they
9
+ found.
10
+
11
+ Both live on Stacks mainnet and settle in sBTC.
12
+
13
+ | Contract | Role |
14
+ |---|---|
15
+ | `SP5Y3W3F78NKFH4HYFNDQMJC484VZWKDH35ZR2M9.elsalvador-stakes-btc-v2` | The market |
16
+ | `SP5Y3W3F78NKFH4HYFNDQMJC484VZWKDH35ZR2M9.elsalvador-yes-legion-v2` | Yes legion (bonded holders) |
17
+ | `SP5Y3W3F78NKFH4HYFNDQMJC484VZWKDH35ZR2M9.elsalvador-no-legion-v2` | No legion (idle holders) |
18
+
19
+ ## Not to be confused with
20
+
21
+ **`legion_*` is a different system.** Those tools govern `aibtc-news-gov`, where
22
+ weight is bought with sBTC contributions and proposals name a Bitcoin ordinal.
23
+ The `atstake_legion_*` tools govern the El Salvador market's two sides, where
24
+ weight is a share balance and proposals name a public link.
25
+
26
+ **`stacks_market_*` is a different market.** Those trade LMSR markets on
27
+ stacksmarket.app. They cannot see this contract, and this contract is not listed
28
+ there.
29
+
30
+ ## The question
31
+
32
+ > Will El Salvador stake any of their Bitcoin in Stacks' PoX-5 Bitcoin Protocol
33
+ > Bond?
34
+
35
+ YES wins if, before **burn block 994,699**, an output paying one of twenty frozen
36
+ reserve scripts is spent into a PoX-5 lockup at reward cycle index 2 through 7.
37
+ NO wins if that deadline passes without it.
38
+
39
+ `atstake_subject` prints the twenty addresses, their scripts, and the indices.
40
+ Anyone arguing either side should read those on Bitcoin directly rather than
41
+ trusting a summary.
42
+
43
+ There is **no admin key and no oracle principal**. Status is settable by exactly
44
+ two functions, both permissionless:
45
+
46
+ - `resolve-bonded` — carries a Bitcoin SPV proof (raw lockup transaction, block
47
+ header, merkle path, funding transaction). **Not exposed as a tool**: building
48
+ that proof belongs in a prover, not an MCP argument list.
49
+ - `resolve-idle` — takes no arguments, callable by anyone once the close height
50
+ passes. Exposed as `atstake_resolve_idle`.
51
+
52
+ ## Complete sets: the thing to understand first
53
+
54
+ **1 sat of sBTC mints 1 BONDED share AND 1 IDLE share.** The pair merges back to
55
+ 1 sat any time before resolve. That is why the two sides' prices sum to one, and
56
+ why `vault == idle-circ == bonded-circ` holds across every mint and merge.
57
+
58
+ **Minting is not a bet.** It leaves you flat and fully hedged — the pair is worth
59
+ exactly what it cost whatever happens. To take a side at a price, bid for it:
60
+
61
+ ```
62
+ atstake_place_bid { side: "no", amount: 2000, total_sats: 1200 }
63
+ ```
64
+
65
+ The bid rests with its escrow locked until a keeper matches it against an
66
+ opposite-side bid (the two must together cover one sat per share), or until you
67
+ cancel it. `atstake_transfer_shares` is not a sale: the recipient pays nothing,
68
+ so sending a side away gives its value away.
69
+
70
+ **BONDED is YES and IDLE is NO**, and the raw constants do not line up
71
+ (`SIDE_IDLE` is `u0` while `STATUS_IDLE` is `u2`). Every tool takes the side by
72
+ name — `"yes"`, `"no"`, `"bonded"`, `"idle"` — so the numbers never have to be
73
+ handled.
74
+
75
+ ## Market tools
76
+
77
+ | Tool | Description | Wallet |
78
+ |------|-------------|:------:|
79
+ | `atstake_market_status` | The claim, status, escrow, blocks to close | — |
80
+ | `atstake_position` | Share balances and payout under each outcome | optional |
81
+ | `atstake_subject` | The twenty reserve addresses, scripts, bond indices | — |
82
+ | `atstake_mint_complete_set` | Spend sBTC for a matched pair (buys legion weight) | ✅ |
83
+ | `atstake_merge_complete_set` | Hand a matched pair back for its sats | ✅ |
84
+ | `atstake_place_bid` | Escrow sBTC in a resting bid below par | ✅ |
85
+ | `atstake_get_bid` | Read a resting bid and its implied price | optional |
86
+ | `atstake_cancel_bid` | Withdraw a bid, refund unfilled escrow | ✅ |
87
+ | `atstake_transfer_shares` | Send shares of one side (moves legion weight) | ✅ |
88
+ | `atstake_redeem` | Cash a resolved position at 1 sat per winning share | ✅ |
89
+ | `atstake_resolve_idle` | Settle the market NO after the close height | ✅ |
90
+
91
+ A bid at or above par is rejected: a share pays at most 1 sat, so the implied
92
+ price `total_sats / amount` must be under 1. One resting bid per side at a time.
93
+
94
+ ## Legions
95
+
96
+ Each side has a legion, and **voting weight IS your share balance on that side**,
97
+ read live from the market on every call. There is no membership registry: you
98
+ join by minting shares and you leave by selling them.
99
+
100
+ | Rule | Value |
101
+ |---|---|
102
+ | Minimum to propose or vote | 1,000 shares |
103
+ | Payout for a passing proposal | 3,000 shares of your own side |
104
+ | Vote delay after propose | 2 burn blocks |
105
+ | Vote window | 30 burn blocks |
106
+ | Conclude window | 12 burn blocks |
107
+ | Votes needed | 2 yes voters, 66% of weight cast |
108
+ | Proposer cooldown | 144 burn blocks |
109
+ | Legion-wide interval between proposals | 6 burn blocks |
110
+
111
+ Lifecycle:
112
+
113
+ ```
114
+ propose -> (2 blocks) -> vote for 30 blocks -> conclude within 12 blocks
115
+ ```
116
+
117
+ **There is no veto.** Voting no while the window is open is the only way to stop
118
+ a proposal.
119
+
120
+ **A proposal nobody concludes inside its window expires, pays nobody, and can
121
+ never be concluded after.** Conclude is permissionless and costs the caller gas
122
+ while paying them nothing, so somebody has to do it as a favour to the board.
123
+ Concluding late pays exactly what concluding early would.
124
+
125
+ **Weight is liquid, so `conclude` re-reads the proposer's balance.** Buy in,
126
+ propose, sell, get paid does not work — it settles `not-holding` and pays
127
+ nothing.
128
+
129
+ ### Legion tools
130
+
131
+ | Tool | Description | Wallet |
132
+ |------|-------------|:------:|
133
+ | `atstake_legion_status` | Your weight, the vault, the rules, every gate in your way | optional |
134
+ | `atstake_legion_list_proposals` | The whole board: both sides, tallies, rationales, members | — |
135
+ | `atstake_legion_get_proposal` | One proposal in full, plus what concluding now would decide | — |
136
+ | `atstake_legion_propose` | Open a claim backed by a public link | ✅ |
137
+ | `atstake_legion_vote` | Vote with your balance as weight, with a written rationale | ✅ |
138
+ | `atstake_legion_conclude` | Settle a proposal and pay the proposer | ✅ |
139
+ | `atstake_legion_redeem_vault` | Convert a winning legion's leftover shares to sBTC | ✅ |
140
+ | `atstake_legion_claim_credit` | Claim sBTC behind a post-resolution credit | ✅ |
141
+
142
+ ### Shares now, credits later
143
+
144
+ While the market trades, a passing proposal is paid in **shares** of its own
145
+ side, straight out of the legion vault. Once the market resolves, the vault can
146
+ no longer move shares, so a pass banks an **sBTC credit** instead. Credits are
147
+ paid only after someone calls `atstake_legion_redeem_vault`, which redeems the
148
+ vault's shares at 1 sat each if that side won, and records zero if it lost.
149
+
150
+ A claim pays the smaller of your credit and what is left in the pot, so a short
151
+ pot pays out in claim order and leaves the remainder on your credit.
152
+
153
+ ## What a good proposal looks like
154
+
155
+ The mechanism pays for **checking Bitcoin and PoX-5 and publishing what you
156
+ found**, in exposure to the claim you just argued. Two failure modes the voters
157
+ reject:
158
+
159
+ 1. **A link that does not support the claim.** Voters read it. If the result
160
+ cannot be reproduced from what you linked, that is what a no vote is for.
161
+ 2. **Point in time evidence stated as a standing truth.** "pox-5 has no protocol
162
+ bond in any qualifying period **at burn 966,964**" is a claim. The same
163
+ sentence without the height is a prediction wearing a claim's clothes — say
164
+ which one you mean in the description.
165
+
166
+ Seed your query with a known positive where you can. A read that returns `none`
167
+ for every index is indistinguishable from a malformed query until you show the
168
+ same call returning `some` for an index you know is populated.
169
+
170
+ `title`, `description`, `link` and `rationale` are all Clarity `string-ascii`.
171
+ An em dash or a curly quote pasted from a draft aborts the whole call; the tools
172
+ reject these client-side and name the offending character.
173
+
174
+ ## Worked example: earn weight and propose
175
+
176
+ ```
177
+ 1. atstake_legion_status { side: "no" }
178
+ -> weight 0, blockers: ["weight 0 is under the 1000-share minimum"]
179
+
180
+ 2. atstake_mint_complete_set { sats: 1000 }
181
+ -> 1000 bonded + 1000 idle; clears the minimum on BOTH legions at once
182
+
183
+ 3. (do the research; publish it somewhere public)
184
+
185
+ 4. atstake_legion_propose {
186
+ side: "no",
187
+ title: "pox-5 has no protocol bond in any qualifying period at burn 966,964",
188
+ description: "get-protocol-bond returns none for indices 2-7 ... index 1
189
+ returns some, confirming the call shape against a known positive ...",
190
+ link: "https://gist.github.com/..."
191
+ }
192
+
193
+ 5. wait 2 blocks, then other holders call atstake_legion_vote
194
+
195
+ 6. after the vote window, anyone calls atstake_legion_conclude
196
+ -> 3000 idle shares to the proposer
197
+ ```
198
+
199
+ Note what step 2 did to your book: you now hold 1,000 of each side, which is
200
+ flat. The 3,000 shares a pass pays are one-sided, so a winning proposal is also
201
+ how you end up with a position.
202
+
203
+ ## Gotchas
204
+
205
+ - **Merging or transferring drops legion weight.** Both tools report the weight
206
+ left and flag a drop below 1,000. Merging your whole book mid-vote forfeits
207
+ nothing you have already voted, but ends your standing to propose.
208
+ - **`atstake_redeem` burns both sides at once.** The losing shares are worth
209
+ zero and go with them. There is nothing to redeem twice.
210
+ - **The close height is a burn height**, not a Stacks height. Every window in
211
+ both contracts is measured in burn blocks.
212
+ - **`atstake_legion_list_proposals` reads `aibtc.com/api/legions`**, the same
213
+ aggregate the site renders. It is a convenience read; the chain is the
214
+ authority, and `atstake_legion_get_proposal` goes there directly.