Clarinet is a Clarity runtime packaged as a command-line tool, designed to streamline the creation, testing, and deployment of smart contracts on the Stacks blockchain. This powerful utility empowers developers to build high-quality Clarity smart contracts with precision and confidence.
Key Features:
Interactive REPL: Engage with the Clarity REPL for real-time contract testing and exploration.
Unit Testing Framework: Write and execute unit tests in a familiar JavaScript environment to validate contract behavior.
Local Devnet Simulation: Deploy contracts to a local development network, enabling seamless testing before mainnet deployment.
VSCode Extension Integration: Enhance your workflow with debugging tools, autocompletion, and linting directly within VSCode.
Audience & Benefit:
Tailored for smart contract developers working with Clarity on the Stacks blockchain, Clarinet offers a robust environment to accelerate development. By providing tools for rapid iteration, thorough testing, and efficient deployment, Clarinet ensures that developers can deliver reliable and scalable smart contracts with ease.
README
Clarinet
Clarinet is the fastest way to build, test, and deploy smart contracts on the Stacks blockchain. It
gives you a local devnet, REPL, testing framework, and debugging tools to ship high-quality Clarity
code with confidence.
๐งโ๐ป Leverage a powerful CLI: Create new projects, manage your smart contracts and their
dependencies using clarinet requirements, and interact with your code through the built-in REPL.
๐งช Write unit tests with the SDK: Use the Clarinet SDK to write unit tests in a familiar JS
environment and validate contract behavior.
๐ ๏ธ Run a private blockchain environment: Spin up a local devnet with nodes, miners, and APIs so
you can test and integrate your code.
๐ Enhance your editor with the VSCode extension: Get linting, step-by-step debugging,
autocompletion, and documentation as you write smart contracts.
Contributions are welcome and appreciated. The following sections provide information on how you can
contribute to Clarinet.
Prerequisites
Before contributing to Clarinet, you need the following tools.
Although it will work with older versions, the team always tries to keep up with the latest versions
of Rust and Node.js (LTS) tooling.
Rust (>=1.94.1)
Cargo (>=1.94.1)
Node (>=v24.14.1)
PNPM (>=10.33.0)
Guide
This repo follows the Conventional Commit
specification when writing commit messages.
Note: These conventions are helpful for any commit message, but all PR end up being merged with
"squash and merge", giving another chance to refine the commit messages.
To start contributing, fork this repo and open a new branch:
Fork this repo and clone the fork locally.
Create a new branch
git checkout -b
Contributing to the CLI
After making your changes, ensure the following:
cargo build runs successfully.
cargo tst runs successfully.
cargo tst is an alias declared in ./.cargo/config.toml, it runs
cargo-nextest
You have formatted your code with cargo fmt-stacks
All functional tests in the components/clarinet-cli/examples directory pass.
for testdir in $(ls components/clarinet-cli/examples); do
pushd components/clarinet-cli/examples/${testdir}
../../../../target/debug/clarinet check .
popd
done
Submit a pull request against the main branch for review.
Contributing to the JS SDK
For VSCode users, we recommend opening the following workspace
./components/clarinet-sdk/clarinet-sdk.code-workspace. It's set up so that rust-analyzer uses the
Wasm target.
The SDK is divided between the Rust lib compiled to Wasm ./components/clarinet-sdk-wasm and a TS
wrapper around it: ./components/clarinet-sdk.
Compile the Wasm package with pnpm run build:sdk-wasm