a framework for creating composable multi-transaction Bitcoin Smart Contracts.
The root crate is a workspace for various Sapio Components such as:
- Sapio CLI: Easy to use interface for using and running sapio contracts.
- Sapio Language: Base Specification for Sapio Language and Contract Generation
- Plugin Example: Example Project for a Sapio Plugin
- Sapio Contrib: Contract modules / functionality made available for general use
- Plugin Framework: Library for bundling Sapio Plugins
- CTV Emulator: Emulation protocols and servers for CheckTemplateVerify.
- Sapio Front: Protocols for interacting with a compilation session
- Sapio Compiler Server: Binary for a websocket server running sapio-front
Sapio should work on all platforms, but is recommend for use with Linux (Ubuntu preferred). Follow this quickstart guide to get going.
- Get rust if you don't have it already.
- Add the wasm target by running
rustup target add wasm32-unknown-unknown
in your terminal. - Get the wasm-pack tool.
- Clone this repo:
git clone git@github.com:sapio-lang/sapio.git && cd sapio
- Build the plugin
cd plugin-example && wasm-pack build && cd ..
- Instantiate a contract from the plugin:
cargo run --bin sapio-cli -- contract create 9.99 "{\"participants\": [{\"amount\": 9.99, \"address\": \"bcrt1qs758ursh4q9z627kt3pp5yysm78ddny6txaqgw\"}], \"radix\": 2}" --file="plugin-example/pkg/sapio_wasm_plugin_example_bg.wasm"
to see some magic!
You can use cargo run --bin sapio-cli -- help
to learn more about what a the CLI can do! and cargo run --bin sapio-cli -- <subcommand> help
to learn about subcommands like contract
.
As a second experiment, try modifying the contract in plugin-example to one
of the contracts from sapio-contrib! Remember to recompile plugin-example
with wasm-pack build
!
Still hungry for more? Implement your own smart contract idea -- you can use sapio-contrib for inspiration or as building blocks for something new!
Stuck? Run cargo doc --open --no-deps
to build and open the documentation
locally, or just shoot me a note and I'll guide you through it! Any and all
feedback welcome!