Crate tinyminiscript

Source
Expand description

A lightweight, no_std-compatible miniscript parser and validator for Bitcoin.

This crate provides parsing, validation, and script generation for Bitcoin miniscript expressions. It’s designed to work in both standard and embedded environments through feature flags.

§Features

  • alloc: Enables dynamic memory allocation using the alloc crate. When disabled, the crate uses stack-allocated arrays with fixed capacities.
  • debug: Enables Debug trait implementations for error types, useful for development and debugging.

§Examples

use tinyminiscript::parse_script;
 
// Parse a simple miniscript
let result = parse_script("wsh(multi(1,022f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4,025cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc))");
if let Ok((ctx, script)) = result {
    println!("Successfully parsed miniscript");
    println!("Generated script: {:?}", script);
}

§Crate Features

By default, this crate is no_std compatible and uses stack allocation. Enable the alloc feature for dynamic memory allocation, or the debug feature for enhanced error reporting capabilities.

Modules§

descriptor
Bitcoin descriptor parsing and validation
parser
Miniscript parser and AST representation
script
Bitcoin script generation from parsed miniscript
type_checker
Type checking and correctness property validation

Enums§

MiniscriptError
Errors that can occur during miniscript parsing, validation, or script building.

Functions§

parse_script
Parse and validate a miniscript string, returning the parsed context and generated Bitcoin script.