You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Utilities used in the official [BitVM](`https://github.com/BitVM/BitVM`) implementation to generate Bitcoin Script. Heavily inspired by [rust-bitcoin-script's inline macro](`https://github.com/mappum/rust-bitcoin-script`).
10
4
11
5
## Usage
12
6
13
-
This crate exports a `script!` macro which can be used to build Bitcoin scripts. The macro returns the [`Script`](https://docs.rs/bitcoin/latest/bitcoin/struct.ScriptBuf.html) type from the [`bitcoin`](https://github.com/rust-bitcoin/rust-bitcoin) crate.
7
+
This crate exports a `script!` macro which can be used to build structured Bitcoin scripts and compiled to the [`Script`](https://docs.rs/bitcoin/latest/bitcoin/struct.ScriptBuf.html) type from the [`bitcoin`](https://github.com/rust-bitcoin/rust-bitcoin) crate.
14
8
15
9
**Example:**
16
10
17
11
```rust
18
-
#![feature(proc_macro_hygiene)]
19
-
20
12
usebitcoin_script::bitcoin_script;
21
13
22
14
lethtlc_script=script! {
@@ -28,6 +20,8 @@ let htlc_script = script! {
28
20
OP_EQUALVERIFY
29
21
OP_CHECKSIG
30
22
};
23
+
24
+
letscript_buf=htlc_script.compile();
31
25
```
32
26
33
27
### Syntax
@@ -77,6 +71,7 @@ Rust expressions of the following types are supported:
0 commit comments