Tools for compiling, building, and testing Compact smart contracts. This is a monorepo containing:
packages/cli: CLI utilities to run the Compact compiler and builderpackages/simulator: TypeScript simulator to run and test Compact contracts locally
Until packages are published to the npm registry, you can consume this repo from another project using a git submodule:
# In your project
git submodule add https://github.com/OpenZeppelin/compact-tools
git submodule update --init --recursive
# Install and build the tools
yarn --cwd tools/compact-tools install
yarn --cwd tools/compact-tools build
# Use the simulator as a local dependency
# package.json
"devDependencies": {
"@openzeppelin/compact-tools-simulator": "file:./compact-tools/packages/simulator"
}
yarn install
# Call the CLIs directly or via scripts
node compact-tools/packages/cli/dist/runCompiler.js --help
node compact-tools/packages/cli/dist/runBuilder.js --help- Node.js >= 20 (root and
packages/cli), >= 22 forpackages/simulator - Yarn 4 (Berry)
- Turbo
- Optional: Midnight Compact toolchain installed and available in
PATH
Confirm your Compact toolchain:
$ compact compile --version
Compactc version: 0.26.0
0.26.0Install dependencies at the repo root:
nvm install
yarnBuild everything:
yarn buildRun tests (root runs package tests via Turbo):
yarn testFormat and lint (Biome):
yarn lint
yarn lint:fixClean generated artifacts:
yarn clean@openzeppelin/compact-tools-cli (packages/cli)
CLI utilities for compiling and building Compact smart contracts.
Quickstart:
# Compile all .compact files
compact-compiler
# Skip ZK proofs for faster development builds
compact-compiler --skip-zk
# Compile specific directory
compact-compiler --dir security
# Full build (compile + TypeScript + copy artifacts)
compact-builderSee packages/cli/README.md for full documentation including all options, programmatic API, and examples.
@openzeppelin/compact-tools-simulator (packages/simulator)
TypeScript simulator for testing Compact contracts locally.
Quickstart:
import { createSimulator } from '@openzeppelin/compact-tools-simulator';
const simulator = createSimulator({});
// Deploy and execute contract circuits, inspect state, etc.See package tests in packages/simulator/src/integration and src/unit for full examples.
Before opening a PR, please read CODE_OF_CONDUCT.md. Use the root scripts to build, test, and format. For targeted work inside a package, run the scripts in that package directory.
MIT