Strategy format v1
A strategy is a small JSON program that a bWalletX agent account runs. The wallet checks its rules before it signs anything. You can sell a strategy on Exchange › Strategies as an encrypted 1Sat NFT.
Strategies are programs written and sold by users. bWalletX doesn’t review, rate or recommend them.
The file: bwalletx.strategy/1
Section titled “The file: bwalletx.strategy/1”{ "format": "bwalletx.strategy/1", "name": "Penny DCA $B0ASEX", "version": "1.0", "goals": "Buy about $0.10 of the cheapest $B0ASEX listing, at most three times a day.", "rules": { "tokens": ["B0ASEX"], "actions": ["buy"], "maxPerTradeUsd": 0.1, "maxPerDayUsd": 0.3, "maxTotalUsd": 2, "stop": { "holdTokens": 5000 } }, "spec": { "trades": "$B0ASEX only (BSV-21), from market listings", "risk": "Low", "spends": "$0.10 a buy, $0.30/day, $2 total", "often": "Up to 3 times a day", "stops": "Holds 5,000 $B0ASEX, or $2 spent", "needs": "Agent account with about $1 of BSV" }, "changelog": [{ "version": "1.0", "note": "First version" }]}Top-level fields
Section titled “Top-level fields”| Field | Type | Required | Notes |
|---|---|---|---|
format |
string | yes | Always bwalletx.strategy/1. |
name |
string | yes | Cut to 60 characters. |
version |
string | yes | e.g. 1.0, cut to 20 characters. Bump it when the rules change. |
goals |
string | yes | Plain language for the agent, cut to 4,000 characters. Not enforced. |
rules |
object | yes | The hard limits below. The wallet refuses anything outside them. |
spec |
object | to sell | The six public listing fields below. All six are needed to publish. |
changelog |
array | no | [{ "version", "note" }], up to 50 entries. |
Unknown fields are dropped when a file is loaded.
| Field | Type | Required | Meaning |
|---|---|---|---|
tokens |
string[] | yes | Tickers or BSV-21 ids it may touch. Use "BSV" for sends. |
actions |
string[] | yes | Any of buy, sell, send, list. |
maxPerTradeUsd |
number | yes | The most one action may spend. |
maxPerDayUsd |
number | The most per UTC day while loaded. | |
maxTotalUsd |
number | The most in total while loaded. | |
buyBelowUsd |
number | Buy only at or below this price per token. | |
sellAboveUsd |
number | Sell or list only at or above this price per token. | |
sendTo |
string[] | if send |
Addresses or paymails it may send to. |
stop.holdTokens |
number | Finished once it holds this many of its tokens. | |
stop.downPct |
number | 0–100. Accepted, but not enforced yet (see below). |
Every refusal goes in the account’s Activity log, with the rule that refused it.
spec (the public listing)
Section titled “spec (the public listing)”All strings, each cut to 200 characters: trades, risk (Low, Medium, High or Experimental), spends, often, stops, needs. Rate risk honestly. Don’t make performance claims, and say plainly that it can lose money.
What runs today
Section titled “What runs today”- buy: works. The agent buys the cheapest market listing of the token within the dollar amount, after the rules pass. Paper or live.
- send: works. Sends BSV only, to an entry on
sendTo. - sell / list: accepted and checked, but the agent can’t carry them out yet. A strategy that depends on selling does nothing.
- Timing: there is no scheduler yet. The agent acts while it is talking in the agent account.
maxPerDayUsdis what really limits how often it acts. stop.downPct: not enforced yet.
A loaded strategy always starts on paper: live prices, $100 of pretend money, nothing signed. Run live switches it to the account’s real balance.
Selling a strategy
Section titled “Selling a strategy”The NFT envelope: bwalletx.strategy-nft/1
Section titled “The NFT envelope: bwalletx.strategy-nft/1”When you publish, the wallet encrypts the strategy file with a random 32-byte key (AES-256-GCM). It then inscribes a 1-sat NFT with content type application/vnd.bwalletx.strategy+json and MAP fields app=bwalletx, type=strategy, name:
type Envelope = { format: 'bwalletx.strategy-nft/1'; name: string; version: string; description: string; // public listing text, up to 1,000 characters spec: { trades; risk; spends; often; stops; needs }; author: { name: string; address: string }; sale: { priceUsd: number; copies: number; payTo: string }; // $0.01–$10,000, 1–10,000 copies keyHash: string; // hex sha256 of the content key iv: string; // base64 ciphertext: string; // base64 AES-GCM of the strategy file};The description, spec and sale terms are public. Only the program is encrypted.
Publish
Section titled “Publish”- In bWalletX (not the App Store / Play edition), load the file into an agent account: Settings › Agents › account › Load strategy. Then tap Sell. You can also start from a bundled example: Exchange › Strategies › Publish a strategy.
- Fill in the description, check the spec, and set a price in dollars and a number of copies. The payout address is the account you publish from.
- Publish mints your copy (the origin) into your wallet. The wallet then signs
bwalletx strategy publish: <outpoint>: <ms>with the key that holds that copy, and registers the content key with the key service. The key service checks the signature, that you own the outpoint, that it is a fresh mint, and thatsha256(key) = keyHash.
Cost to publish: one inscription, about 2 KB, so a network fee of a few hundred sats at the default 100 sat/kB. There is no listing fee.
The buyer taps Buy on Exchange › Strategies. One transaction pays sale.payTo the price in sats at the current BSV price. The same transaction pays the 1% market fee (when the build has one set) and mints the buyer’s own copy of the same envelope. Then the wallet unlocks the copy. It proves ownership with a signature, and the key service checks three things: the copy’s mint paid the author at least 85% of the published price at today’s rate, copies remain, and the copy hasn’t already been counted. The service then returns the content key. The wallet decrypts the file and re-checks it like any strategy file.
The NFT is the proof of ownership. Unlocked strategies are cached on the device by outpoint.
Catalogue API
Section titled “Catalogue API”GET https://bwalletx.com/api/strategies:{ strategies: [{ origin, envelope (no ciphertext), sold, createdAt }] }GET /api/strategies?origin=<txid_vout>: the full envelope for one listing.POST /api/strategies{ action: "publish" | "unlock", outpoint, message, pubkey_hex, signature, key? }
Versioning
Section titled “Versioning”formatnames the file version (bwalletx.strategy/1) and the envelope version (bwalletx.strategy-nft/1). A breaking change gets a new number. Readers reject formats they don’t know.- A strategy’s own
versionandchangelogare the author’s. A new version is a new publish: a new NFT and a new listing. Buyers of the old version keep the old version.
Not built yet
Section titled “Not built yet”- Selling from the agent (
sell/list), which take-profit and stop-loss strategies need. - Enforcing
stop.downPct. - A schedule (for example
rules.every) and a background runner. - Token sends (airdrops).
sendmoves BSV only. - Upgrades for existing buyers, delisting, and changing the price after publishing.