How blockstreamresearch/rust-simplicity works
rust-simplicity is a Rust library for constructing, analyzing, encoding, and executing typed Simplicity programs. Its central workflow progresses from incomplete construction nodes, through committed programs, to redeemed programs with witness data; redeemed programs can be encoded or run on the Bit Machine. Supporting layers provide type inference, Merkle commitments, cost analysis, human-readable parsing, policy satisfaction, and optimized C jets. The graph follows documented capabilities and source-index references; some subsystem wiring is not sampled, so uncertain links are omitted.
Main entry points: node/mod.rs Node operations · bit_machine/mod.rs Bit Machine · jet/mod.rs Jet interface · redeem.rs Redemption nodes
Components 19
Program authoring
- Construction nodes
src/node/construct.rs - Commitment nodes
src/node/commit.rs - Redemption nodes
src/node/redeem.rs - Human encoding
src/human_encoding/mod.rs - Human parser
src/human_encoding/parse/mod.rs
Program representation
- Node operations
src/node/mod.rs - Types and inference
src/types/mod.rs - DAG traversal
src/dag.rs - Values and witnesses
src/value.rs - Bit encoding
src/bit_encoding/encode.rs - Merkle commitments
src/merkle/cmr.rs
Execution and analysis
- Cost analysis
src/analysis.rs - Bit Machine
src/bit_machine/mod.rs
Jets and policy
- Jet interface
src/jet/mod.rs - Core jet set
src/jet/init/core.rs - Elements jet set
src/jet/init/elements.rs - Policy satisfaction
src/policy/satisfy.rs - C jet FFI
simplicity-sys/src/ffi.rs
Other components
- Program developer
Connections 24
- Program developer → Construction nodes: builds
README.md - Construction nodes → Commitment nodes: finalizes
- Commitment nodes → Redemption nodes: adds witnesses
README.md - Program developer → Human encoding: writes or reads
README.md - Human encoding → Human parser: parses with
src/human_encoding/mod.rs - Human parser → Construction nodes: builds nodes
src/human_encoding/parse/mod.rs - Node operations → Types and inference: uses
src/node/mod.rs - Node operations → DAG traversal: uses
src/node/mod.rs - Node operations → Cost analysis: uses
src/node/mod.rs - Node operations → Values and witnesses: uses
src/node/mod.rs - Node operations → Jet interface: uses
src/node/mod.rs - Redemption nodes → Bit Machine: executes with
src/node/redeem.rs - Redemption nodes → Bit encoding: encodes with
src/node/redeem.rs - Redemption nodes → Cost analysis: analyzes with
src/node/redeem.rs - Bit Machine → Jet interface: dispatches
src/bit_machine/mod.rs - Bit Machine → Cost analysis: checks bounds
src/bit_machine/mod.rs - Bit Machine → Values and witnesses: reads and returns
- Jet interface → Core jet set: provides
src/jet/mod.rs - Jet interface → Elements jet set: provides
src/jet/mod.rs - Jet interface → C jet FFI: calls optimized jets
README.md - Policy satisfaction → Bit Machine: uses for satisfaction
src/policy/satisfy.rs - Policy satisfaction → Bit encoding: uses
src/policy/satisfy.rs - Merkle commitments → Types and inference: uses type data
src/merkle/cmr.rs - Bit encoding → Values and witnesses: encodes values