Code Monkey home page Code Monkey logo

rgb-core's Introduction

RGB Core Library

Build Tests Lints codecov

crates.io Docs unsafe forbidden Apache-2 licensed

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

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 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. Strict types, defining memory layout and serialization of 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-2024 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 Wallet: runtime and command-line tool for working with RGB.

Contributing

Currently, library functionality is frozen 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.

rgb-core's People

Contributors

afilini avatar awesome-doge avatar claudiosdc avatar crisdut avatar cymqqqq avatar dependabot[bot] avatar dr-orlovsky avatar fedsten avatar inaltoasinistra avatar kixunil avatar nicbus avatar rajarshimaitra avatar shuoer86 avatar ukolovaolga avatar vuittont60 avatar whfuyn avatar yancyribbens avatar yanganto avatar zoedberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rgb-core's Issues

Implement embedded RGB smart contract validation procedures

Before introduction of simplicity some specific complex forms of validation (like zk-validation for confidential amounts ensuring that the sum of inputs is always equal to the sum of outputs) is made with embedded rust procedures, which are the part of this library. However, to cover all initial schemata functionality we need to implement more (this is an incomplete list):

  • Fungible assets
    • Primary issuance
    • Asset transfer
    • Secondary issuance
    • Burn verification for asset burning
    • Replacement (re-issuance after burn)
    • On-chain bitcoin lock verification (for decentralized issuance)
  • Non-fungible assets
    • Primary issuance
    • Asset transfer
      ...
  • Reputation
    ...
  • Audit logs
    ...

Data Container implementation and related updates

Support for 128-bit Pedersen commitments and bulletproofs

This requires changes to Pedersen and bulletproofs implementations, so clearly an upstream dependency.

256-bits can't be supported, since Secp256k1 curve has less than 2^256 points. This can be done only with an option of failing to commit to the top of 256-bit unint range.

https://github.com/LNP-BP/rust-lnpbp/blob/6010402f8e49fd05ad23f8c0e93ffe079d33d378/src/rgb/schema/state.rs#L853-L855

https://github.com/LNP-BP/rust-lnpbp/blob/6010402f8e49fd05ad23f8c0e93ffe079d33d378/src/rgb/schema/state.rs#L891-L900

Asset state transition node ID mutability

During my tests and investigation of RGB node's internals, I have noticed a particular behavior that does not seem to be there by design but rather to be an undesirable side effect: the fact that the node ID of an asset state transition data structure will mutate as its internal assignments are concealed/revealed.

As observed, the aforementioned behavior contributes for some data inconsistencies, one of which has already ben reported as an issue (#130) and for which a pull request (#131) with a proposed fix has already been opened. Another one of such data inconsistencies is described below.

During the accept phase of an asset transfer operation, the state transition added to the receiving RGB node's stash has a node ID (which is shown as its filename) different from the node ID of the new entry added to the known_allocations field of the asset data structure maintained in the RGB node's cache (which can be retrieved by means of the fungible list -l command), even though they refer to the same asset state transition.

This particular data inconsistency is due to the fact that the asset state transition extracted from the consignment data structure has the seal of the assignment used to allocate the transferred assets to the receiving endpoint revealed before the state transition is added to the stash. In contrast, the original state transition (with the concealed seal) is used when adding the new asset allocation to the asset data structured maintained in the cache.

That same misbehavior seems to apply to asset state extensions, even though there are no evidences to confirm it as that functionality does not seem to be fully implemented.

[Upstream] Add support for 128 bits and schnorr signatures.

Use secp256k1-zkp for bulletproofs & Pedersen commitments

Tracking PRs:


  • get it merged
  • do rust bindings
  • get new version released to crates.io

OUTDATED:

Using BlockstreamResearch/secp256k1-zkp#23

Comment by Nickler from #secp256k1": what this PR doesn't include yet is a great way to import/export circuits and assignments. For purify I didn't do this very methodically either (https://github.com/sipa/purify/pull/2/files#diff-95a4fca4441ac563d430a430c9b3b07aR410).

Add support for 128 and 256 bit data in RGB Schema and Contracts

contrib/test.sh failing

probably some modification required in test.sh. Its failing in my local as below

 Finished dev [unoptimized + debuginfo] target(s) in 6.83s
+ cargo check --verbose --features=lnp --all-targets
error: Package `rgb-core v0.4.0-beta (/home/raj/github-repo/rgb-core)` does not have the feature `lnp`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.