Prerequisites
Node.js v18+
Required for both contract tests and the frontend. Download the LTS release.
Clarinet v2.x
The Clarity smart contract development toolkit from Hiro. Required for contract development and deployment.
You also need a Stacks wallet (Leather or Xverse) to interact with the testnet app. See the wallet setup guide for installation instructions.
Install dependencies
Heirloom has two separatepackage.json files — one at the project root for contract tests, and one in heirloom-app/ for the frontend.
Install contract test dependencies
From the project root, install the Clarinet SDK, Vitest, and related test tooling:This installs:
@stacks/clarinet-sdk— programmatic access to the simnet environmentvitest— the test runnervitest-environment-clarinet— Clarinet integration for Vitestchokidar-cli— file watching for thetest:watchscript
Run the frontend
Start the Vite development server from theheirloom-app/ directory:
Project structure
Clarinet
Clarinet is the primary development tool for Clarity contracts. It manages the simnet environment, contract deployment, and test execution.Installing Clarinet
Clarinet.toml
TheClarinet.toml file at the project root registers the heirloom-vault contract and any external contract dependencies (sBTC, USDCx) that are cached locally for simnet use. You do not need to modify this file for normal development.
How the simnet works
Clarinet’s simnet is a fully in-memory Stacks blockchain instance that the Clarinet SDK controls programmatically from your test code. It provides:- Pre-funded test accounts —
deployer,wallet_1throughwallet_10, each with STX and token balances. - Instant block mining —
simnet.mineEmptyBlocks(n)advances the chain bynblocks, allowing you to simulate time passing without waiting. - Contract deployment — the
heirloom-vaultcontract (and its external dependencies) are deployed automatically when the simnet starts. - Direct function calls —
simnet.callPublicFn()andsimnet.callReadOnlyFn()invoke contract functions and return typedClarityValueresults.
Recommended VS Code extensions
| Extension | Publisher | Purpose |
|---|---|---|
| Clarity for VS Code | Hiro Systems | Syntax highlighting, type checking, and inline diagnostics for Clarity contracts |
| ESLint | Microsoft | Linting for the TypeScript frontend code |
| Tailwind CSS IntelliSense | Tailwind Labs | Autocomplete for Tailwind utility classes in the frontend |
| Prettier | Prettier | Code formatting for TypeScript and MDX files |
