Contents
- New project to testnet
- Contract iteration loop
- Custom frontend with hooks
- Add SIP-010 token
- Add SIP-009 NFT
- Adopt existing Clarinet project
- Local devnet
- Mainnet deploy
- Upgrade project
- CI pipeline
- Clean slate
- Frontend-only against remote network
New project to testnet
Recommended first path (no Docker):- Fund testnet STX: Hiro testnet faucet
- Edit
contracts/settings/Testnet.tomlwith deployer mnemonic (local only; never commit) - Edit
contracts/contracts/counter.claras needed stacksdapp check && stacksdapp generate && stacksdapp teststacksdapp deploy --network testnet --yesstacksdapp dev --network testnet→ http://localhost:3000
Contract iteration loop
stacksdapp dev --network testnet, run generate manually or use stacksdapp generate --watch in a second terminal.
Custom frontend with hooks
End-to-end path when building your own UI (not just the debug panel):- Contracts — edit
contracts/contracts/*.clarorstacksdapp add … - Validate —
stacksdapp check && stacksdapp generate && stacksdapp test - Deploy —
stacksdapp deploy --network testnet --yes(populatesdeployments.json) - Custom UI — create
frontend/src/components/Feature.tsxwith"use client"; import hooks from@/generated/hooks - Page — add component to
app/page.tsxor a new App Router route - Run —
stacksdapp dev --network testnet; connect wallet for public calls
<DebugContracts /> during development to compare behavior with your custom components.
Add SIP-010 token
contracts/contracts/my-token.clar, then check → generate → test → deploy.
Trait functions, hooks, and impl-trait rules: SIP standards
Add SIP-009 NFT
Adopt existing Clarinet project
From a repo withClarinet.toml (standard or nested layout):
- Normalize layout to
contracts/Clarinet.toml+contracts/contracts/*.clar - Add frontend template (if missing)
- Install npm deps, generate bindings, git hooks, agent skill
- Write
stacksdapp.tomlif missing
Local devnet
Requires Docker Desktop and Clarinet 3.23+.- Terminal 1 is only the chain. It does not start Next.js or deploy.
- The debug UI says Choose Wallet and lists the funded accounts in
settings/Devnet.toml. - A name already on that chain is versioned (
counter→counter-v2), including after you restart the toolchain. - Those mnemonics are public. Devnet only.
Mainnet deploy
- Audit contracts and test on testnet first
- Set
contracts/settings/Mainnet.tomlmnemonic (never commit) - For SIP tokens: uncomment mainnet
impl-traitline (see SIP standards) stacksdapp deploy --network mainnet --dry-run— review plan and feesstacksdapp deploy --network mainnet --yes --wait-confirmstacksdapp dev --network mainnet
Upgrade project
stacksdapp CLI.
Guide: Upgrade a project
CI pipeline
--json for machine-readable output. Rely on exit codes.
Do not run devnet in CI unless Docker is available. Prefer testnet for deploy checks.
Clean slate
.clar sources.
When a devnet is running, clean restores that chain to the snapshot and leaves the process up. It waits until Stacks mines a new block. If the tip does not move, it restarts only the signer. Deploy after that finishes.
When no devnet is running, clean deletes the cache so the next stacksdapp dev starts fresh.
After clean: stacksdapp generate to restore bindings.
Redeploy / naming collisions
By default, redeploying auto-versions (counter → counter-v2) on devnet, testnet, and mainnet. Chain state on devnet survives a toolchain restart. To fail instead: