#bitcoin #lightning #rgb #smart-contracts #lnp-bp

rgb-core

RGB Core Library: consensus & verification for private & scalable client-validated smart contracts on Bitcoin & Lightning

40 releases

new 0.9.0 Jan 26, 2023
0.9.0-rc.2 Dec 27, 2022
0.8.2 Dec 25, 2022
0.8.1 Nov 16, 2022
0.4.3 Mar 19, 2021

#838 in Magic Beans

Download history 77/week @ 2022-10-10 55/week @ 2022-10-17 134/week @ 2022-10-24 68/week @ 2022-10-31 276/week @ 2022-11-07 322/week @ 2022-11-14 101/week @ 2022-11-21 146/week @ 2022-11-28 85/week @ 2022-12-05 113/week @ 2022-12-12 229/week @ 2022-12-19 483/week @ 2022-12-26 162/week @ 2023-01-02 216/week @ 2023-01-09 231/week @ 2023-01-16 164/week @ 2023-01-23

779 downloads per month
Used in 19 crates (10 directly)

MIT license

425KB
9K SLoC

RGB Core Library

Build Tests Lints codecov

crates.io Docs unsafe forbidden MIT licensed

RGB is confidential & scalable client-validated smart contracts for Bitcoin & Lightning. To learn more about RGB please check RGB blueprint and RGB FAQ websites.

RGB Core library provides consensus-critical and validation code for RGB. It is a standard implementation, jointly with LNP/BP Standards defining RGB consensus and validation rules.

The consensus-critical code library is shared with the following libraries:

  1. Client-side-validation Foundation Lib. It is non-bitcoin-specific library, covering concepts related to client-side-validation (commitments, single-use-seals abstracted from bitcoin, consensus-critical data encoding protocols).
  2. BP Core Lib. This is client-side-validation applied to bitcoin protocol with deterministic bitcoin commitments (tapret) and TXO-based single-use-seals.
  3. AluVM virtual machine used by RGB for Turing-complete smart contract functionality.
  4. Encoding schema, defining structured data types used in RGB smart contracts.

The development of the project is supported and managed by LNP/BP Standards Association. The design of RGB smart contract system and implementation of this and underlying consensus libraries was done in 2019-2022 by Dr Maxim Orlovsky basing or earlier ideas of client-side-validation and RGB as "assets for bitcoin and LN" by Peter Todd and Giacomo Zucco. Upon the release of RGBv1 the protocol will be immutable and this library will accept only bugfixes; i.e. it will be ossified by requiring consensus ACK for the new changes across the large set of maintainers.

The current list of the projects based on the library include:

  • RGB Standard Lib: library providing high-level RGB smart contract API in rust.
  • RGB Node: standalone & embeddable node for running RGB.
  • MyCitadel Node: wallet node providing RGB smart contract functionality integrated with Lightning network, bitcoin blockchain indexers, decentralized data storage and propagation (Storm) and wallet services. It can run as embedded, desktop, server or cloud-based node.

Use

Minimum supported rust compiler version (MSRV): 1.59, rust 2022 edition.

The library can be integrated into other rust projects via Cargo.toml [dependecies] section:

[dependencies]
rgb-core = "0.8"

If the library will be used for wallet applications and work with PSBT files, than use wallet feature, which is non-default:

[dependencies]
rgb-core = "0.8"

For serialization purposes library provides serde feature, which is turned off by default.

Contributing

Currently, library functionality is freezed and as a part of ossification only bugfixes are accepted.

Altcoins and "blockchains" other than Bitcoin blockchain/Bitcoin protocols are not supported and not planned to be supported; pull requests targeting them will be declined.

License

See LICENCE file.

Dependencies

~14MB
~232K SLoC