Skip to content

Start from a template ​

A template is a complete, working widget that the CLI copies into a new folder for you. Each one builds, passes the checks and runs on a coin page as it stands, so you change it into yours.

TemplateWhat it isSize on the page
communityYour token's open poll with a vote weighted by holding, its links and its holder count, in one card4x3
interactiveA generative canvas piece that visitors draw on. You set its title and palette on your page, and holders can unlock a palette4x3
gameA three.js arcade game with a best score, fullscreen, and a shop that sells from your token's store6x3
bash
chaindaddy app init community my-app     # or: interactive, game
cd my-app
npm install
npm run dev

This is step 3 of Publish your first app: sign in and join first, and the same page takes you from here to a coin page. For a storefront, a tool or anything else, start blank with chaindaddy app init widget my-app. A game you already built needs no template: Engine apps.

The folder's name becomes the app's name, and its id is <your developer ID>/<folder>. --name and --description set the display name and the description.

What you get ​

my-app/
├── capp.json            the manifest, with your id, name and developer ID filled in
├── package.json         the scripts the quickstart uses: dev, build, validate, scan, pack, sign, submit
├── README.md            this template's guide
└── src/
    ├── index.tsx        the component the page renders (capp.json's entryComponent)
    ├── ui.tsx           the page's theme colors, and a button in them
    ├── host.ts          the page's actions as promises that always answer
    ├── widget-types.ts  the contract: the props and every action with its answer
    └── …                the template's own files, below
  • src/host.ts sends every action to the page and always gets an answer back: ask() for any action, plus sign-in, platform API calls and toasts. Send your own actions through it.
  • src/store.ts (in interactive and game) has useIap, which reads your token's store (the catalog, what the viewer holds, prices) and buys one item at a time. See Store and Rewards.

Each template declares the permissions and data scopes it uses. If you add an action, add its permission to capp.json.

community ​

Your token's community in one card: its open poll with the standing and a VOTE, its links, and how many hold it.

FileWhat it does
src/index.tsxCommunityCard: the poll, the links, the holders
src/polls.tsThe token's polls: the open ones, their results, and casting a vote

The poll. Open a Community Poll on your coin page, and the card shows the first open one. A vote counts by what the voter holds at the poll's snapshot. VOTE asks the viewer's wallet to sign the vote (the page shows it on its own sheet first), then sends it to Chain Daddy, which checks it and weighs it. See Poll votes.

Links and holders. The links come from your page (the website, X, Telegram and Discord), and a verified one is marked. The holder count is your page's own.

Permissions: fetch:self-api and wallet:sign. Data: chain:info, market:holders and profile:social.

interactive ​

A generative 2D canvas: visitors drag across it and leave trails of light that drift and fade. You give it a title and a palette on your coin page.

FileWhat it does
src/index.tsxTrailCanvas: the owner's editor, the config, the holders' palette
src/art.tsThe piece: particles on a flow field. It stops drawing while it's off screen or the tab is hidden
src/config.tsThe owner's title and palette, loaded and saved as this app's config on the page

Your settings. As the page's owner, you get EDIT: a title and a palette from a few presets. SAVE stores them in the app's config on that page, and every visitor reads it. The config is kept under the app's id, the APP_ID constant in src/index.tsx: keep it the same as capp.json's id (the CLI writes both).

The holders' palette. An unlock item in your store whose metadata says { "slot": "palette" } lets visitors who hold enough of your token view the piece in that palette. metadata.colors sets it: the background first, then one to five trail colors. The item's rule does the unlocking, so the app buys nothing and needs no iap:purchase.

bash
chaindaddy iap sku create MYTOKEN --sku palette.holders --type unlock --name "Holders' palette" \
  --rule '{"hold":{"min":"1000000000000000000000000"}}' \
  --metadata '{"slot":"palette","colors":["#0d0a02","#fbbf24","#fde68a","#f97316"]}'

MYTOKEN is your coin page, by its ticker. min is in base units: the amount with the token's decimals written out. Most tokens have 18 decimals, so 1,000,000 tokens is 1 followed by 24 zeros.

Permissions: fetch:self-api. With prefers-reduced-motion, nothing moves by itself.

game ​

A small three.js arcade game: a ship on an endless lane, dodging blocks. The best score stays on the viewer's device, PLAY goes fullscreen, and a SHOP sells from your token's store.

FileWhat it does
src/index.tsxLaneRunner: the title, the score, game over, fullscreen, the best score
src/game.tsThe three.js scene, the input and the frame loop, which pauses while the tab is hidden or the shop is open
src/shop.tsxThe SHOP: the catalog with prices, BUY, SIGN IN, and the liveries

Permissions: ui:fullscreen, iap:purchase, storage:local (the best score) and fetch:self-api (the store's catalog). The page sells the item on its own sheet.

Liveries. An item in your store whose metadata says { "slot": "livery", "color": "#rrggbb" } recolors the ship for a viewer who holds it. With several, the SHOP lets them pick. Other items show in the SHOP as they are; give them a meaning in your game the same way, by metadata.slot.

bash
chaindaddy iap store open --page MYTOKEN
chaindaddy iap sku create MYTOKEN --sku livery.mint --type non_consumable --name "Mint livery" \
  --price-usd 2 --metadata '{"slot":"livery","color":"#39ff88"}'

Opening a store needs a paid plan and the Seller Terms: Who can open a store. For online multiplayer with your own game server and prizes, read the FLUX GP kit, the full game this template comes from.

Also in the list ​

chaindaddy app init --help lists three more names. None copies a template:

  • gallery stops and points you to the no-code Gallery.
  • engine stops too: a Godot or Unity web export needs no starter code. See Engine apps.
  • web wraps a game you already built for the browser: Web builds.

Rules ​

  • No paid entry to anything with a prize.
  • Nothing paid for is decided by chance: no loot boxes.
  • Holding your token can unlock things. It does not earn anything.