Glyph compiles Untyped Plutus Core (UPLC) to RISC-V and ships a CEK runtime written in Zig.
The project is organized into a CLI tool with a built-in serializer for UPLC, as well as a runtime written in Zig.
src/bin: A CLI tool to interact with Glyph.src/serializer.rs: A parser and serializer for UPLC code.runtime: A CEK Machine with multiple entry-points written in Zig and compiled to RISC-V.
Installing Glyph from a prebuilt binary can be done with the following command(s). Replace the version with the most up-to-date release.
Using Shell Script:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/input-output-hk/glyph/releases/download/v0.1.7/glyph-installer.sh | shUsing Powershell Script:
powershell -ExecutionPolicy Bypass -c "irm https://github.com/input-output-hk/glyph/releases/download/v0.1.7/glyph-installer.ps1 | iex"To build the project, you need Rust and Cargo, Zig, and a RISC-V toolchain.
On Debian based systems:
sudo apt-get install -y gcc-riscv64-unknown-elfOn MacOS:
brew install riscv64-elf-gccZig should be available on your PATH (see https://ziglang.org/download/).
Then, run:
cargo build
cargo testThe CLI provides several commands for working with UPLC code:
glyph compile --encoding text --file program.uplcThis produces program.elf in the current working directory.
glyph run --program-file program.elf --encoding text --file input.uplcIf your input program does not require a script argument, use --no-input with compile
and omit --file when running.
--encoding textparses human-readable UPLC text.--encoding cborexpects CBOR-encoded flat bytes (default).--encoding flatexpects flat-encoded bytes.--hexdecodes hex input forcbororflatencodings.
The build subcommand compiles validator bundles from plutus.json.
glyph build --file plutus.json --validator example.main.else --output program.elfWhen the bundle only has a single validator, --validator can be omitted.
Glyph exposes BitVMX-CPU emulator capabilities for demo workflows. The mapping and ROM commitment outputs follow the emulator log line format, with instruction mapping sorted by key for deterministic output.
Generate the opcode -> Bitcoin Script mapping:
glyph bitvmx instruction-mapping --out instruction_mapping.txtGenerate the ROM commitment for an ELF:
glyph bitvmx rom-commitment --elf program.elf --out rom_commitment.txtExecute an ELF with input and print stdout + exit code:
glyph bitvmx execute --elf program.elf --stdout --input 11111111Bundle mapping + commitment + manifest:
glyph bitvmx bundle --elf program.elf --out-dir ./bitvmx_artifactsOn macOS, a RISC-V toolchain is required (see the build section for brew install riscv64-elf-gcc).
- Parsing and serialization of UPLC code
- Evaluation of serialized UPLC terms using a CEK machine
This project is in active development and should be considered experimental until the first stable release.