Overview
Staxiq smart contracts are deployed using Clarinet, the official Stacks smart contract development tool. This guide covers local development, testnet deployment, and mainnet deployment.Clarity contracts are immutable after deployment. Thoroughly test on testnet before deploying to mainnet.
Prerequisites
Get Testnet STX
For testnet deployment, get free STX from the Stacks Faucet
Project Structure
The Staxiq contracts repository has the following structure:Clarinet Configuration
The main configuration file defines the contract:Clarinet.toml
Staxiq uses Clarity 4 (latest version as of 2026)
Set to
'latest' to use the most recent Stacks epoch featuresLocal Development
Start Clarinet Console
Test contract functions interactively:Run Tests
Run the test suite:Testnet Deployment
1. Configure Testnet Settings
Create or editsettings/Testnet.toml:
settings/Testnet.toml
2. Check Contract Validity
Validate your contract before deploying:3. Deploy to Testnet
Deploy the contract:4. Verify Deployment
After deployment, you’ll see output like:Mainnet Deployment
Pre-Deployment Checklist
Test Thoroughly
- All unit tests pass
- Integration tests on testnet successful
- Security audit completed (for high-value contracts)
- Gas costs estimated and acceptable
Prepare Mainnet Wallet
- Mainnet wallet has sufficient STX for deployment fees
- Private key/mnemonic securely stored
- Deployment address verified
1. Configure Mainnet Settings
settings/Mainnet.toml
2. Generate Deployment Plan
deployments/default.mainnet-plan.yaml:
Review the estimated costs carefully. Deployment fees depend on contract size and complexity.
3. Deploy to Mainnet
4. Save Deployment Info
After successful deployment, save the contract details:deployments/mainnet-deployment.json
5. Update Frontend Configuration
Update your frontend to use the mainnet contract address:src/services/contractService.js
Deployment Costs
Estimated costs for deployingstaxiq-user-profile.clar:
| Network | Estimated Cost | Confirmation Time |
|---|---|---|
| Devnet | Free | Instant |
| Testnet | Free (use faucet) | ~10 minutes |
| Mainnet | ~0.3-0.8 STX | ~10 minutes |
Actual costs vary based on network congestion and contract complexity.
Post-Deployment
Verify Contract on Explorer
Check your deployed contract:Testnet Explorer
View testnet deployments and transactions
Mainnet Explorer
View mainnet deployments and transactions
Update Documentation
After deployment:- Update contract addresses in documentation
- Publish API reference with deployed contract ID
- Update integration guides with mainnet examples
- Announce deployment to users
Monitor Contract Usage
Track contract interactions:Troubleshooting
Common Issues
Error: Insufficient funds
Error: Insufficient funds
Solution: Ensure your deployer wallet has enough STX for deployment fees. Get testnet STX from the faucet.
Error: Contract already exists
Error: Contract already exists
Solution: Clarity contracts are immutable. You cannot redeploy with the same name. Use a different contract name or deployer address.
Error: Invalid Clarity syntax
Error: Invalid Clarity syntax
Solution: Run
clarinet check to validate your contract syntax before deployment.Error: Transaction timeout
Error: Transaction timeout
Solution: Network congestion can delay transactions. Wait 15-20 minutes and check the explorer. Increase the fee for faster confirmation.
Getting Help
Clarinet Docs
Official Clarinet documentation
Stacks Discord
Get help from the Stacks community
Hiro Support
Contact Hiro for technical support
GitHub Issues
Report bugs or request features
Next Steps
Testing
Learn how to test contracts before deployment
Integration
Integrate deployed contracts into your frontend