Skip to content

Commit db73612

Browse files
committed
Updates to reflect that -w is now mandatory for .wit files in simc
1 parent 6ab8efe commit db73612

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

docs/assets/p2ms-demo.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ pause
262262
# with a witness when claiming assets from the contract, as we do here.
263263
# Those would usually be done by different people on different occasions.
264264
echo "Recompiling Simplicity program with attached populated witness file..."
265-
echo simc "$PROGRAM_SOURCE" "$TMPDIR"/witness.wit
266-
simc "$PROGRAM_SOURCE" "$TMPDIR"/witness.wit | tee "$TMPDIR"/compiled-with-witness
265+
echo simc "$PROGRAM_SOURCE" -w "$TMPDIR"/witness.wit
266+
simc "$PROGRAM_SOURCE" -w "$TMPDIR"/witness.wit | tee "$TMPDIR"/compiled-with-witness
267267

268268
# Maybe simc should also output structured data like JSON!
269269
PROGRAM=$(cat "$TMPDIR"/compiled-with-witness | sed '1d; 3,$d')

docs/documentation/witness.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@ Currently, `.wit` files need to be written manually. You can use the details abo
7474

7575
## Compiling (serializing) `.wit` files with `simc`
7676

77-
As noted above, `simc` can produce a serialized base64 form of a `.wit` file to incorporate into a transaction. It does this automatically when run with two arguments (program source code and witness file):
77+
As noted above, `simc` can produce a serialized base64 form of a `.wit` file to incorporate into a transaction. The witness file is specified with the `-w` option to `simc`.
7878

7979
```bash
80-
$ simc p2ms.simf p2ms.wit
80+
$ simc p2ms.simf -w p2ms.wit
8181
Program:
8282
5lk2l5vmZ++dy7rFWgYpXOhwsHApv82y3OKNlZ8oFbFvgXmARacYEf5RB7X1tMEVAbpXAfNhcd45LjO88p6usCblccJ7lBgtPyYRQDJLGGIJJonwvxOqRTamOQiwbfM2EMA+InecBt8gyCoWRAoQY4oNggUIOOQKE2AACEGGHIMMFgFpHxOQKEGHG4AccgwVJ4CBOKD8JNwsUH1HCrYwEJFB+NQQDaBwIfhWmNBCBQgwzMAMAKwCD8UGCo/FYIBuC4IAwDxcBxkBxuQKDcam5BnGHHG5CHGHCxC1gOAIFBuQh+SRxhxxx+ShxhxwsgtoDiFAoTYAQIQKDcmjjcnBRm2ggDjpIoA5GA1gcBA4jA4zA5cgcvwOYMkUAclgcxY=
8383
Witness:
8484
+6WeUroyP8LKsSWJSZJX0XnFrMVODj5+L4RU4Bt2LWaeB93Pae1y5RHQUy0aWutmZutdEkTC6wIPvZCTFYvXt6U7fVasUVyOV5x8EOUdWjMv3vE6nglrfHOYEWbFuEU+qn+mp/FBWf+/e7qOOitBu0dmDQhILf5I14DoxcrM/XEg
8585

8686
```
8787

88-
The base64 value beginning `+6WeUroy...` is the complete serialized witness, incorporating all of the input values from `p2ms.wit`. By including both the program source code <a href="https://github.com/BlockstreamResearch/SimplicityHL/blob/master/examples/p2ms.simf">`p2ms.simf`</a> and the witness file <a href="https://github.com/BlockstreamResearch/SimplicityHL/blob/master/examples/p2ms.wit">`p2ms.wit`</a>, you allow the compiler to double-check that the required values were included. The [Quickstart tutorial](/getting-started/quickstart/) on this site also demonstrates this process, eventually attaching the witness to the transaction via `hal-simplicity` immediately before finalizing and submitting the transaction.
88+
The base64 value beginning `+6WeUroy...` is the complete serialized witness, incorporating all of the input values from `p2ms.wit`. By including both the program source code <a href="https://github.com/BlockstreamResearch/SimplicityHL/blob/master/examples/p2ms.simf">`p2ms.simf`</a> and the witness file <a href="https://github.com/BlockstreamResearch/SimplicityHL/blob/master/examples/p2ms.wit">`p2ms.wit`</a>, you allow the compiler to double-check that the required values were included. The [bash quickstart tutorial](/getting-started/bash-quickstart/) on this site also demonstrates this process, eventually attaching the witness to the transaction via `hal-simplicity` immediately before finalizing and submitting the transaction.
8989

9090
## Other tools for building witness data
9191

docs/getting-started/bash-quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ Copy the hexadecimal value that appears as `signature` in the output. Edit the `
197197
We're going to run `simc` again to obtain a version of our updated [witness](../glossary.md#witness) file suitable for publication on the blockchain. (This represents the *input* to our contract as the contract is being run in the context of this transaction. The presence of both Alice's and Charlie's valid signatures on this transaction will convince our contract logic to approve the transaction.)
198198

199199
```bash
200-
simc $PROGRAM_SOURCE $TMPDIR/p2ms.wit
200+
simc $PROGRAM_SOURCE -w $TMPDIR/p2ms.wit
201201
```
202202

203203
Now there is an additional line of output representing the witness data. We want to store this into a shell variable too so that we can include it as part of our overall transaction. Once again, the data we need is on the final line of output of `simc`:
204204

205205
```bash
206-
WITNESS=$(simc $PROGRAM_SOURCE $TMPDIR/p2ms.wit | tail -1)
206+
WITNESS=$(simc $PROGRAM_SOURCE -w $TMPDIR/p2ms.wit | tail -1)
207207
```
208208

209209
### Step 8: Finalize and extract the raw transaction

docs/getting-started/quickstart2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,13 @@ Copy the hexadecimal value that appears as `signature` in the output. Edit the `
165165
We're going to run `simc` again to obtain a version of our updated [witness](../glossary.md#witness) file suitable for publication on the blockchain. (This represents the *input* to our contract as the contract is being run in the context of this transaction. The presence of the valid signature on this transaction will convince our contract logic to approve the transaction.)
166166

167167
```bash
168-
simc example.simf example.wit
168+
simc example.simf -w example.wit
169169
```
170170

171171
Now we see an additional line of output representing the witness data. We'll store this into a shell variable too so that we can include it as part of our overall transaction. The data we need is the fourth line of output above, or the `witness` property in `simc`'s JSON output:
172172

173173
```bash
174-
WITNESS=$(simc --json example.simf example.wit | jq -r .witness)
174+
WITNESS=$(simc --json example.simf -w example.wit | jq -r .witness)
175175
```
176176

177177
### Step 8: Finalize and extract the raw transaction

0 commit comments

Comments
 (0)