Skip to content
BlockstreamResearchPublic

About

A blazingly-fast, ux-first simplicity development framework.

Topics

Resources

Contributing

Security policy

Stars

56 stars

Watchers

1 watching

Forks

Repository files navigation

License: MIT Tests Integration Community

Smplx

A blazingly-fast, ux-first Simplicity development framework.

What

Simplex is a Rust-based, comprehensive development framework for SimplicityHL smart contracts, aiming to provide a rich tooling suite for implementing, testing, fuzz testing, and deploying smart contract on Liquid.

  • CLI for managing Simplicity-based projects.
  • SDK with essential SimplicityHL utilities.
  • SimplicityHL contracts unit and fuzz testing suite.
  • Liquid regtest for local integration testing.
  • Extensive framework configuration.

Warning

The framework is at the early stage of development, unforeseen breaking changes and critical bugs are expected.

Installation

curl -L https://smplx.simplicity-lang.org | bash
simplexup

See the simplexup manual for more details.

Getting started

Add smplx-std dependency to cargo:

cargo add --dev smplx-std

Optionally, initialize a new project:

simplex init <name>

Usage

Simplex is a zero-config framework. However, it requires a Simplex.toml file to exist in the project root.

The example below keeps the default settings. Dependencies, regtest ports, fuzz options, and external providers are optional, so their examples are commented out.

# Simplex config.

[build]
src_dir = "simf"
simf_files = ["**/*.simf"]
out_dir = "src/artifacts"

[dependencies]
# my_lib = { path = "../my_lib" }
# std = { git = "https://github.com/BlockstreamResearch/simplicityhl-std.git", tag = "v0.1.0" }

[regtest]
mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
bitcoins = 10_000_000
# Ports are assigned automatically. Authentication uses the node's cookie.
# rpc_port = 18443
# esplora_port = 3000
# rpc_user = "user"
# rpc_password = "password"

[test]
mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
bitcoins = 10_000_000
verbosity = "None" # "None", "Debug", or "Trace"

# [test.fuzz]
# cases = 10000
# seed = 12345 # random by default
# network = "ElementsRegtest" # "Liquid", "LiquidTestnet", or "ElementsRegtest"

# [test.esplora]
# url = "http://localhost:3000"
# network = "ElementsRegtest" # "Liquid", "LiquidTestnet", or "ElementsRegtest"

# [test.rpc]
# url = "http://localhost:18443"
# username = "user"
# password = "password"

Where:

  • build (simplex build config)
    • src_dir - The simplicity contracts source directory.
    • simf_files - A list of glob patterns indicating which contracts are in scope.
    • out_dir - The output directory where contracts artifacts are generated.
  • dependencies (simplex install config)
    • The list of SimplicityHL dependencies to install. Each entry uses either path or git as its source.
      • A Git dependency can select one tag, rev, or branch. An optional package field selects the repository subdirectory containing Simplex.toml.
  • regtest (simplex regtest config)
    • mnemonic - The signer's mnemonic regtest will send initial funds to.
    • bitcoins - Initial coins available to the signer.
    • rpc_port - Optional fixed Elements RPC port. A port is assigned automatically when omitted.
    • esplora_port - Optional fixed Electrs HTTP port. A port is assigned automatically when omitted.
    • rpc_user and rpc_password - Optional Elements RPC credentials. Set both to use username/password authentication instead of the node's cookie.
  • test (simplex test config)
    • mnemonic - The signer's mnemonic internal regtest will send initial funds to.
    • bitcoins - Initial coins available to the signer.
    • verbosity - Simplicity execution log level ("None", "Debug", or "Trace").
    • fuzz
      • cases - The number of fuzz iterations to do.
      • seed - The fuzzer random seed.
      • network - Network type for local fuzz transactions (Liquid, LiquidTestnet, ElementsRegtest).
    • esplora
      • url - Esplora API endpoint url.
      • network - Esplora network type (Liquid, LiquidTestnet, ElementsRegtest).
    • rpc
      • url - Elements RPC endpoint url.
      • username - Elements RPC username.
      • password - Elements RPC password.

CLI

Simplex CLI provides the following commands:

  • simplex init - Initializes a new Simplex project.
  • simplex config - Prints the current config.
  • simplex install <dep> - Installs SimplicityHL dependencies. Without a <dep> provided, installs everything listed in the [dependencies] config section. With one or more <dep> arguments, appends new entries to the config and then installs everything. The bare name std pins the latest SimplicityHL standard library release.
  • simplex build - Generates simplicity artifacts.
  • simplex regtest - Spins up local Electrs + Elements nodes.
  • simplex test - Runs Simplex tests. Provide a --fuzz flag to run Simplex fuzz tests.
  • simplex clean - Cleans up generated artifacts. Add --all to also remove installed dependencies.
  • simplex fmt - Formats SimplicityHL files according to the specified simfmt.toml or default configuration.

To view the available options, run the help command:

simplex -h

Example

Check out the complete project examples in the examples directory to learn more.

Contributing

We are open to any mind-blowing ideas! Please take a look at our contributing guidelines to get involved.

Future work

  • SimplicityHL storage compatibility.
  • SimplicityHL dependencies management.
  • Fuzz testing for SimplicityHL contracts.
  • Browser compatibility.
  • SDK support for taproot signer and custom descriptors.
  • SimplicityHL contracts static analyzer.
  • Test coverage reporting.
  • Local regtest 10x speedup.
  • Regtest cheat codes.
  • Comprehensive documentation.

Check out the full roadmap here.

License

The framework is released under the MIT License.

About

A blazingly-fast, ux-first simplicity development framework.

Topics

Resources

Contributing

Security policy

Stars

56 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages