This repository contains the on-chain bridge contract and supporting tooling for the Midnight L2 rollup. The bridge contract, written in Compact, is deployed on the Midnight L1 and enables bidirectional asset transfers between L1 and the Sovereign SDK rollup (L2). Key capabilities include unshielded NIGHT deposits (L1→L2), proof-based withdrawal claims (L2→L1), batch commitment and finalization with threshold signatures, and verifier set / sequencer / finalizer management. The project ships as a Turbo monorepo with two packages: the Compact smart contract (bridge-contract) and a TypeScript CLI and executor service (bridge-cli) used by the rollup node to submit L1 transactions.
- Node.js (v23+) & npm (v11+)
- Docker
- Git LFS (for large files)
- Compact (Midnight developer tools)
- Lace (Browser wallet extension)
- Faucet (Preview Network Faucet)
# Install and initialize Git LFS
sudo dnf install git-lfs # For Fedora/RHEL
git lfs install# Install the latest Compact tools
curl --proto '=https' --tlsv1.2 -LsSf \
https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh# Install the latest compiler
compact update +0.30.0# Check versions
node -v
npm -v
docker -v
git lfs version
compact check # Should show latest version├── bridge-cli/ # CLI tools
└── bridge-contract/ # Smart contracts
This project uses a git submodule for the Compact compiler (as docs for AI). Clone with:
git clone --recurse-submodules <repo-url>If you already cloned without submodules:
git submodule update --init
### Install Project Dependencies and compile contracts
```bash
# In one terminal (from project root)
npm install
npm run build- Create .env file from template under bridge-cli folder
# From project root
npm run setup-standaloneThe Bridge contract is deployed with bridge-cli (standalone CLI or via the executor's POST /deploy endpoint). Quick start: from project root run npm run setup-standalone, then e.g. cd bridge-cli && npm run deploy-undeployed, or npm run cli -- deploy -n undeployed with env set (see bridge-cli/.env_template). All constructor arguments (owner, layer2ChainId, rollupId, genesis roots, verifier set, signatureThreshold, initialSequencer, initialFinalizer) are optional and can be overridden. See bridge-cli/README.md for deploy options, constructor override flags, and executor usage.