@chaindaddy/mcp 0.4.2 → 0.6.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,51 @@
1
+ ---
2
+ name: export-a-listing
3
+ description: Prepare a registered token's details for listing and screener sites (CoinGecko, CoinMarketCap, DEX Screener, DEXTools, Birdeye) from its Chain Daddy page, check what is missing first, and explain the public Token List. Read-only; the human submits each form. Use when someone wants their token listed, or asks what a listing site needs.
4
+ license: MIT
5
+ ---
6
+
7
+ # Export a listing
8
+
9
+ A token page already holds what listing sites ask for: name, ticker, description, logo, socials, contract.
10
+ This skill gathers it, flags gaps, and hands the human ready-to-paste fields. Each site decides for itself
11
+ whether to list a token; nothing here guarantees a listing.
12
+
13
+ ## Tools
14
+
15
+ | Need | MCP | HTTP |
16
+ |---|---|---|
17
+ | The page's data | `get_crown` | `GET /api/v2/registration/{id}` |
18
+ | Fields for one site | `generate_listing` (`format`: `coingecko`, `coinmarketcap`, `dexscreener`, `tokenlist`) | - |
19
+ | Every format at once | `export_listing` | - |
20
+ | The public Token List | - | `GET /api/v2/tokenlist?chainId=8453` (no key) |
21
+
22
+ In the browser: the token manager → chain switcher → gear → **Listing Export**, with a guided wizard for
23
+ each site.
24
+
25
+ ## Steps
26
+
27
+ 1. Find the token's crown id (`find-and-check-a-token`) and read its page data.
28
+ 2. Check completeness before generating. Most sites want: name, ticker, contract address, description,
29
+ website, logo (512 px or larger for screener upgrades), and socials. If something is missing, the owner
30
+ adds it in the token manager first; a missing field means an incomplete submission.
31
+ 3. Generate the fields for the site the human picked, and show them ready to copy, with the site's own
32
+ form link.
33
+ 4. Say what each site charges, from the docs page (screener upgrades are paid to those sites; CoinGecko and
34
+ CoinMarketCap are free to apply). Chain Daddy takes nothing.
35
+
36
+ ## The Token List
37
+
38
+ Chain Daddy publishes every active, verified EVM registration in the standard Token List format that
39
+ wallets and exchanges read: `GET https://api.chaindaddy.io/api/v2/tokenlist`. A token is in it when its
40
+ registration is active, its contract is set and its decimals are known. Each entry carries
41
+ `extensions.tokenId` (the crown id) and `extensions.verified`. Solana tokens are not in it.
42
+
43
+ ## Mistakes to avoid
44
+
45
+ - Submitting a form for the human or paying a listing fee. They submit and pay.
46
+ - Promising a listing or a timeline. Each site has its own minimums for volume, holders and liquidity.
47
+ - Generating with gaps instead of flagging them first.
48
+
49
+ ## Docs
50
+
51
+ https://docs.chaindaddy.io/creator-tools/listing-export
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: find-and-check-a-token
3
+ description: Read-only lookups on Chain Daddy - find a token by ticker, name or contract address on every supported chain, tell the verified token from copycats, read who registered it and how they proved ownership, and check its health and holder spread. Use when someone asks "is this the real token", "who owns this ticker", "is this ticker free", "find the token for my game", or needs a token's chain key and crown id. Never buys, sells or signs anything.
4
+ license: MIT
5
+ ---
6
+
7
+ # Find and check a token
8
+
9
+ Everything here is read-only. Nothing in this skill moves money, signs or changes anything.
10
+
11
+ ## Tools
12
+
13
+ | Need | MCP | HTTP (`https://api.chaindaddy.io`) | CLI |
14
+ |---|---|---|---|
15
+ | Search | `search_symbols` (filters), `search_symbol` | `GET /api/v2/search?q=…` | - |
16
+ | One token on one chain | `get_token` | `GET /api/v2/token/{symbol}/{chain}` | `chaindaddy status --symbol S --chain base` |
17
+ | A registration (token page) | `get_crown`, `list_crowns` | `GET /api/v2/registration/{id}` | `chaindaddy status --crown <id>` |
18
+ | Health | `check_heartbeat` | `GET /api/v2/heartbeat/{symbol}/{chain}` (EVM) | `chaindaddy status --wallet <addr>` |
19
+ | Holder spread | `get_holders` | `GET /api/v2/registration/{id}/holders` | - |
20
+ | Verified token list (EVM) | - | `GET /api/v2/tokenlist?chainId=8453` (no key) | - |
21
+
22
+ The remote server at `https://api.chaindaddy.io/mcp` needs no key for its read-only tools. Calls from your own
23
+ code need an API key as `X-API-Key: cd_live_…` (from https://chaindaddy.io/_api); without one the API answers
24
+ `401 api_key_required`.
25
+
26
+ ## Search
27
+
28
+ `GET /api/v2/search?q=PEPE` searches symbols, names, or a contract address across every chain. Useful
29
+ parameters: `chain` (`eth`, `base`, `arbitrum`, `polygon`, `bnb`, `avax`, `robinhood`, `solana`, …),
30
+ `exact=true`, `crownsOnly=true`, `sort` (`relevance`, `market_cap`, `volume`, `liquidity`, `holders`, `age`, …),
31
+ `pageSize` (max 100), and `refresh=true` right after a launch or import.
32
+
33
+ Each result has `type`: `crown` (registered), `token` (exists, not registered) or `available` (no token with
34
+ that symbol on that chain), plus `token` (address, market data, holders) and `crown` (status, `tokenId` = the
35
+ crown id, `owner`, `verificationMethod`).
36
+
37
+ | Status | Meaning |
38
+ |---|---|
39
+ | `available` | No token with this symbol on this chain |
40
+ | `unclaimed` | A token exists; nobody has registered it |
41
+ | `grace_period` | Registered in the last 30 days |
42
+ | `claimed` | Registered: this is the verified token for this ticker on this chain |
43
+ | `inactive` | The registration lapsed; the ticker is open to import again |
44
+
45
+ ## Is this the real token?
46
+
47
+ 1. Search the ticker. Many tokens share a symbol, on one chain and across chains.
48
+ 2. The verified one on a chain is the result with a registration (`hasCrown: true`, status `claimed` or
49
+ `grace_period`). Read `crown.verificationMethod` - how the owner proved control of the contract: its
50
+ owner or admin, its deployer, its mint or update authority (Solana), a launchpad's creator record, an
51
+ ENS record, or holding more than half the supply.
52
+ 3. **Compare the contract address**, never the name or logo. A copycat is a token using the same ticker or
53
+ one a letter or two off; it has its own address. Hand the human the verified address and the page link
54
+ (`shareUrl`, or `https://chaindaddy.io/<symbol>`).
55
+ 4. A registration says who proved control of the contract. It is not an audit, an endorsement or a safety
56
+ rating. Say so.
57
+
58
+ ## Health and holders
59
+
60
+ - Health is 0-100, updated daily: age 50%, trading volume 30% (wash trading filtered), holder spread 20%.
61
+ Below 60 for 30 days in a row, the registration expires and the ticker opens to anyone who can prove
62
+ ownership, first come, first served.
63
+ - `get_holders` reports concentration (top 10/50/100/200 share), how many wallets hold half the supply, and
64
+ counts of wallets flagged as snipers, bundlers, insiders or sandwich traders. Data refreshes daily.
65
+ - Report these as facts with their date. Don't turn them into advice to buy or sell.
66
+
67
+ ## For developers
68
+
69
+ To build on a token you need its **chain key** (e.g. `base`) and **crown id** (`crown.tokenId`). Both come from
70
+ the search result. Opening a store or building a Crown App for it needs the owner's or a manager's wallet.
71
+
72
+ ## Mistakes to avoid
73
+
74
+ - Treating the symbol as unique, or trusting a name or logo. Only the contract address identifies a token.
75
+ - Calling an unregistered or copycat token "fake" or "a scam". Say what the data shows: it is not the
76
+ registered token for that ticker.
77
+ - Reading a cached result right after a launch; pass `refresh=true`.
78
+ - Price predictions, buy or sell advice, or "safe" ratings. Report the numbers.
79
+ - Placing a trade. This skill reads only.
80
+
81
+ ## Docs
82
+
83
+ - https://docs.chaindaddy.io/api-reference/endpoints/search
84
+ - https://docs.chaindaddy.io/token/verification-methods
85
+ - https://docs.chaindaddy.io/platform/heartbeat
86
+ - https://docs.chaindaddy.io/alerts/ (copycat alerts for owners)
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: launch-a-token
3
+ description: Help a human launch a new token with Chain Daddy, or bring one they already made - check the ticker, compare a launchpad pool against a one-time-fee token, explain fees and what is permanent, and prepare the launch. The agent never holds keys and never sends the launch - it prepares, the human signs on chaindaddy.io or runs the final CLI command. Use when someone wants to launch, create, mint or deploy a token, or pick where to launch.
4
+ license: MIT
5
+ ---
6
+
7
+ # Launch a token
8
+
9
+ **The rule: you prepare, the human launches.** A launch is irreversible and costs real money or gas. Never
10
+ ask for a private key or seed phrase, never send a launch, buy or payment with the human's key or session,
11
+ and never call a broadcast endpoint for them. Check, compare, write the config, dry-run it, then hand over
12
+ one clear step for the human to take.
13
+
14
+ ## 1. Check the ticker
15
+
16
+ - MCP: `search_symbols` (or `search_symbol`); HTTP: `GET /api/v2/search?q=<SYMBOL>&exact=true` (send
17
+ `X-API-Key`); CLI: `chaindaddy status --symbol <S> --chain <chain>`.
18
+ - Per chain, the status is `available` (no token), `unclaimed` (a token exists, unregistered), `claimed` /
19
+ `grace_period` (registered to someone), or `inactive` (lapsed). A name taken on one chain can be open on another.
20
+ - Symbol: 1-16 characters; Solana caps at 10.
21
+ - If the human already made the token elsewhere, they **import** it instead: they prove ownership on
22
+ chaindaddy.io (deployer, owner, mint or update authority, launchpad creator, or majority holder) and pay one
23
+ fee, free for established tokens. Guide: https://docs.chaindaddy.io/getting-started/import-an-existing-token
24
+
25
+ ## 2. Pick what creates the token
26
+
27
+ | | Launchpad pool | One-time fee |
28
+ |---|---|---|
29
+ | What it creates | The token and its trading pool, liquidity locked | A plain ERC-20 (SPL on Solana), no pool |
30
+ | Up front | Nothing (network fee aside) | A flat fee per chain, token page included (10% off on two or more chains) |
31
+ | Chain Daddy's share | Part of the pool's trading fee, set by the creator's plan **at launch** and fixed for that token | None |
32
+ | Store fee on items later | 0% | 2.5% |
33
+ | Where | https://chaindaddy.io/_launch | chaindaddy.io → **Launch New Token** → **Add to Cart** |
34
+
35
+ Show prices from the live source, not from memory: `get_pricing` / `chaindaddy estimate --symbol S --chains
36
+ base,arbitrum` for the one-time fee; `GET /api/v2/factory/evm/launchpad/capabilities?chainId=<id>` for what a
37
+ launchpad chain can run (read it each time; values change).
38
+
39
+ The launch form can also launch on launchpads Chain Daddy doesn't run, and the token page is still free:
40
+ `list_launch_venues` / `GET /api/v2/launch/venues`. For each venue show **both** numbers per $100 traded -
41
+ what traders pay (`traderFeeBps`) and what reaches the creator (`creatorBps`) - in the order returned. Don't
42
+ call any venue best: a venue can pay the creator more by charging traders more.
43
+
44
+ ## 3. Say what is permanent
45
+
46
+ - Symbol, total supply and decimals can never change. Token settings can be switched off later, never on.
47
+ Renouncing ownership can't be undone.
48
+ - On a launchpad pool, the fee split is fixed when the pool is created. A plan bought later applies to the
49
+ next launch.
50
+ - None of a launchpad token's supply goes to the creator unless they keep a vested team allocation or buy
51
+ at launch.
52
+
53
+ Get an explicit yes from the human on each before they launch.
54
+
55
+ ## 4. Prepare, then hand over
56
+
57
+ **Easiest, any human:** send them to https://chaindaddy.io/_launch (pool) or the **Launch New Token** flow
58
+ (one-time fee) with the choices written out. They sign in, review and confirm in their own wallet.
59
+
60
+ **From the terminal** (`npm i -g @chaindaddy/cli@beta`):
61
+ - Pool: write the request JSON (fields in https://docs.chaindaddy.io/api-reference/endpoints/launchpad-api),
62
+ then `chaindaddy launchpad launch --config launch.json --dry-run --rpc <url>` to build and simulate only.
63
+ The human approves in their own wallet: `chaindaddy launchpad login start --address <wallet> --signer <s>`,
64
+ where `<s>` is `walletconnect` (a QR code for any phone or desktop wallet), `browser` (a chaindaddy.io page,
65
+ the only option for email/Google/Apple/X sign-in wallets), `ledger`, `trezor`, `keystore`, or `external`
66
+ (prints what to sign; finish with `--sig`). Then they run the same command **without** `--dry-run`. A Safe:
67
+ `--safe <addr> --rpc <url>` writes an approveHash plan the owners sign.
68
+ Run non-interactively, a command waiting on a signature prints one JSON line, `{"sign_request": {...}}`, with
69
+ a URL or WalletConnect URI and a match code. Show it to the human and wait; never try to sign it yourself.
70
+ - One-time fee: `chaindaddy create --symbol S --name "N" --chains base --supply 1000000000 --dry-run`; the
71
+ human runs it without `--dry-run`. It asks for their wallet and confirms the fee.
72
+ - Another launchpad: `build_venue_launch` returns an **unsigned** transaction. The human's own wallet signs
73
+ and sends `transactions[0]`; then `submit_venue_launch` with the hash, and poll `get_venue_launch` until
74
+ `confirmed` (token page free) or `failed` (`failureReason`).
75
+
76
+ Rehearse on testnet first when the human wants to: Base Sepolia (`chainId` 84532) against
77
+ `https://staging-api.chaindaddy.io`.
78
+
79
+ ## 5. After the launch
80
+
81
+ - The token page: a launchpad launch registers it for free (the server may do it; check
82
+ `GET /api/v2/factory/evm/launchpad/registration?chainId=&token=`). A one-time-fee token is registered with
83
+ the order. Then set up the page in the token manager: description, image, links, socials.
84
+ - A one-time-fee token isn't tradable until the creator adds liquidity.
85
+ - Launchpad trading fees build up in the pool. The creator claims them from **My Tokens**
86
+ (https://chaindaddy.io/_tokens), paying the network fee. Nothing is claimed automatically.
87
+ - Keep it healthy: below 60 for 30 days in a row and the registration expires (`check-token-health`).
88
+ - Next: `add-crypto-to-your-game` to sell items for it.
89
+
90
+ ## Mistakes to avoid
91
+
92
+ - Sending the launch, a dev-buy or a fee claim yourself, even when an API key would let you. Hand it over.
93
+ - Quoting fees, prices or chain support from memory instead of the live endpoints above.
94
+ - Calling a token "an investment", promising returns, or predicting price.
95
+ - Quoting a launch on several chains without each chain's own fee and network fee.
96
+ - Forgetting the one-way doors in step 3.
97
+
98
+ ## Docs
99
+
100
+ - https://docs.chaindaddy.io/launchpad
101
+ - https://docs.chaindaddy.io/getting-started/create-a-token
102
+ - https://docs.chaindaddy.io/api-reference/cli#launchpad
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: sell-items-in-your-app
3
+ description: Run a Chain Daddy creator store - open it, add items priced in a token or in dollars, create orders from your server, have the buyer's wallet pay, wait for confirmed, deliver, read and spend what a wallet owns, drops and rewards, webhooks, refunds - and test the whole loop on a no-money test store first. Use when someone wants to sell credits, skins, passes or badges for their token, give items away, or unlock perks for holders.
4
+ license: MIT
5
+ ---
6
+
7
+ # Sell items in your app
8
+
9
+ A store sells **items** for one token. The buyer's wallet pays the token's payout wallet directly, in one
10
+ on-chain transaction; the checkout contract has no owner and holds no balance. Once the payment confirms,
11
+ Chain Daddy grants the item and signs a receipt. Items live off chain: they can't be transferred or cashed out.
12
+
13
+ ## Tools
14
+
15
+ | Step | MCP (local server) | CLI (`npm i -g @chaindaddy/cli@beta`) | HTTP (`https://api.chaindaddy.io`) |
16
+ |---|---|---|---|
17
+ | Open the store | `iap_open_store` | `chaindaddy iap store open --chain base --crown 8` | `POST /api/v2/iap/stores` |
18
+ | Test store | `iap_open_test_store` | `chaindaddy iap store test <storeId>` | `POST /api/v2/iap/stores/{id}/test-store` |
19
+ | Items | `iap_create_sku`, `iap_update_sku`, `iap_list_skus` | `chaindaddy iap sku create/update/archive` | `/api/v2/iap/stores/{id}/skus` |
20
+ | Server key | `iap_create_store_key` | `chaindaddy iap key create` | `POST /api/v2/iap/stores/{id}/keys` |
21
+ | Orders | `iap_create_order`, `iap_get_order`, `iap_test_pay` | `chaindaddy iap order create/show/test-pay` | `POST /api/v2/iap/orders` |
22
+ | What a wallet owns | `iap_get_entitlements`, `iap_consume`, `iap_grant`, `iap_revoke` | `chaindaddy iap entitlements/consume/grant/revoke` | `/api/v2/iap/stores/{id}/entitlements` |
23
+ | Rewards | `iap_create_drop`, `iap_set_drop_status`, `iap_award` | `chaindaddy iap drop …` | `/api/v2/iap/stores/{id}/drops` |
24
+ | Events | `iap_list_events`, `iap_set_webhook`, `iap_test_webhook` | `chaindaddy iap events/webhook …` | `/api/v2/iap/stores/{id}/events` |
25
+
26
+ Credentials: account calls (open a store, manage items and keys) use the human's `chaindaddy login` on this
27
+ computer (or a `cd_live_…` key in `CHAINDADDY_API_KEY` on a server). The game server uses a **store key** `cd_iap_…` from `CHAINDADDY_IAP_KEY`: one store,
28
+ only its scopes, sent alone as `Authorization: Bearer`. The plan gate: Developer, Partner or Enterprise, or
29
+ Developer Beta Program membership; otherwise every call answers `403 IAP_PLAN_REQUIRED` - stop and tell the human.
30
+
31
+ ## Steps
32
+
33
+ 1. **Open the store** with the token page's chain key and crown id. Opening again returns the same store.
34
+ Report `id`, `payoutAddress` (starts as the owner's wallet), and `feeBps` (0 on a token launched in a Chain
35
+ Daddy launchpad pool, 250 otherwise).
36
+ 2. **Add items.** New items are `draft`; set `status: "active"` to list one. Create reward-only items (no
37
+ price, like `credits`) before the bundles that `grants` them. Example credit pack:
38
+ ```json
39
+ { "sku": "credits.100", "type": "consumable", "name": "100 credits",
40
+ "priceUsdMicros": 5000000, "minPrice": "1000000000000000000000",
41
+ "grants": [{ "sku": "credits", "quantity": 100 }], "status": "active" }
42
+ ```
43
+ `sku`: lowercase letters, digits, `.`, `_`, `-`, up to 64. A fixed `price` is a **base-unit string**
44
+ (5,000 tokens at 18 decimals = `"5000000000000000000000"`). An item has `price` or `priceUsdMicros`, not
45
+ both. `currency` is `token` (default), `native` or `usdc`. Confirm human-readable amounts with the human.
46
+ 3. **Make a store key** with only the scopes the server needs, typically `orders:read orders:write
47
+ entitlements:read entitlements:write`. The secret is shown **once**: tell the human to store it as
48
+ `CHAINDADDY_IAP_KEY` in their secrets manager. Never print it back.
49
+ 4. **Test it** (next section) before any live sale.
50
+ 5. **Server creates the order** for the user's wallet, with `appAccountToken` = your own user id and an
51
+ `Idempotency-Key` per purchase attempt (your cart id). It locks the price for about 20 minutes (5 for a
52
+ dollar price paid in the token or coin).
53
+ 6. **Client pays** from the order's `payment` block, as given. EVM: send `calls.approve` (when present), wait
54
+ for it, then `calls.pay`; or sign `permitTypedData` and call `payWithPermit`. Solana: the wallet signs and
55
+ sends `payment.transaction`. The client never computes an amount.
56
+ 7. **Wait for `confirmed`.** Poll the order, or listen for `iap.order.confirmed`. Optionally
57
+ `POST /api/v2/iap/orders/{id}/submit` with `{"txHash": …}` to check at once.
58
+ 8. **Deliver.** Verify the receipt (`verify-receipts-and-sessions`), then grant; or read the item ledger and
59
+ spend with `consume` (with an idempotency key).
60
+
61
+ On a token page, a Crown App skips steps 5-7: it declares `iap:purchase` and sends
62
+ `onAction({ type: 'iap-purchase', sku, quantity })`; the page runs the sale (see `build-a-crown-app`).
63
+
64
+ A Crown App can also spend the viewer's own consumable with no server: it declares `iap:consume` and sends
65
+ `onAction({ type: 'iap-consume', sku, quantity, key })` from the viewer's tap. It works only for an item whose
66
+ `maxAppSpend` the store's owner set (the most an app may spend per request; null means no app can), and it is
67
+ never proof: a holder can make that spend without the app. Keep `maxAppSpend` null and spend with `consume`
68
+ on your server for anything competitive or redeemed for a prize.
69
+
70
+ ## Test store first
71
+
72
+ Available where `GET /api/v2/iap/config` answers `"testMode": true`.
73
+
74
+ 1. `iap_open_test_store` with the **live** store id. It copies the live catalog once; after that they are separate.
75
+ 2. `iap_create_store_key` on the **test** store id. Its secret starts `cd_iap_test_`.
76
+ 3. Create an order with the test key; its `payment` is `{"kind":"test"}`.
77
+ 4. `iap_test_pay` (`POST /api/v2/iap/orders/{id}/test-pay`): the order confirms through the real path. No
78
+ chain, no money, no fee.
79
+ 5. The receipt and webhooks carry `"livemode": false`. Give the test store its own webhook.
80
+ 6. Go live by switching to the live key. Token prizes and claim links don't run on a test store.
81
+
82
+ ## Rewards and webhooks
83
+
84
+ - One-off gift: `iap_grant`. A drop: `iap_create_drop` with `mode` `claim` (a link), `push` (a wallet list),
85
+ or `award` (your server awards a wallet with `iap_award`, scope `rewards:award`). Drops start as drafts.
86
+ - Webhook: `iap_set_webhook` with a public `https://` URL; the `whsec_…` secret is shown once. Check
87
+ `X-Webhook-Signature` (hex HMAC-SHA256 of the raw body) before parsing. Answer 2xx within 5 seconds.
88
+ - Reconcile from the event feed (`iap_list_events` with `after` = your last event id). The webhook makes you
89
+ fast; the feed makes you complete.
90
+ - Refunds: the creator sends the money back from their wallet, then records it with `iap_refund_order`
91
+ (`refund_tx_hash`; CLI `--tx`), which revokes the items and receipt. Chain Daddy cannot move a buyer's funds.
92
+
93
+ ## Mistakes to avoid
94
+
95
+ - Granting on `paid`, or before verifying the receipt's signature, `storeId` and `livemode`.
96
+ - A store key in the game client. Only the server holds it.
97
+ - Retrying a write with a new idempotency key: it can sell or grant twice. Reuse the same key.
98
+ - Editing the `payment` block, or paying in another currency: the payment is recorded as `order.mismatch`
99
+ and grants nothing.
100
+ - Treating `503 PRICE_UNAVAILABLE` as a failure: the dollar price can't be converted right now; retry in a minute.
101
+ - Items with a random outcome (loot boxes): not allowed. Never call items money or a balance.
102
+ - Sending a payment for the human. They pay from their own wallet.
103
+
104
+ ## Docs
105
+
106
+ - https://docs.chaindaddy.io/developer/store-and-rewards (every field, rule, event and limit)
107
+ - https://docs.chaindaddy.io/developer/test-your-integration
108
+ - OpenAPI: https://docs.chaindaddy.io/openapi.yaml, tag **Creator Store**
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: sign-in-with-chain-daddy
3
+ description: Add "Sign in with Chain Daddy" to a website, game or app - standard OpenID Connect (authorization code + PKCE, ES256 ID tokens) that tells your server which wallet the visitor controls. Covers registering a client, the stock-library setup, the claims to check, and how it differs from a Crown App session token. Use when someone wants wallet sign-in, "log in with Chain Daddy", or to link a player account to a wallet.
4
+ license: MIT
5
+ ---
6
+
7
+ # Sign in with Chain Daddy
8
+
9
+ The visitor goes to chaindaddy.io, approves your site, and comes back with an ID token that says **which
10
+ wallet they control**. It is standard OpenID Connect, so use a stock library (openid-client, Auth.js,
11
+ go-oidc, Authlib, Spring Security, .NET). You get an ID token and nothing else: no refresh token, no access
12
+ to the Chain Daddy API for the user, no email, no balance. Keep your own session afterwards.
13
+
14
+ ## Endpoints
15
+
16
+ Use discovery: `https://api.chaindaddy.io/.well-known/openid-configuration`
17
+
18
+ | | |
19
+ |---|---|
20
+ | Issuer | `https://api.chaindaddy.io` |
21
+ | Authorize (consent page) | `https://chaindaddy.io/_oauth/authorize` |
22
+ | Token | `https://api.chaindaddy.io/api/v2/oauth/token` |
23
+ | Keys | `https://api.chaindaddy.io/api/v2/oauth/jwks` |
24
+
25
+ ## 1. Register a client (the human does this)
26
+
27
+ Needs Developer Beta Program membership (free to register). Easiest: the developer portal,
28
+ https://chaindaddy.io/_developer → **Sign-in** → **New client**. Or:
29
+
30
+ ```bash
31
+ chaindaddy oauth client create --name "My Game" \
32
+ --redirect-uri https://example.com/auth/callback --confidential --crown base:8
33
+ ```
34
+
35
+ API: `POST https://api.chaindaddy.io/api/v2/developer/oauth-clients` with the human's `cd_live_…` key.
36
+
37
+ - `redirectUris` match **exactly**: no wildcards. `https` only, except `http://localhost` and
38
+ `http://127.0.0.1` for development.
39
+ - `confidential: true` for a server that keeps a secret (`cd_oauth_…`, shown once - the human stores it).
40
+ A single-page app, game client or native app stays public and uses PKCE with no secret.
41
+ - `name`: up to 40 characters, and may not contain "Chain Daddy", "official", "support" or "wallet".
42
+ - `crown` (optional) earns the consent screen's **verified** mark when the human manages that token page
43
+ and the redirect host is one of the page's verified domains.
44
+
45
+ ## 2. Wire the flow
46
+
47
+ Node, with openid-client:
48
+
49
+ ```ts
50
+ import * as client from 'openid-client';
51
+
52
+ const config = await client.discovery(
53
+ new URL('https://api.chaindaddy.io'), process.env.CD_CLIENT_ID!,
54
+ { id_token_signed_response_alg: 'ES256' },
55
+ client.ClientSecretPost(process.env.CD_CLIENT_SECRET!), // client.None() for a public client
56
+ );
57
+
58
+ // Sign-in: keep verifier, state and nonce in the visitor's session
59
+ const verifier = client.randomPKCECodeVerifier();
60
+ const state = client.randomState();
61
+ const nonce = client.randomNonce();
62
+ const url = client.buildAuthorizationUrl(config, {
63
+ redirect_uri: 'https://example.com/auth/callback', scope: 'openid wallets',
64
+ code_challenge: await client.calculatePKCECodeChallenge(verifier), code_challenge_method: 'S256',
65
+ state, nonce,
66
+ });
67
+
68
+ // Callback
69
+ const tokens = await client.authorizationCodeGrant(config, new URL(req.url, 'https://example.com'), {
70
+ pkceCodeVerifier: verifier, expectedState: state, expectedNonce: nonce,
71
+ });
72
+ const claims = tokens.claims()!;
73
+ if (claims.typ !== 'signin+v1') throw new Error('not a Chain Daddy sign-in');
74
+ const wallet = claims.sub; // start your own session for this wallet
75
+ ```
76
+
77
+ Auth.js: a provider with `type: 'oidc'`, `issuer: 'https://api.chaindaddy.io'`,
78
+ `checks: ['pkce', 'state', 'nonce']`, `client: { id_token_signed_response_alg: 'ES256' }`, and a `profile()`
79
+ that throws unless `typ === 'signin+v1'`.
80
+
81
+ ## Scopes and claims
82
+
83
+ | Scope | Adds |
84
+ |---|---|
85
+ | `openid` (required) | `sub` (the wallet: lowercase hex on EVM, base58 on Solana), `chain` (`evm` or `solana`) |
86
+ | `wallets` | `wallets`: every wallet linked to the account, `sub` first |
87
+ | `profile` | `identity`: the handle they chose to publish |
88
+
89
+ Check on every ID token: signature (ES256, keys above), `iss` = `https://api.chaindaddy.io`, `aud` = your
90
+ client id, `typ` = `signin+v1`, `nonce` = the one you sent, `exp` (5 minutes).
91
+
92
+ ## After sign-in
93
+
94
+ Gate on what the wallet owns live, on your server: your store's
95
+ `GET /api/v2/iap/stores/{id}/entitlements?wallet=<sub>` (holder unlocks included). Never put a balance in
96
+ your session: it goes stale in minutes.
97
+
98
+ ## Crown Apps use something else
99
+
100
+ Inside a Crown App on a token page, use the `session-token` action (an `app-session+v1` token, EdDSA, keys
101
+ at `/api/v2/apps/jwks`). If your site and your Crown App share a server, verify both kinds and key people by
102
+ `sub`: it is the same wallet string in both. See `verify-receipts-and-sessions`.
103
+
104
+ ## Mistakes to avoid
105
+
106
+ - Skipping PKCE (`S256`) or `state`: both are required on every request.
107
+ - Not checking `typ`. A token of another kind must never pass for a sign-in.
108
+ - Expecting a refresh token or API access: there is neither. A returning visitor who approved before signs
109
+ in again without a click.
110
+ - Redirect URIs that differ by a slash or a port: they must match exactly, or chaindaddy.io refuses.
111
+ - Putting the client secret in a browser, game client or repo.
112
+ - Asking the visitor to sign a second login message in their wallet. This is the sign-in.
113
+
114
+ ## Docs
115
+
116
+ https://docs.chaindaddy.io/developer/sign-in-with-chain-daddy
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: verify-receipts-and-sessions
3
+ description: Verify what Chain Daddy signs on your own server before acting on it - store purchase receipts (iap-receipt+v1), Crown App session tokens (app-session+v1), Sign in with Chain Daddy ID tokens (signin+v1), and webhook signatures - with the exact keys, claims and checks, plus published test vectors. Use when writing server code that grants items, credits a purchase, trusts a player's wallet, or receives Chain Daddy webhooks.
4
+ license: MIT
5
+ ---
6
+
7
+ # Verify receipts, sessions and webhooks
8
+
9
+ Never act on something because a client sent it. Each kind below has its own keys and its own `typ` claim,
10
+ so one can never pass for another - as long as you check `typ`.
11
+
12
+ ## Which token is which
13
+
14
+ | You have | `typ` claim | Algorithm | `iss` | Keys (JWKS) | Also check |
15
+ |---|---|---|---|---|---|
16
+ | Store receipt (a confirmed purchase) | `iap-receipt+v1` | EdDSA (Ed25519) | `https://chaindaddy.io` | `https://api.chaindaddy.io/api/v2/iap/jwks` | `storeId` is your store; `livemode` is `true` in production; credit each `orderId` once |
17
+ | Crown App session token (`session-token` action) | `app-session+v1` | EdDSA | `https://chaindaddy.io` | `https://api.chaindaddy.io/api/v2/apps/jwks` | `aud` is your app id (`<developerId>/<name>`); `exp` (5 min, allow 30 s skew); refuse a `jti` you have seen; `idv === true` if you need a verified person |
18
+ | Sign in with Chain Daddy ID token | `signin+v1` | ES256 | `https://api.chaindaddy.io` | `https://api.chaindaddy.io/api/v2/oauth/jwks` | `aud` is your client id; `nonce`; `exp` (5 min) |
19
+
20
+ Notes:
21
+ - The JWS **header** `typ` is a plain `JWT`. What the token is lives in the `typ` **claim**. Check the claim.
22
+ - Pick the key by the header's `kid`. Each set lists the current key first and keeps the previous one, so a
23
+ cached remote key set that refetches on an unknown `kid` survives rotation with no work.
24
+ - `sub` is the wallet in all three: lowercase `0x…` on EVM, base58 on Solana.
25
+
26
+ ## TypeScript (jose)
27
+
28
+ ```ts
29
+ import { createRemoteJWKSet, jwtVerify } from 'jose';
30
+
31
+ const API = 'https://api.chaindaddy.io';
32
+ const ISSUER = 'https://chaindaddy.io';
33
+ const receiptKeys = createRemoteJWKSet(new URL('/api/v2/iap/jwks', API));
34
+ const sessionKeys = createRemoteJWKSet(new URL('/api/v2/apps/jwks', API));
35
+
36
+ export async function verifyReceipt(jws: string, storeId: string) {
37
+ const { payload } = await jwtVerify(jws, receiptKeys, { algorithms: ['EdDSA'], issuer: ISSUER });
38
+ if (payload.typ !== 'iap-receipt+v1') throw new Error('not a store receipt');
39
+ if (payload.storeId !== storeId) throw new Error('receipt is for another store');
40
+ if (payload.livemode === false && process.env.NODE_ENV === 'production') throw new Error('test receipt');
41
+ return payload; // grant by payload.sku, payload.quantity, payload.wallet; dedupe on payload.orderId
42
+ }
43
+
44
+ export async function verifySession(token: string, appId: string) {
45
+ const { payload } = await jwtVerify(token, sessionKeys, {
46
+ algorithms: ['EdDSA'], issuer: ISSUER, audience: appId, clockTolerance: 30,
47
+ });
48
+ if (payload.typ !== 'app-session+v1') throw new Error('not an app session token');
49
+ if (!payload.exp) throw new Error('no expiry');
50
+ return payload; // payload.sub is the wallet; check payload.idv === true to require a verified person
51
+ }
52
+ ```
53
+
54
+ For the ID token, use your OpenID Connect library (see `sign-in-with-chain-daddy`), or `jwtVerify` with the
55
+ oauth key set, `issuer: 'https://api.chaindaddy.io'`, `audience: <client id>`, `algorithms: ['ES256']`, then
56
+ check `typ === 'signin+v1'` and the nonce. Go: `server/cdapi` in https://gitlab.com/opencrown/flux-gp-kit.
57
+
58
+ ## Refunds: offline is not enough for everything
59
+
60
+ An offline receipt check can't see a refund made since. For anything that matters after the fact, also check
61
+ online - `POST https://api.chaindaddy.io/api/v2/iap/receipts/verify` with `{"receipt": "…"}` returns
62
+ `valid` or `revoked` - or read the store's item ledger (`GET …/entitlements?wallet=`), which is the source of
63
+ truth for what a wallet owns now.
64
+
65
+ ## Webhook signatures
66
+
67
+ | Webhook | Header | How to check |
68
+ |---|---|---|
69
+ | Store webhook (`iap.*`) | `X-Webhook-Signature` | Hex HMAC-SHA256 of the **raw body**, keyed with the `whsec_…` secret as given |
70
+ | Crown App runner events | `X-App-Signature` | Hex HMAC-SHA256 of the raw body, keyed with the runner secret **hex-decoded to bytes** |
71
+
72
+ ```js
73
+ import crypto from 'node:crypto';
74
+ function verifyStoreWebhook(rawBody, signature, secret) {
75
+ const expected = crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
76
+ return signature?.length === expected.length &&
77
+ crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
78
+ }
79
+ ```
80
+
81
+ Check against the raw bytes before parsing JSON, compare in constant time, and ignore a repeated event `id`
82
+ (retries reuse it). Answer 2xx within 5 seconds.
83
+
84
+ ## Prove your checker with the test vectors
85
+
86
+ https://docs.chaindaddy.io/vectors/tokens.json holds two key sets (`jwks.session`, `jwks.receipts`), a fixed
87
+ `now`, an `appId`, a `storeId` and 15 tokens marked `valid` or not (expired, clock skew, another app, another
88
+ issuer, `typ` only in the header, no expiry, a forgery, a receipt offered as a session and the reverse,
89
+ another store). Load the sets with `createLocalJWKSet`, run every case at `now`, and pass only when your
90
+ code accepts exactly the valid ones. Add this as a unit test.
91
+
92
+ ## Mistakes to avoid
93
+
94
+ - Checking the header `typ` instead of the claim, or not checking `typ` at all.
95
+ - Verifying a session token against the receipt keys, or the other way round: they use different key sets.
96
+ - Using `iss: https://api.chaindaddy.io` for receipts and sessions. Only Sign in ID tokens use the `api.` issuer.
97
+ - Accepting a test receipt (`livemode: false`) or another store's receipt in production.
98
+ - Crediting the same `orderId` twice when the webhook and your poller both see it.
99
+ - Parsing the webhook body before checking its signature, or comparing with `===`.
100
+ - Treating a session token as API access: it only proves presence to your server.
101
+
102
+ ## Docs
103
+
104
+ - https://docs.chaindaddy.io/developer/verifying-tokens
105
+ - https://docs.chaindaddy.io/developer/store-and-rewards#verifying-receipts-on-your-server
106
+ - https://docs.chaindaddy.io/developer/security#session-tokens