GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - febyeji/lean-miniscript

BranchesTags
Open more actions menu

Latest commit

 

History

442 Commits
442 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
LeanMiniscript
LeanMiniscript
 
 
assets
assets
 
 
scripts
scripts
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
AI_USAGE.md
AI_USAGE.md
 
 
CLAUDE.md
CLAUDE.md
 
 
LICENSE
LICENSE
 
 
LeanMiniscript.lean
LeanMiniscript.lean
 
 
README.md
README.md
 
 
lake-manifest.json
lake-manifest.json
 
 
lakefile.lean
lakefile.lean
 
 
lean-toolchain
lean-toolchain
 
 

Repository files navigation

lean-miniscript logo

lean-miniscript

Lean models of Bitcoin Miniscript, Script, Taproot, descriptors, transactions, and PSBT, with proofs and checks against pinned fixtures.

Build

Install the Lean version in lean-toolchain, then run from the repository root:

lake build

This checks the library, proofs, and tests, and builds the CLIs below.

Policy CLI

Parse a policy and print its canonical form:

lake exe policy_cli -- \
  'and(pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798),older(100))'

Compile it for Tapscript, or use --context p2wsh for P2WSH:

lake exe policy_cli -- compile --context tapscript \
  'and(pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798),older(100))'

Output includes Miniscript, Script hex, script size, static opcode count, and stack bounds.

Print a descriptor's scriptPubKeys. combo() prints each output; --index N resolves * wildcards:

lake exe policy_cli -- descriptor \
  'combo(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)'
lake exe policy_cli -- --help

PSBT CLI

Set the variables to your PSBT text and a descriptor with resolved keys. Bindings use zero-based INDEX=DESCRIPTOR; include each input that needs finalization before extraction:

lake exe psbt_cli -- inspect --encoding hex "$PSBT_HEX"
lake exe psbt_cli -- finalize "$SIGNED_PSBT_BASE64" "0=$DESCRIPTOR" \
  | lake exe psbt_cli -- extract -

inspect reports input finalization status. Input defaults to Base64; --encoding hex selects hex and - reads stdin. finalize prints a Base64 PSBT; extract requires all inputs finalized and prints transaction hex.

After the build, run the CLI checks with Python 3:

python3 scripts/test_psbt_cli.py

Bitcoin Core fixture audit

Download the fixture pinned in CI, then compare its expected results with the model:

curl --fail --location \
  https://raw.githubusercontent.com/bitcoin/bitcoin/f13ae519de94394314cd63a27924b0998ac65d45/src/test/data/script_tests.json \
  --output /tmp/script_tests.json
lake exe core_fixture_audit -- --show-details /tmp/script_tests.json

Check mismatched and unsupported in the summary. Unsupported rows are excluded from comparison; the command succeeds when all compared rows match. Add --show-unsupported to inspect excluded rows.

Equivalence checks

After lake build, run:

lake env lean --run scripts/equivalence_obligations.lean
lake env lean --run scripts/script_equivalence_obligations.lean
lake env lean --run scripts/core_loop_fallbacks.lean
  • equivalence_obligations.lean counts unproved opcode/version obligations.
  • script_equivalence_obligations.lean counts unproved Script and VerifyScript obligations.
  • core_loop_fallbacks.lean counts instruction kinds whose representative scripts use the modeled Core raw loop.

A zero obligation count means every listed theorem has the expected type and uses only standard Lean axioms. Read the count even when the command succeeds. Add --list for proved/missing/sorry or typed/fallback entries. The fallback check fails if a Script or VerifyScript obligation is unproved.

Proofs concern the Lean models and their stated assumptions. Fixture matches and obligation counts do not establish general Bitcoin consensus equivalence or cryptographic correctness. Transaction-backed APIs assume valid transactions and correct prevout data; private-key derivation uses variable-time arithmetic. See AI_USAGE.md for proof verification rules.

Source

  • LeanMiniscript.lean — stable library exports
  • LeanMiniscript/Experimental.lean — extraction and proof modules under active development
  • LeanMiniscript/Conformance/ — cross-module checks
  • scripts/ — fixture generators and CLI checks

License

MIT

About

No description, website, or topics provided.

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.