The standard library implementation for SimplicityHL.
simf/lib
├── secp256k1
│ └── operations.simf
│ ├── Conversions between `Ge`, `Gej`, and compressed `Point`.
│ ├── Subtraction for `Fe`, `Scalar`, `Gej`.
│ ├── Equality predicates and their `assert_*` counterparts.
│ └── Safe Jacobian-to-affine normalization.
├── u1
│ └── convert.simf
│ └── Conversions from `u1` to other uint types and `bool`.
├── u8
├── u16
├── u32
├── u64
│ ├── convert.simf
│ │ └── Conversions between `u8`, `u16`, `u32`, `u64` and other uint types.
│ ├── math.simf
│ │ └── Overflow-checked arithmetic and `gt`/`ge` functions.
│ └── mul_div.simf
│ └── Full-precision calculation of `floor(a * b / denominator)`.
├── u128
├── u256
│ ├── bit.simf
│ │ └── Basic bit operations available as jets for `u8`-`u64` but missing for `u128` and `u256`.
│ ├── comparison.simf
│ │ └── Basic comparison operations available as jets for `u8`-`u64` but missing for `u128` and `u256`.
│ ├── convert.simf
│ │ └── Conversions between `u128`, `u256` and other uint types.
│ ├── math.simf
│ │ └── Carry/borrow arithmetic, multiplication, division, and overflow-checked wrappers.
│ └── mul_div.simf
│ └── Full-precision calculation of `floor(a * b / denominator)`.
├── utxo
│ ├── asserts
│ │ ├── amount.simf
│ │ │ └── Functions for asserting `Amount` in inputs and outputs.
│ │ ├── asset_id.simf
│ │ │ └── Functions for asserting `AssetId` in inputs and outputs.
│ │ └── asset_id_with_amount.simf
│ │ └── Functions for asserting `Amount` and `AssetId` in inputs and outputs.
│ └── getters
│ ├── amount.simf
│ │ └── Functions for retrieving `Amount` in inputs and outputs.
│ ├── asset_id.simf
│ │ └── Functions for retrieving `AssetId` in inputs and outputs.
│ ├── asset_id_with_amount.simf
│ │ └── Functions for retrieving `Amount` and `AssetId` in inputs and outputs.
│ └── script_hash.simf
│ └── Functions for retrieving hash of the scriptPubKey in inputs and outputs.
├── asserts.simf
│ └── Assertion helpers: `assert_eq_*` for uints and `bool`, plus `assert_none_*` for `Option`.
├── binary.simf
│ └── Basic binary logic operations: `and`, `or`, `not`, `xor`.
└── op_return.simf
└── Utilities for detecting and enforcing `OP_RETURN` (null data) outputs.First, install simplex development framework:
curl -L https://smplx.simplicity-lang.org | bash
simplexupThen install simplicityhl-std dependency via simplex.
simplex install https://github.com/BlockstreamResearch/simplicityhl-stdNote
The library works with Simplex versions 0.0.11 and 0.0.12.
Documentation for the standard library functions is maintained in this repository at docs/stdlib.json.
You can find a rendered standard library reference on our developer documentation site.
After installing the library, import modules from std::lib:
use std::lib::u32::math::add_32;
use std::lib::asserts::assert_eq_32;
fn main() {
assert_eq_32(add_32(1, 2), 3);
}We are open to any mind-blowing ideas! Please take a look at our contributing guidelines to get involved.
The library is released under the MIT License.