Deploy to Stacks testnet to test your dApp with real network conditions before mainnet. Testnet is the recommended first deploy target (no Docker required).
Contents
Requirements
Get testnet tokens
- Visit the Hiro testnet faucet
- Request STX and sBTC
- Add your mnemonic to
Testnet.toml:
Never commit real mnemonics. The bundled pre-commit hook blocks likely seed phrases in Testnet.toml and Mainnet.toml.
Deploy to testnet
Use --yes for non-interactive deploys (CI and agents). Preview without broadcasting:
Deploy a single contract:
Wait for on-chain confirmation:
This generates a deployment plan, submits transactions, and updates deployments.json.
Start frontend
Opens at http://localhost:3000 connected to testnet.
Test interactions
- Connect Leather or Xverse (set to Testnet)
- Use the debug UI to call contract functions
- Verify wallet prompts and confirmations
Redeploy after changes
Contracts are immutable. Changes create new versions:
The CLI handles versioning automatically unless you pass --no-auto-version.
Troubleshooting
Transaction failures
- Check gas fees
- Verify mnemonic and derivation path
- Ensure sufficient testnet balance
- Add
--yes if deploy hangs on interactive prompts
Contract errors
- Run
stacksdapp check for syntax validation
- Test locally with devnet first
- Check contract requirements
- For SIP tokens: omit
(impl-trait …) on testnet (templates ship without it)
Frontend issues
- Verify network configuration in
.env.local (NEXT_PUBLIC_NETWORK=testnet)
- Check browser console for errors
- Ensure wallet is set to testnet
- Do not run
stacksdapp dev (devnet) when contracts were deployed to testnet