π€π§ββοΈ Visualize Miniscript using Mermaid
Flowchart for Miniscripts This is a small suite of tools aimed to work with Miniscript.
minimaxis_flowchart βββ minimermaid.py
- minimermaid.py
- Application flowchart for MiniScripts.
- Python
- re
- json
- symbols, simplify, And, Or, printing
miniscript = 'or(pk(key_revocation),and(pk(key_remote),or(and(pk(key_local),hash160(H)),older(1008))))'
miniscript_to_mermaid(miniscript, True) # True for readability improvement through simplification,
# False for auditability improvement through replication.
### Output: ###
# graph TD
# key_revocation -->|pk| or_0{Check 1/3}
# 1008 -->|older| and_0{Check 2/2}
# key_remote -->|pk| and_0{Check 2/2}
# and_0 --> or_0
# and_0{Check 2/2}
# H -->|hash160| and_1{Check 3/3}
# key_local -->|pk| and_1{Check 3/3}
# key_remote -->|pk| and_1{Check 3/3}
# and_1 --> or_0
# and_1{Check 3/3}
# or_0{Check 1/3}
# or_0 -->|yes|s((spend))
# or_0 -->|no|n((nothing))
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.