Skip to content

Commit dd051fd

Browse files
authored
Merge pull request #13 from iajhff/patch-1
Use web-ide guide for technical accuracy
2 parents 1c0eae8 + 61f76c4 commit dd051fd

File tree

1 file changed

+71
-215
lines changed

1 file changed

+71
-215
lines changed

docs/getting-started/web-ide.md

Lines changed: 71 additions & 215 deletions
Original file line numberDiff line numberDiff line change
@@ -1,252 +1,152 @@
1-
# Simplicity Web IDE Guide
2-
3-
## What is the Web IDE?
1+
# How to make a transaction using the web IDE
42

53
The Simplicity Web IDE is a browser-based development environment for writing, compiling, and deploying Simplicity contracts to Liquid testnet.
64

7-
**Repository:** https://github.com/BlockstreamResearch/simplicity-webide
8-
**Live Demo:** (Deploy locally or access hosted instance)
5+
Repository: https://github.com/BlockstreamResearch/simplicity-webide
6+
Live Demo: (Deploy locally or https://ide.simplicity-lang.org)
97

108
**Features:**
119
- Write SimplicityHL contracts in browser
1210
- Compile to Simplicity bytecode
1311
- Generate P2TR addresses
1412
- Build transactions
1513
- Deploy to Liquid testnet
16-
- No installation required
17-
18-
---
19-
20-
## Interface Overview
21-
22-
![Web IDE Interface](../assets/webide0.png)
23-
24-
**Components:**
25-
26-
1. **Code Editor** (Left panel)
27-
- Syntax highlighting for SimplicityHL
28-
- Line numbers
29-
- Error highlighting
30-
31-
2. **Compiler Output** (Right panel)
32-
- Compilation status
33-
- CMR display
34-
- P2TR address
35-
- Error messages
36-
37-
3. **Transaction Builder** (Bottom panel)
38-
- Input UTXO details
39-
- Output configuration
40-
- Witness data entry
41-
- Build & broadcast buttons
4214

43-
4. **Network Selector** (Top bar)
44-
- Liquid Testnet (default)
45-
- Settings and options
15+
The SimplicityHL web IDE can only make a restricted form of transaction: There is 1 transaction input, 1 transaction output and 1 fee output _(Liquid has explicit fee outputs)_. Confidential transactions or assets other than Bitcoin are not supported.
4616

47-
---
17+
![Screenshot of mempool.space](https://docs.simplicity-lang.org/assets/mempool1.png)
4818

49-
## Getting Started
19+
## Write the main function
5020

51-
### Step 1: Open the Web IDE
21+
Open [the SimplicityHL web IDE](https://ide.simplicity-lang.org/) and write the main function of your program.
5222

53-
Navigate to the Web IDE deployment in your browser.
23+
_You can leave the default main function as it is. Customize it if you want._
5424

55-
![Web IDE Main Screen](../assets/webide1.png)
25+
![Screenshot of the web IDE](https://docs.simplicity-lang.org/assets/webide0.png)
5626

57-
### Step 2: Write Your Contract
27+
## Generate an address
5828

59-
**Example - Simple Contract:**
29+
Click the "Address" button to copy the address of your program to the clipboard.
6030

61-
```rust
62-
fn main() {
63-
// This contract always succeeds
64-
}
65-
```
31+
Leave the web IDE tab open. You will need it later.
6632

67-
Click **Compile** button.
33+
![Screenshot of the web IDE](https://docs.simplicity-lang.org/assets/webide1.png)
6834

69-
![Compilation Output](../assets/webide2.png)
35+
## Fund the address
7036

71-
**Output shows:**
72-
- CMR (Commitment Merkle Root)
73-
- P2TR address
74-
- Compilation success/errors
37+
Paste the address into [the Liquid testnet faucet](https://liquidtestnet.com/faucet) and press the "Send assets" button.
7538

76-
### Step 3: Generate Address
39+
![Screenshot of the Liquid testnet faucet](https://docs.simplicity-lang.org/assets/faucet1.png)
7740

78-
After compilation, the IDE displays the P2TR address and CMR.
41+
Copy the ID of the funding transaction to your clipboard.
7942

80-
![Address Generation](../assets/webide3.png)
43+
![Screenshot of the Liquid testnet faucet](https://docs.simplicity-lang.org/assets/faucet2.png)
8144

82-
**What this means:**
83-
- P2TR address: Where to send funds
84-
- CMR: Unique identifier for this contract
45+
## Look up the funding transaction
8546

86-
Copy the P2TR address.
47+
Paste the ID of the funding transaction into the [Blockstream Explorer for Liquid testnet](https://blockstream.info/liquidtestnet/).
8748

88-
### Step 4: Fund the Address
49+
![Screenshot of the Blockstream Explorer](https://docs.simplicity-lang.org/assets/esplora1.png)
8950

90-
**Option A: Use Faucet Website**
51+
Scroll down and find the SimplicityHL UTXO. The Liquid testnet faucet always sends 100000 tL-BTC. In our example, the SimplicityHL UTXO is vout = 1.
9152

92-
Navigate to: https://liquidtestnet.com/faucet
53+
![Screenshot of the Blockstream Explorer](https://docs.simplicity-lang.org/assets/esplora2.png)
9354

94-
![Liquid Testnet Faucet](../assets/faucet1.png)
55+
## Enter UTXO data into the web IDE
9556

96-
Paste your P2TR address and request L-BTC.
57+
Enter the ID of the funding transaction and the vout into the web IDE.
9758

98-
![Faucet Request](../assets/faucet2.png)
59+
_You can leave the remaining fields as they are. Feel free to customize._
9960

100-
**Option B: Via API**
101-
```bash
102-
curl "https://liquidtestnet.com/faucet?address=tex1p...&action=lbtc"
103-
```
61+
![Screenshot of the SimplicityHL web IDE](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/webide2.png)
10462

105-
Wait 60 seconds for confirmation.
63+
## Sign the spending transaction
10664

107-
### Step 5: Check Balance
65+
Click the "Sig 0" button to generate a signature for a transaction that spends the SimplicityHL UTXO.
10866

109-
Use the Blockstream explorer to verify: https://blockstream.info/liquidtestnet
67+
![Screenshot of the SimplicityHL web IDE](https://docs.simplicity-lang.org/assets/webide3.png)
11068

111-
![Check UTXO on Explorer](../assets/esplora1.png)
69+
Paste the signature into the `mod witness {...}` section.
11270

113-
**Or via API:**
114-
```bash
115-
curl "https://blockstream.info/liquidtestnet/api/address/tex1p.../utxo"
116-
```
71+
![Screenshot of the SimplicityHL web IDE](https://docs.simplicity-lang.org/assets/webide4.png)
11772

118-
**Response shows:**
119-
```json
120-
[{
121-
"txid": "abc123...",
122-
"vout": 0,
123-
"value": 100000
124-
}]
125-
```
73+
## Generate the spending transaction
12674

127-
Note the `txid` and `vout` - you'll need these for the transaction builder.
75+
Click the "Transaction" button to copy the spending transaction to your clipboard.
12876

129-
### Step 6: Enter Transaction Details
77+
![Screenshot of the SimplicityHL web IDE](https://docs.simplicity-lang.org/assets/webide5.png)
13078

131-
Scroll to the **Transaction** section in the Web IDE.
79+
## Broadcast the spending transaction
13280

133-
![Transaction Form](../assets/webide2.png)
81+
Paste the spending transaction into the [Blockstream Liquid testnet explorer](https://blockstream.info/liquidtestnet/tx/push) and click the "Broadcast transaction" button.
13482

135-
**Enter UTXO data from Step 5:**
136-
1. **Txid:** Paste the funding transaction ID
137-
2. **Vout:** Enter output index (usually `0` or `1`)
138-
3. **Value:** Enter amount in sats (e.g., `100000`)
83+
![Screenshot of the SimplicityHL web IDE](https://docs.simplicity-lang.org/assets/esplora3.png)
13984

140-
Leave destination and other fields as defaults for now.
85+
If everything worked, the explorer will open the broadcast transaction. In this case, congratulations, you made a SimplicityHL transaction on Liquid testnet!!! You can also look up your transaction on [mempool.space](https://liquid.network/testnet).
14186

142-
### Step 7: Generate Signature (For P2PK Contracts)
87+
If you see an error message, take a look at the following "Troubleshooting" section.
14388

144-
**For contracts requiring signatures:**
89+
## Cryptic error message
14590

146-
Click the **"Sig 0"** button in the Web IDE.
91+
Cause.
14792

148-
![Generate Signature](../assets/webide3.png)
93+
Action to take.
14994

150-
**The signature is automatically copied to your clipboard!**
95+
## "Transaction not found" (Blockstream Explorer)
15196

152-
**Update your contract code:**
97+
Fake error. The transaction actually worked :)
15398

154-
Paste the signature into your witness section:
155-
```rust
156-
mod witness {
157-
const SIGNATURE: Signature = 0xf74b3ca574647f8595624b129324afa2...;
158-
}
159-
```
99+
Wait for 1 minute and reload the page.
160100

161-
**What this does:** The Web IDE computes the sighash and signs it with an internal key.
101+
## `bad-txns-inputs-missingorspent`
162102

163-
### Step 8: Build Transaction
103+
The UTXO doesn't exist.
164104

165-
Click the **"Transaction"** button.
105+
Double check the txid. You might have to wait for one minute for the UTXO to be included in the blockchain.
166106

167-
![Build Transaction](../assets/webide4.png)
107+
## `bad-txns-in-ne-out, value in != value out`
168108

169-
**The complete transaction hex is copied to your clipboard.**
109+
The input value does not equal the output value.
170110

171-
### Step 9: Broadcast Transaction
111+
Double-check the UTXO info (vout and value). Check that the fee is lower than the input value.
172112

173-
![Transaction Built](../assets/webide5.png)
113+
## `bad-txns-fee-outofrange`
174114

175-
**Copy the transaction hex**, then broadcast via explorer:
115+
The fee does not cover the transaction weight.
176116

177-
**Option A: Blockstream Explorer Broadcast Page**
117+
Increase the fee.
178118

179-
Navigate to: https://blockstream.info/liquidtestnet/tx/push
119+
## `non-final`
180120

181-
Paste your transaction hex and click broadcast.
121+
The lock time is higher than the current block height.
182122

183-
**Option B: Via curl:**
184-
```bash
185-
curl -X POST "https://blockstream.info/liquidtestnet/api/tx" -d "020000..."
186-
```
123+
Decrease the locktime or wait until the block height is high enough.
187124

188-
Replace `020000...` with your actual transaction hex from the IDE.
125+
## `non-BIP68-final`
189126

190-
### Step 10: Verify on Explorer
127+
The sequence is higher than the current block height plus the UTXO height.
191128

192-
View your transaction: https://blockstream.info/liquidtestnet/tx/YOUR_TXID
129+
Decrease the sequence or wait until the block height is high enough.
193130

194-
![Transaction Confirmed](../assets/esplora2.png)
131+
## `dust`
195132

196-
**Check status via API:**
197-
```bash
198-
curl "https://blockstream.info/liquidtestnet/api/tx/<txid>/status"
199-
```
133+
You are creating a dust transaction output.
200134

201-
![Mempool View](../assets/mempool1.png)
135+
The fee consumes the entire input value. Decrease the fee.
202136

203-
Wait for confirmation (usually 1-2 minutes on Liquid testnet).
137+
## `non-mandatory-script-verify-flag (Assertion failed inside jet)`
204138

205-
**Explorer views:**
206-
- Transaction details: https://blockstream.info/liquidtestnet/tx/TXID
207-
- Address UTXOs: https://blockstream.info/liquidtestnet/address/ADDRESS
208-
- Mempool: https://blockstream.info/liquidtestnet
139+
A Simplicity jet fails.
209140

210-
---
141+
Double-check the conditions that your SimplicityHL program enforces. Update the witness data or transaction parameters.
211142

212-
## Common Workflows
143+
Every time you change the transaction parameters, the signature hash of the transaction changes. In this case, you need to **regenerate signatures** using the "Key Store" tab.
213144

214-
### P2PK Contract
145+
## `non-mandatory-script-verify-flag (Witness program hash mismatch)`
215146

216-
**Code:**
217-
```rust
218-
fn main() {
219-
let pk: Pubkey = 0x02...;
220-
let msg: u256 = jet::sig_all_hash();
221-
let sig: Signature = witness::signature;
222-
jet::bip_0340_verify(pk, msg, sig)
223-
}
224-
```
147+
The CMR of the Simplicity program inside the UTXO is different from the CMR of the program inside the transaction input.
225148

226-
**Steps:**
227-
1. Compile contract
228-
2. Fund P2TR address
229-
3. Compute sighash (IDE shows this)
230-
4. Sign sighash externally
231-
5. Enter signature in witness field
232-
6. Build and broadcast
233-
234-
### Time-Locked Contract
235-
236-
**Code:**
237-
```rust
238-
fn main() {
239-
jet::check_lock_time(1735689600);
240-
}
241-
```
242-
243-
**Steps:**
244-
1. Compile and fund
245-
2. Wait until timestamp
246-
3. Build transaction (no special witness)
247-
4. Broadcast after timestamp
248-
249-
---
149+
Use a backup to restore the original program that you used to create the UTXO. Alternatively, try to fix your current program to match the UTXO program.
250150

251151
## Web IDE Internals
252152

@@ -274,52 +174,8 @@ fn main() {
274174
5. Build complete witness stack
275175
6. Serialize transaction to hex
276176

277-
278-
---
279-
280-
## Troubleshooting
281-
282-
### Compilation Errors
283-
284-
**Error:** `Parameter X is missing an argument`
285-
286-
**Solution:** Provide argument in witness or parameters section
287-
288-
### Transaction Rejected
289-
290-
**Error:** `bad-txns-inputs-missingorspent`
291-
292-
**Solution:** UTXO already spent or doesn't exist. Check:
293-
```bash
294-
curl "https://blockstream.info/liquidtestnet/api/address/tex1p.../utxo"
295-
```
296-
297-
### Signature Invalid
298-
299-
**Error:** Program returns false
300-
301-
**Solution:**
302-
- Verify sighash is correct
303-
- Check signature is BIP-340 Schnorr (64 bytes)
304-
- Ensure public key matches
305-
306-
---
307-
308-
## Limitations
309-
310-
**Web IDE limitations:**
311-
- Testnet only (no mainnet)
312-
- Basic transaction building (single input/output)
313-
- No complex covenant testing
314-
- Browser-based (no local storage)
315-
316-
**For production:** Use CLI tools (simply, elements-cli)
317-
318-
---
319-
320177
## Next Steps
321178

322179
- **Learn SimplicityHL:** [Language Reference](../simplicityhl-reference/)
323180
- **CLI Development:** [Simply CLI Guide](simply-cli-guide.md)
324181
- **Use Cases:** [Example Contracts](../use-cases/)
325-

0 commit comments

Comments
 (0)