Deploy a contract

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


Generate a deployment plan:

Terminal
$
clarinet deployments generate --<network>

Supported networks: consoledevnettestnet, consolemainnet_

Deploy contracts:

Terminal
$
clarinet deployments apply --<network>

Add Contract Requirements

Add external contract dependencies:

Terminal
$
clarinet requirements add <contract-principal>

Example:

Terminal
$
clarinet requirements add SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait

Deployment Plan Transactions

Your deployment plans can include various transaction types:

Contract Operations

- contract-publish:
contract-name: my-contract
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
cost: 5960
path: contracts/my-contract.clar
clarity-version: 2
- contract-call:
contract-id: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.my-contract
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
method: my-function
parameters: []
cost: 5960

Asset Transfers

- stx-transfer:
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
recipient: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.my-contract
mstx-amount: 1000
memo: '0x01'
cost: 10000
- btc-transfer:
expected-sender: mjSrB3wS4xab3kYqFktwBzfTdPg367ZJ2d
recipient: bcrt1qnxknq3wqtphv7sfwy07m7e4sr6ut9yt6ed99jg
sats-amount: 100000000
sats-per-byte: 10

Simnet Operations

- emulated-contract-publish:
contract-name: my-contract
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
path: contracts/my-contract.clar
clarity-version: 2
- emulated-contract-call:
contract-id: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.my-contract
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
method: my-function
parameters: []
Note

For functions that take no arguments or read-only functions, use an empty parameters list: parameters: []