LNP/BP Standards
  • List of specifications
  • Commitment schemes
    • LNPBP-1: Public keys
    • LNPBP-2: Script
    • LNPBP-3: Tx output
    • LNPBP-4: Multi-protocol
    • LNPBP-6: PayTweak
    • LNPBP-12: TapRet
    • LNPBP-8: Single-use-seals
    • LNPBP-10: TxO seals
    • LNPBP-81: Tagged Merkle trees
  • Bitcoin Protocol
    • LNPBP-5: Short tx ids
  • RGB
    • LNPBP-13: RGB consensus
    • RGB-20: Fungible assets
    • RGB-21: NFT collectibles
    • RGB-22: Digital identity
    • RGB-23: Audit logs
    • RGB-24: Domain names
    • LNPBP-31: Standard contractum lib
    • LNPBP-37: Invoices (rejected)
  • Lightning network protocol
    • LNPBP-46: LN derivations
    • LNPBP-50: Bifrost P2P
    • LNPBP-51: Bifrost channels
    • LNPBP-53: Multipeer channels
    • LNPBP-55: Bifrost HTLCs
Powered by GitBook
On this page
  • Abstract
  • Background
  • Motivation
  • Design
  • Specification
  • Compatibility
  • Rationale
  • Reference implementation
  • Acknowledgements
  • References
  • Copyright
Edit on GitHub
Export as PDF
  1. RGB

RGB-20: Fungible assets

LNPBP: 0020
Aliases: RGB20
Vertical: Smart contracts
Title: RGB fungible assets interface (RGB-20)
Authors: Dr Maxim Orlovsky <orlovsky@lnp-bp.org>,
         Giacomo Zucco,
         Marco Amadori,
         Nicola Busanello,
         Federico Tenga,
         Armando Dutra,
         Zoe Faltibà,
         Sabina Sachtachtinskagia,
         Martino Salvetti
Comments-URI: <https://github.com/LNP-BP/LNPBPs/discussions/140>
Status: Proposal
Type: Standards Track
Created: 2019-09-23
Updated: 2023-07-24
Finalized: ~
Copyright: (0) public domain
License: CC0-1.0

Abstract

Background

Motivation

Design

Overview

Asset information

Asset ownership

Issue

  • secondary issue

  • issue delegation

  • cancelling issue

Burning & replace

Proof of reserves

Specification

Interface specification is the following Contractum code:

-- Defined by LNPBP-31 standard in `RGBContract.sty` file
import urn:ubideco:stl:6vbr9ZrtsD9aBjo5qRQ36QEZPVucqvRRjKCPqE8yPeJr#choice-little-boxer as RGBContract

interface RGB20
    -- Asset specification containing ticker, name, precision etc.
    global spec :: RGBContract.DivisibleAssetSpec

    -- Contract data and creation date is separated from the spec since it must
    -- not be changeable by the issuer.
    global data :: RGBContract.ContractData
    global created :: RGBContract.Timestamp

    -- State which accumulates amounts issued
    global issuedSupply+ :: RGBContract.Amount
    -- State which accumulates amounts burned
    global burnedSupply* :: RGBContract.Amount
    -- State which accumulates amounts burned and then replaced
    global replacedSupply* :: RGBContract.Amount

    -- Right to do a secondary (post-genesis) issue
    public inflationAllowance* :: Zk64
    -- Right to update asset Specification
    public updateRight?

    -- Right to open a new burn & replace epoch
    public burnEpoch?
    -- Right to burn or replace existing assets under some epoch
    public burnRight*

    -- Ownership right over assets
    private assetOwner* :: Zk64

    genesis       :: spec
                   , data
                   , created
                   , issuedSupply
                   , reserves {RGBContract.ProofOfReserves ^ 0..0xFFFF}
                  -> assetOwner*
                   , inflationAllowance*
                   , updateRight?
                   , burnEpoch?
                  -- errors which may be returned:
                  !! supplyMismatch
                   | invalidProof
                   | insufficientReserves

    op Transfer    :: previous assetOwner+
                   -> beneficiary assetOwner+
                   !! nonEqualAmounts

    -- question mark after `op` means optional operation, which may not be  
    -- provided by some of schemata implementing the interface

    op? Issue      :: used inflationAllowance+
                    , reserves {RGBContract.ProofOfReserves ^ 0..0xFFFF}
                   -> issuedSupply
                    , future inflationAllowance*
                    , beneficiary assetOwner*
                   !! supplyMismatch
                    | invalidProof
                    | issueExceedsAllowance
                    | insufficientReserves

    op? OpenEpoch  :: used burnEpoch
                   -> next burnEpoch?
                    , burnRight

    op? Burn       :: used burnRight
                    , burnedSupply
                    , burnProofs {RGBContract.ProofOfReserves ^ 0..0xFFFF}
                   -> future burnRight?
                   !! supplyMismatch
                    | invalidProof
                    | insufficientCoverage

    op? Replace    :: used burnRight
                    , replacedSupply
                    , burnProofs {RGBContract.ProofOfReserves ^ 0..0xFFFF}
                   -> future burnRight?
                    , beneficiary assetOwner+
                   !! nonEqualAmounts
                    | supplyMismatch
                    | invalidProof
                    | insufficientCoverage

    op? Rename     :: used updateRight
                   -> future updateRight?
                    , new spec

Compatibility

This standard is the first fungible token interface defined for RGB assets, so compatibility with other standards do not apply.

The standard provides a superset for ERC20 token capabilities; however due to RGB nature it is not directly compatible with ERC20 and other similar standards using account-based blockchains (and not client-side-validation on UTXO chains). However, a ERC20 tokens may be re-issued or bridged under this standard.

Rationale

Include from

Reference implementation

Acknowledgements

References

Copyright

This document is licensed under the Creative Commons CC0 1.0 Universal license.

PreviousLNPBP-13: RGB consensusNextRGB-21: NFT collectibles

Last updated 1 year ago

To the extent possible under law, has waived all copyright and related or neighboring rights to this work.

https://github.com/LNP-BP/LNPBPs/issues/27
https://github.com/LNP-BP/LNPBPs/issues/28
https://github.com/LNP-BP/LNPBPs/issues/50
https://github.com/RGB-WG/rgb-std/blob/master/src/interface/rgb20.rs
Abstract
Background
Motivation
Design
Specification
Compatibility
Rationale
Reference implementation
Acknowledgements
References
Copyright
LNP/BP Standards Association