Deploy a contract

Use Clarinet to publish your contracts to the devnet, testnet, or mainnet networks.


The first step to deploying your contracts is to generate a deployment plan.

Terminal
$
clarinet deployment generate --testnet
deployments/default.testnet-plan.yaml
---
id: 0
name: Testnet deployment
network: testnet
stacks-node: "http://localhost:20443"
bitcoin-node: "http://devnet:devnet@localhost:18443"
plan:
batches:
- id: 0
transactions:
- contract-publish:
contract-name: counter
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
cost: 6940
path: contracts/counter.clar
anchor-block-only: true
clarity-version: 2
epoch: "2.5"
What are deployment plans?

These are yaml files for creating reproducible deployment steps that publish a collection of on-chain transactions and contracts to a network.

Deploy

Once you've reviewed your deployment plan at deployments/<default.<network>-plan.yaml, you can use the apply command to handle the deployments of your contracts.

Terminal
$
clarinet deployment apply --testnet
Dive deeper

Check out the create deployment plans guide to learn more on how to customize your deployment plans.

On this page