/sigma-rust-mini

Minified sigma-rust, just enough to handle simple transactions (with P2PK addresses only) and/or sign reduced transactions for ErgoPay

Primary LanguageRustCreative Commons Zero v1.0 UniversalCC0-1.0

This repository is the fork of sigma-rust created for lightweight wallets where most of the sigma-rust advanced features are not required. Unless you have such a specific case, you're better off using the original sigma-rust.

The original codebase of sigma-rust is heavily minimized to prune everything not related to signing simple transactions. However, the original design is preserved and as a result most of the original tests remained unchanged.

Due to the highly focused nature, this library supposed to be stable, all new features can be done elsewhere.

Use Cases

Lightweight Ergo Wallets

You want to interact with Ergo blockchain and want to support only basic P2PK addresses, BIP-32 keys, and interact with dApps via ErgoPay. You don't want to compile smart contracts, interact with contracts directly and, therefor, you don't need the ErgoTree interpreter. And you also want a minimalistic non-opinionated library that is focused on keys management and transaction signing. You also have your own Android/iOS/JS/Whatever bindings or don't need them at all. You are also planning your way of interacting with Ergo nodes.

Third-party Ergo Integration and Security Audit

You want to integrate you library/ecosystem with Ergo blockchain and need to avoid new dependencies. This library is already minimized towards what you need so you can copy the code and even minimize it further. It helps passing code audit.

Education

You may be interested to learn blockchain development, Ergo, Rust or all of it. You can start from this library and then switch to full-blown sigma-rust.

See Architecture for high-level overview.

Limitations of sigma-rust-mini

This library has the limitations vs the original sigma-rust described below.

Rudimentary ErgoTree

Only Constant and ConstantPlaceholder nodes allowed in sigma-rust-mini. And because ErgoTree root expression should be of type SigmaProp, then only Literal::SigmaProp can be in the ErgoTree.

Limited Addresses

P2S addresses are supported but can only contain rudimentary ErgoTrees.

Crates

ergo-lib

Overarching crate exposing wallet-related features: chain types (transactions, boxes, etc.), JSON serialization, simple box selection for tx inputs, tx builder and signing. Exports other crates API, probably the only crate you'd need to import.

ergotree-interpreter

Heavily pruned ErgoTree interpreter. The original sigma-rust design is preserved, all ErgoTree operations were removed along with evaluation and related code.

ergotree-ir

Heavily pruned ErgoTree IR. The original sigma-rust design is preserved, but most of the nodes and related serializers and code were pruned.

ergoscript-compiler

ErgoScript compiler was completely removed

sigma-ser

Ergo binary serialization primitives. Remained mostly unchanged.

Bindings

The following bindings form sigma-rust was removed. If you need them then use the original sigma-rust.

Changelog

See CHANGELOG.md.

Since all bindings were removed, most of the original examples are not relevant, except pure Rust examples listed below.

Rust:

Also take a look at tests where various usage scenarios were implemented.

And last but not the least, there is a whole section of examples for the original sigma-rust library.

Contributing

See Contributing guide.

Feel free to join the Ergo Discord and ask questions on #dev-tooling channel.