
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
create-midnight-app
Advanced tools
π Scaffold for building Midnight smart contracts with dynamic type detection and automated CLI generation
The fastest way to build Midnight smart contracts with automated CLI generation.
Create a new Midnight smart contract project in seconds with zero configuration. This scaffold provides everything you need to build, test, and deploy smart contracts on the Midnight blockchain with enhanced data type support and professional tooling. The scaffold comes with pre-generated wallet.
π From contract to production in minutes, not hours.
"It feels almost like magic :)"
β Midnight developers oncreate-midnight-app
.compact file and everything auto-generatesGet started with Midnight development in under 2 minutes: make sure you are using the latest version
# Create a new project
npx create-midnight-app@latest my-contract
# Navigate to project
cd my-contract
# Set up your wallet environment
mv .env.example .env
# Create your smart contract
touch voting.compact
# deploy to testnet & start interacting
npm run deploy
β
That is ALL!
β οΈ Make sure you are using Node 20 β this is important!
π Write Your First Contract:
Edit your contract file:
pragma language_version 0.15;
import CompactStandardLibrary;
export ledger votes: Counter;
export circuit vote(): [] {
votes.increment(1);
}
export circuit get_votes(): Uint<64> {
return votes;
}
π― Deploy in an instant
# Auto-generate CLI, compile & deploy contract and start interacting
npm run deploy
This single command:
π Deploy & Test:
# For testnet wallet generation
npm run wallet - # the generated wallet will automatically be saved into .env
# For requesting token from faucet
npm run faucet
# For testnet deployment
npm run deploy
| Command | Description | Environment |
|---|---|---|
npm run dev | π Main development command - syncs, compiles, generates CLI | Local |
npm run deploy | π Deploy to Midnight testnet | Testnet |
npm run wallet | π generate a new key-pair wallet on Midnight | Testnet |
npm run balance | π° Check current testnet wallet balance | Testnet |
npm run faucet | π° Request testnet tokens | Testnet |
npm run check | β Verify scaffold is ready and show status | Local |
npm run build | π¨ Build all workspaces | Local |
npm run deploy:new | π¨ Deploy to Midnight testnet(default) | Testnet |
npm run deploy:join | π¨ Auto-join existing contract | Testnet |
npm run docs | π Open the official Compact documentation |
| Flag | Behavior | Use Case |
|---|---|---|
--dry-run | Preview commands only | Testing scripts |
--help | Show detailed help | Documentation |
.compact file in the project rootnpm run dev to generate everything automaticallynpm run deploy for testnet deployment & npm run wallet a new wallet generationnpm run dev/deploy, repeat.compact contract in the project rootnpm run dev copies it to build directory.compact contractsnpm run deploy for full testnet development setup--dry-run flagnpm run balancenpm run faucetmy-project/
βββ my-contract.compact β π Your smart contract (edit here!)
βββ package.json β π¦ Main project configuration
βββ .env β π Wallet configuration (auto-generated)
βββ README.md β π Project documentation
βββ boilerplate/ β ποΈ Auto-generated tooling
βββ contract/ β π¨ Contract compilation workspace
β βββ src/ β π Auto-synced contracts & witnesses
β βββ my-contract.compact β Synced from root
β βββ witnesses.ts β π Private state functions
β βββ managed/ β ποΈ Compiled output & ZK keys
βββ contract-cli/ β π₯οΈ Generated CLI application
β βββ src/ β π― Dynamic CLI code
β β βββ api.ts β π Contract interaction API with enhanced data type support
β β βββ cli.ts β π₯οΈ Interactive CLI interface
β β βββ enhanced-api.ts β π Contract metadata & analysis
β βββ standalone.yml β π³ Docker configuration for local node
βββ scripts/ β βοΈ Build & deployment automation
βββ auto-generator.js β π Core auto-generation engine
βββ deploy.js β π Deployment orchestrator
βββ check-balance.js β π° Wallet balance checker
βββ request-faucet.js β π° Testnet token requests
The scaffold uses source-driven development:
.compact file to find all functionspragma language_version 0.15;
import CompactStandardLibrary;
export ledger count: Counter;
export circuit increment(value: Uint<16>): [] {
count.increment(value);
}
export circuit decrement(value: Uint<16>): [] {
count.decrement(value);
}
export circuit get_count(): Uint<64> {
return count;
}
pragma language_version 0.15;
import CompactStandardLibrary;
export ledger votes_for: Counter;
export ledger votes_against: Counter;
export circuit vote_yes(): [] {
votes_for.increment(1);
}
export circuit vote_no(): [] {
votes_against.increment(1);
}
export circuit get_results(): [Uint<64>, Uint<64>] {
return [votes_for, votes_against];
}
The system automatically:
.compact files// Automatically detected from your contract:
export circuit increment(value: Uint<16>): [] { ... }
export circuit post(message: Opaque<"string">): [] { ... }
export circuit get_count(): Uint<64> { ... }
// Becomes CLI options with intelligent parameter handling:
// 1. Increment (numeric parameter with validation)
// 2. Post (string parameter with opaque type conversion)
// 3. Get Count (read-only function)
System Requirements:
compactc compiler# Check system requirements
node --version && docker --version && git --version
# Install Midnight compiler (if not installed)
# Follow Midnight documentation for compactc installation
| Issue | Symptoms | Solution |
|---|---|---|
| Contract not detected | "No .compact files found" | Ensure .compact file is in project root |
| Docker issues | Local deployment fails | Ensure Docker Desktop is running |
| Testnet connection | Wallet sync timeouts | Check internet connection, try npm run balance |
| Zero balance | Deployment fails with "insufficient funds" | Run npm run faucet or use manual faucet |
| Permission errors | File system access denied | Run with appropriate permissions or check file ownership |
# Verify contract syntax
npm run build
# Check wallet status
npm run balance
# View detailed logs
npm run deploy --dry-run
# Test local environment
docker ps
Create a .env file for configuration:
# Wallet Configuration
WALLET_SEED=your-64-character-hex-seed-phrase
WALLET_ADDRESS=your-wallet-address
Option 1: Auto-generate wallet (Recommended)
npm run wallet
Option 2: Manual setup
# Copy example configuration
cp .env.example .env
# Edit .env file and add your seed
WALLET_SEED=your-64-character-hex-seed-phrase-here
# Check wallet balance
npm run balance
# Request testnet tokens
npm run faucet
Root .compact β Sync to src/ β Compile Contract β Generate ZK Keys β
Update TypeScript β Build CLI β Ready to Use!
We welcome contributions! Here's how to get started:
Types of contributions welcome:
| Feature | Status | Notes |
|---|---|---|
| β Auto-CLI Generation | Complete | Supports all contract types |
| β Enhanced Data Type Support | Complete | Full support for complex Midnight types |
| β Local Development | Complete | Docker-based Midnight node |
| β Testnet Deployment | Complete | Automated wallet management |
| β Deployment Flags | Complete | Dry-run, auto-deploy options |
| β Wallet Tools | Complete | Balance checking, faucet integration |
| β Documentation | Complete | Comprehensive guides and troubleshooting |
| π Multi-Contract Support | Planned | Support multiple contracts per project |
| π GUI Interface | Planned | Web-based contract interaction |
| π Contract Templates | Planned | Pre-built contract examples |
| π Midnight Playground | Planned | Online midnight experimenting tool |
Apache 2.0 License
Before: Hours of manual setup, hardcoded configurations, manual CLI updates, type conversion issues After: Create contract β run command β deploy to testnet with full data type support
This scaffold eliminates all the friction from Midnight smart contract development, handles complex data types automatically, and gets you building immediately.
Last Updated: June 15, 2025
Version: 2.1.7
Built with β€οΈ for the Midnight ecosystem π
Happy coding on Midnight! πβ¨
FAQs
π Scaffold for building Midnight smart contracts with dynamic type detection and automated CLI generation
We found that create-midnight-app demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.