MCPcopy Index your code
hub / github.com/BlockstreamResearch/smplx

github.com/BlockstreamResearch/smplx @v0.0.8

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.0.8 ↗ · + Follow
373 symbols 982 edges 83 files 63 documented · 17%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

License: MIT Tests Integration Community

Smplx

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

What

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

  • CLI for managing simplicity-based projects.
  • SDK with essential simplicity utilities.
  • Liquid regtest for local integration testing.
  • Extensive framework configuration.

[!WARNING] The framework is at the extremely 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 default configuration is the following:

# Simplex config

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

[dependencies]
some_dep = { git = "<git url>", path = "<or a relative path>" } 

[regtest]
mnemonic = "exist carry drive collect lend cereal occur much tiger just involve mean"
bitcoins = 10_000_000
rpc_port = 18443
esplora_port = 3000
rpc_user = "user"
rpc_password = "password"

[test]
mnemonic = "exist carry drive collect lend cereal occur much tiger just involve mean"
bitcoins = 10_000_000
verbosity = 0 # 0 - none, 1 - debug, 2 - trace

[test.esplora]
url = "<esplora url>"
network = "<Liquid, LiquidTestnet, ElementsRegtest>"

[test.rpc]
url = "<rpc url>"
username = "<rpc username>"
password = "<rpc password>"

Where:

  • build (simplex build config)
  • src_dir - The simplicity contracts source directory.
  • simf_files - A glob pattern 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.
  • regtest (simplex regtest config)
  • mnemonic - The signer's mnemonic regtest will send initial funds to.
  • bitcoins - Initial coins available to the signer.
  • rpc_port - The port Elements regtest node will listen on.
  • esplora_port - The port Electrs will listen on.
  • rpc_user - Elements regtest RPC username.
  • rpc_password - Elements regtest RPC password.
  • 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 pruning log level.
  • 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 - Installs specified SimplicityHL dependencies.
  • simplex build - Generates simplicity artifacts.
  • simplex regtest - Spins up local Electrs + Elements nodes.
  • simplex test - Runs Simplex tests.
  • simplex clean - Cleans up generated artifacts.

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

  • [x] Complete simplex init and simplex clean tasks.
  • [x] Simplicity storage compatibility.
  • [x] Simplicity dependencies management.
  • [ ] SDK support for confidential assets, taproot signer, and custom witness signatures.
  • [ ] Local regtest 10x speedup.
  • [ ] Regtest cheat codes.
  • [ ] Browser compatibility.
  • [ ] Comprehensive documentation.

Check out the full roadmap here.

License

The framework is released under the MIT License.

Extension points exported contracts — how you extend this code

ProviderTrait (Interface)
Baseline traits detailing required interaction methods between the SDK client and the underlying blockchain node or API. [2 …
crates/sdk/src/provider/core.rs
SignerTrait (Interface)
Common signing interface spanning over standard explicit inputs and Simplicity programs. [1 implementers]
crates/sdk/src/signer/core.rs
ArgumentsTrait (Interface)
An interface for structs capable of generating static argument mapping for Simplicity programs. See the `include_simc!() [1 …
crates/sdk/src/program/arguments.rs
ProgramTrait (Interface)
Executes `simplicity` programs at runtime. This trait defines a core behavior related to testing and execution. [1 implementers]
crates/sdk/src/program/core.rs
WitnessTrait (Interface)
An interface for structs capable of generating Simplicity program witness mappings. See the ` include_simc!()` macro, wh
crates/sdk/src/program/witness.rs

Core symbols most depended-on inside this repo

add_output
called by 27
crates/sdk/src/transaction/final_transaction.rs
as_ref
called by 22
crates/sdk/src/transaction/tx_receipt.rs
send
called by 19
crates/sdk/src/signer/core.rs
get_address
called by 17
crates/sdk/src/signer/core.rs
build_arguments
called by 14
crates/sdk/src/program/core.rs
add_input
called by 14
crates/sdk/src/transaction/final_transaction.rs
broadcast
called by 12
crates/sdk/src/signer/core.rs
get_blinding_public_key
called by 10
crates/sdk/src/signer/core.rs

Shape

Method 217
Function 84
Class 44
Enum 23
Interface 5

Languages

Rust100%

Modules by API surface

crates/sdk/src/signer/core.rs38 symbols
crates/sdk/src/transaction/final_transaction.rs35 symbols
crates/sdk/src/program/core.rs30 symbols
crates/sdk/src/provider/esplora.rs20 symbols
crates/sdk/src/signer/wtns_injector.rs16 symbols
crates/sdk/src/provider/simplex.rs14 symbols
crates/test/src/context.rs12 symbols
crates/sdk/src/transaction/partial_input.rs12 symbols
crates/regtest/src/client.rs11 symbols
crates/sdk/src/global.rs9 symbols
crates/sdk/src/utils.rs8 symbols
crates/sdk/src/provider/rpc/elements.rs8 symbols

For agents

$ claude mcp add smplx \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact