Published on: 2021-04-16T18:12:10+00:00
Jeremy Rubin has introduced Sapio, a shallow e-DSL built in Rust for Bitcoin smart contract programming flows. Inspired by his experience with BlueSpec and transaction circuits, Sapio aims to be Turing complete for federated operators and allows for tracking logic via updatable finish clauses while producing a finite deterministic "binary" of transactions. It plans to integrate Miniscript as the backend key description language and is similar to Solidity, but with Solidity contracts being "stateless". The hosting language is full, general, and Turing-complete, complementing the non-Turing-complete contract description. ZmnSCPxj suggests a language design with two layers, a non-Turing-complete total "base language" and a syntax meta-language similar to Scheme `syntax-rules`, which can construct ASTs for the "base language". This design allows developers to observe whether the meta-program halts and strike a balance between human brain input bandwidth and limited processing power.ZmnSCPxj, a Bitcoin developer, introduces Sapio to the Bitcoin Developers community and agrees with the rant on monetary units. In C-Lightning, values are output as strings with an explicit `msat` unit, even for on-chain values. He prefers a non-embedded DSL over an embedded one, as it requires users to learn two languages. He proposes using a non-Turing-complete total "base language" and a syntax meta-language similar to Scheme `syntax-rules` for designing a more effective language. This scheme provides developers with the ability to observe whether the meta-program halts and assures end-users that the program will terminate. ZmnSCPxj emphasizes the importance of striking a balance between the low input bandwidth of human brains and their limited processing power.Sapio is an innovative tool that enables Bitcoin developers to create smart contracts in an intuitive, safe, and composable manner. Contrary to the belief that creating complex smart contracts for Bitcoin is impossible, Sapio opens the door for easily defining new ideas. It currently works on mainnet without any protocol changes and will be compatible with BIP-119 OP_CHECKTEMPLATEVERIFY and Taproot in the future. The language has undergone significant evolution since its introduction. Those interested can learn more about what's possible by reading "Designing Bitcoin Smart Contracts with Sapio" and watching "My Reckless VR Talk". The first Sapio contract to run on mainnet, a Congestion Control Tree contract with 25 recipients, is currently being executed. The source code, arguments, compiler outputs, and transactions of this contract are available for review.The Sapio repository includes examples for derivatives, vaults, coin pools, games, side chains, and more. While these examples are not production-grade contracts, they serve as demonstrations of the potential capabilities of Sapio. Developers are encouraged to open pull requests (PRs) with their ideas or issues encountered during implementation. Tux, an experimental GUI, allows users to inspect, simulate, and interact with smart contracts. However, as the software is still a work-in-progress, it is advised to use regtest cautiously. Sufficient components of Sapio are functional enough to share the project and invite more developers to contribute or support it. Judica.org develops Sapio as a free and open-source tool for all bitcoiners. The achievement of the first mainnet Sapio contract milestone was made possible with the support of Ryan Grant, BitMEX, ACINQ, Delphi Digital, Backend Capital, Jeremy Rubin’s GitHub sponsors, and other fiscal and technical supporters. The contributions made to Miniscript and the rust-bitcoin ecosystem are also acknowledged.
Updated on: 2023-08-02T03:33:33.928834+00:00