Skip to content

Try it in your browser

This page compiles and runs SimplicityHL directly in your browser, using the same compiler and Simplicity bit machine used on-chain. Nothing you type here is sent to a server. The compiler downloads once, on the first Run; after that, each Run is immediate.

A SimplicityHL program does not return a value. It either holds or it does not. A transaction spending a SimplicityHL-locked output is valid exactly when the program holds.

Assertions
Edit the code, then Run (Ctrl+Enter)

Changing the second argument from 2 to 3 and running again produces a program that still compiles — it is valid, well-typed code — but does not hold. On-chain, this is a rejected spend, not a runtime error.

Addition that can overflow returns the overflow condition as an explicit value, rather than wrapping silently or raising an error.

Arithmetic overflow
Edit the code, then Run (Ctrl+Enter)

Running this prints overflowed: true and sum: 705032704, the wrapped result of 4000000000 + 1000000000. Changing the first argument to 2000000000 removes the overflow: overflowed becomes false, and the final assertion, which requires it to be true, fails. The addition still succeeds; only the assertion does not.

A SimplicityHL program runs in the context of a specific transaction input, and can inspect that transaction directly: which input it is, how many inputs the transaction has, and other properties. This is what a covenant is built from — a spending condition that can constrain the transaction itself, not only who is authorized to spend it.

Transaction introspection
Edit the code, then Run (Ctrl+Enter)

This runs against a placeholder transaction with a single input, so it prints jet::current_index(): 0 and jet::num_inputs(): 1. Checked against a real transaction, these jets return the transaction’s actual values; the tutorial linked below does this against a live Liquid testnet transaction.