Skip to content

Olanetsoft/compact-by-example

Compact by Example

Learn Midnight's Compact language through practical examples. This project is built on the Midnight Network.

Visit https://compact-by-example.org. Inspired by Solidity by Example.

License: MIT PRs Welcome Made for Midnight Documentation Community GitHub Stars

What is This?

A community-driven collection of Compact smart contract examples for building privacy-preserving applications on Midnight Network. Each example is complete, tested, and ready to run.

Quick Start

Prerequisites:

  • Node.js v20 LTS or higher
  • npm or yarn

Installation:

# Clone the repository
git clone https://github.com/Olanetsoft/compact-by-example.git
cd compact-by-example

# Install dependencies
npm install

# Start the development server
npm run dev

Visit http://localhost:3000 to view the documentation locally.

To set up Compact itself (compiler, proof server, wallet), see setup.mdx.

Project Structure

compact-by-example/
├── basics/              # Fundamentals (hello-world, types, mappings, ...)
├── applications/        # Full token contracts (ERC20, ERC721, ERC1155)
├── .github/             # Issue templates, PR templates, CI/CD
├── images/              # Assets and graphics
├── logo/                # Brand assets
├── setup.mdx            # Toolchain installation guide
├── docs.json            # Mintlify configuration
└── index.mdx            # Homepage

Content Categories

Help us build these sections:

  • Privacy & ZK Proofs - Zero-knowledge circuits and private state
  • Smart Contracts - Tokens, NFTs, and DAOs
  • DeFi - Decentralized finance protocols
  • Advanced Patterns - Complex contract architectures
  • Security - Best practices and common vulnerabilities

Contributing

We welcome contributions! Whether you're fixing a typo, improving documentation, or adding a new example.

How to contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-example)
  3. Make your changes (follow our style guide)
  4. Test your code (npm run dev)
  5. Commit with clear messages (git commit -m 'Add: your feature')
  6. Push to your branch (git push origin feature/your-example)
  7. Open a Pull Request

Read our Contributing Guide for detailed instructions.

Community

Resources

License

MIT - see LICENSE file for details.


Built by the Midnight community • Report BugRequest FeatureSubmit Example

About

Learn Midnight's Compact language through practical examples.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages