A UPLC (Untyped Plutus Core) implementation in Zig.
UPLC is the core language that runs on the Cardano blockchain. Every Plutus smart contract compiles down to UPLC before it is submitted on-chain. This project provides a parser, pretty printer, and CEK machine evaluator for UPLC programs.
zig buildThis produces the plutuz CLI at zig-out/bin/plutuz. Mostly for testing and playing.
Evaluate a UPLC program:
./zig-out/bin/plutuz program.uplcPretty print without evaluating:
./zig-out/bin/plutuz -p program.uplcUnit tests:
zig build test --summary allConformance tests (991 tests from the Plutus conformance test suite):
zig build conformance --summary allThe conformance step automatically generates conformance/tests.zig from the test data in
conformance/tests/ before compiling and running. No manual generation step is needed.
src/
root.zig Library entry point
main.zig CLI entry point
ast/ AST types (Term, Constant, Type, Builtin, Value)
binder/ Variable binding representations (Name, DeBruijn, NamedDeBruijn)
cek/ CEK machine evaluator and builtin implementations
convert/ Name to DeBruijn index conversion
crypto/ Cryptographic primitives (BLS12-381, RIPEMD-160)
data/ PlutusData and CBOR encoding
syn/ Lexer, parser, and pretty printer
conformance/
tests.zig Auto-generated conformance test file
generate.zig Test generator (walks tests/ and emits tests.zig)
tests/ Conformance test data (.uplc and .uplc.expected files)
All 101 Plutus builtins are implemented (0-100), including:
- Integer arithmetic and comparison
- ByteString operations (append, slice, index, bitwise, shift, rotate)
- String operations and UTF-8 encoding
- Cryptographic hashes (SHA2-256, SHA3-256, Blake2b-224/256, Keccak-256, RIPEMD-160)
- Signature verification (Ed25519, ECDSA secp256k1, Schnorr secp256k1)
- BLS12-381 curve operations (G1/G2 add, negate, scalar multiply, multi-scalar multiply, compress, uncompress, hash to group, Miller loop, final verify)
- Data constructors and destructors
- List and array operations
- Pair operations
- Value operations (multi-asset ledger values)