Local Blockchain Development

Clarinet ships with a complete local blockchain environment so you can build, test, and debug smart contracts without deploying to a public network. This environment is called Devnet.
Starting your local blockchain
Launch Devnet with all required services:
Useful flags:
--manifest-path <path>
Use an alternate Clarinet.toml
--no-dashboard
Stream logs instead of showing the interactive UI
--deployment-plan-path <path>
Apply a specific deployment plan
--use-on-disk-deployment-plan
Use an existing plan without recomputing
--use-computed-deployment-plan
Recompute and overwrite the plan
--from-genesis
Skip the embedded Epoch 4.0 snapshot and boot from genesis, walking through every epoch
--create-new-snapshot
Boot from genesis and save a new global snapshot after the first Epoch 4.0 Stacks block
By default the dashboard displays service health, recent transactions, block production, contract deployments, and resource usage. Use --no-dashboard in CI or when you prefer streaming logs.
Core services and features
Devnet starts these services:
Stacks node
20443
Processes transactions and mines blocks
Bitcoin node
18443
Provides block anchoring in regtest mode
Stacks API
3999
REST API for blockchain data
Postgres
5432
Indexes blockchain data
Stacks Explorer
8000
Browse transactions in a web UI
Bitcoin Explorer
8001
View the Bitcoin regtest chain
Devnet includes pre-funded accounts:
When Devnet starts, it automatically deploys your project contracts so you can interact with them immediately.
Configuration and customization
Configuration files in your project control Devnet behavior.
Basic configuration
settings/Devnet.toml defines network settings:
Port configuration
Avoid local conflicts by customizing ports:
Mining intervals
Control block production speed. Set the key once; the commented lines show other values:
Custom accounts
Add accounts with specific balances:
Accessing services
Devnet exposes several ways to interact with the blockchain.
Stacks Explorer
Visit the explorer to browse transactions, blocks, contract state, and account balances:
API endpoints
Query blockchain data with the Stacks API:
Common endpoints:
/v2/info: network information/v2/accounts/{address}: account details/v2/contracts/source/{address}/{name}: contract source code/extended/v1/tx/{txid}: transaction details
Direct RPC
Submit transactions directly to the Stacks node:
Useful RPC endpoints:
/v2/transactions: broadcast transactions/v2/contracts/call-read: read-only contract calls/v2/fees/transfer: fee estimates for STX transfers
Advanced configuration
Performance optimization
For faster development cycles:
Epoch configuration
Devnet activates each Stacks epoch at a Bitcoin block height set under [devnet] in settings/Devnet.toml. These are the Clarinet v3.24.1 defaults; a key you leave out takes the default.
Devnet's PoX cycle is 20 Bitcoin blocks long with a 5-block prepare phase, starting at block 100. epoch_3_0 has to fall inside a reward phase; Clarinet refuses to start otherwise and names the offending height in the error.
By default clarinet devnet start restores an embedded snapshot taken after the first Epoch 4.0 Stacks block, so the chain is in Epoch 4.0 with pox-5 deployed as soon as the dashboard shows the network ready. Changing any epoch_* height makes the snapshot unusable; Clarinet prints which fields differ from the snapshot and boots from genesis instead, which takes longer because every epoch transition is mined live. --from-genesis forces that path without editing the file.
To test against PoX-5 on Devnet, keep the defaults. To test a contract's behavior across an epoch boundary, raise epoch_4_0 so the contract deploys before it, then watch the transition in the --no-dashboard logs.
Custom node/signer images
Clarinet runs Devnet with a pinned tag for each Docker image. Clarinet v3.24.1 uses:
stacks node:
ghcr.io/stacks-network/stacks-core:4.0.1-alpinestacks signer:
ghcr.io/stacks-network/stacks-signer:4.0.1-alpine
Keep the defaults unless you are testing a node build. The Clarinet release pins the image that matches its epoch defaults; an older node image cannot reach epoch_4_0.
To run other images, set stacks_node_image_url and stacks_signer_image_url under [devnet] in settings/Devnet.toml. This example runs the stacks-core 4.0.4 release in its Debian build, pinned by digest so the image cannot change under the same tag:
For the Alpine builds of the same release, use the 4.0.4-alpine tags (ghcr.io/stacks-network/stacks-core:4.0.4-alpine and ghcr.io/stacks-network/stacks-signer:4.0.4-alpine).
Clarinet does not compare the image when it decides whether to restore its snapshot: the check covers the epoch_* heights, the signer keys, and the stacking orders. A custom image therefore still starts from the snapshot embedded in the Clarinet release. Add --from-genesis to boot the custom image from genesis instead.
Common issues
Last updated
Was this helpful?