Skip to main content

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

1

Install Clarinet

Install Clarinet CLI:
Verify installation:
2

Get Testnet STX

For testnet deployment, get free STX from the Stacks Faucet
3

Prepare Wallet

Export your wallet’s private key or mnemonic phrase for deployment

Project Structure

The Staxiq contracts repository has the following structure:

Clarinet Configuration

The main configuration file defines the contract:
Clarinet.toml
number
Staxiq uses Clarity 4 (latest version as of 2026)
string
Set to 'latest' to use the most recent Stacks epoch features

Local Development

Start Clarinet Console

Test contract functions interactively:
In the console, you can call contract functions:

Run Tests

Run the test suite:
With coverage and cost analysis:
Watch mode for development:
Always run tests before deployment to catch bugs early.

Testnet Deployment

1. Configure Testnet Settings

Create or edit settings/Testnet.toml:
settings/Testnet.toml
Never commit your mnemonic or private key to version control. Use environment variables or a secure keychain.

2. Check Contract Validity

Validate your contract before deploying:
This runs static analysis and checks for common issues.

3. Deploy to Testnet

Deploy the contract:
Or use the integrated deployment command:

4. Verify Deployment

After deployment, you’ll see output like:
Verify on Testnet Explorer:

Mainnet Deployment

Mainnet deployment is permanent and immutable. Triple-check everything before deploying.

Pre-Deployment Checklist

1

Test Thoroughly

  • All unit tests pass
  • Integration tests on testnet successful
  • Security audit completed (for high-value contracts)
  • Gas costs estimated and acceptable
2

Prepare Mainnet Wallet

  • Mainnet wallet has sufficient STX for deployment fees
  • Private key/mnemonic securely stored
  • Deployment address verified
3

Documentation Ready

  • Contract functions documented
  • Integration guide complete
  • User documentation prepared

1. Configure Mainnet Settings

settings/Mainnet.toml

2. Generate Deployment Plan

Review the generated plan in deployments/default.mainnet-plan.yaml:
Review the estimated costs carefully. Deployment fees depend on contract size and complexity.

3. Deploy to Mainnet

Confirm the deployment:

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 deploying staxiq-user-profile.clar:
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:
  1. Update contract addresses in documentation
  2. Publish API reference with deployed contract ID
  3. Update integration guides with mainnet examples
  4. Announce deployment to users

Monitor Contract Usage

Track contract interactions:

Troubleshooting

Common Issues

Solution: Ensure your deployer wallet has enough STX for deployment fees. Get testnet STX from the faucet.
Solution: Clarity contracts are immutable. You cannot redeploy with the same name. Use a different contract name or deployer address.
Solution: Run clarinet check to validate your contract syntax before deployment.
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