VScode plugin for Bitcoin Script within Rust files and (.btc) files.
Download it now: BitcoinScriptVscode
Features 🍙
- Syntax Highlighting: Added the textmate language grammar. Highlighting works on
.rs files as the grammar is injected for Rust files
- Instant Feedback: The stack content changes are shown on the right side with virtual text
- Simple: Just add in the
[main stack] and [alt stack] on top of your script
How it works 🛠️
The first line should be in one of these formats:
[A, B] (just the main stack)
[A, B] [C] (the main stack and the alt-stack)
Inside script! ✍️
pub fn u8_extract_1bit() -> Script {
script! {
// [1,2], [3,4]
OP_DUP
OP_ADD
256
OP_2DUP
OP_GREATERTHANOREQUAL
OP_IF
OP_SUB
1
OP_ELSE
OP_DROP
0
OP_ENDIF
}
}
// btc-script
[3,4]
OP_DUP
OP_TOALTSTACK
// end-btc-script
On .btc file 💼
You can also create a .btc file and then on top of the file. Add your main and alt stacks as mentioned above
Acknowledgments 🙏
Inspired from this tweet by @t4t5
Repo bitcoin-script-hints
Things to improve 📋
- Instead of abstracting all the Hash opcodes, have a real hash and also real checksig verify
- Add two modes, Toy mode and Real mode. Real mode works with real hashes and signatures
- variable mapping for BitVM based script style, so compile time inference might be possible
- script expansion with maybe intermediate cargo expand step for BitVM (no idea if this works or not)
| |