Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
Split protocol_specifications.md into multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
afilini committed Jun 8, 2018
1 parent ed647ac commit 7ba5e85
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 163 deletions.
165 changes: 2 additions & 163 deletions protocol_specifications.md → 00-introduction.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RGB Protocol Specification V0.21
# RGB Protocol Specification #00: Introduction
* [Abstract](#abstract)
* [Motivation](#motivation)
* [Digital Assets](#digital-assets)
Expand All @@ -17,35 +17,6 @@
* [Extended URI](#extended-uri)
* [Proofmarshal Integration](#proofmarshal-integration)
* [Lightning Network Integration](#lightning-network-integration)
* [Structure](#structure)
* [Address-Based vs UTXO-Based](#address-based-vs-utxo-based)
* [Proofs](#proofs)
* [Color Addition](#color-addition)
* [Exemplified Process Description](#exemplified-process-description)
* [Basic Asset Issuance](#basic-asset-issuance)
* [On-chain Asset Transfer](#on-chain-asset-transfer)
-- the following points are to be expanded --
* [Lightning Asset Transfer](#lightning-asset-transfer)
* [Proofmarshal Asset Transfer](#proofmarshal-asset-transfer)
* [Basic Asset Redeeming](#basic-asset-redeeming)
* [Basic Asset Re-issuance](#basic-asset-re-issuance)
* [Reference Implementation](#reference-implementation)
* [Requirements Check](#requirements-check)
* [Standardness check](#standardness-check)
* [Auditability check](#auditability-check)
* [Blindness/Federation check](#blindnessfederation-check)
* [Full Decentralization check](#full-decentralization-check)
* [Future Evolutions](#future-evolutions)
* [Advanced Scripts](#advanced-scripts)
* [Multiple Asset Management](#multiple-asset-management)
* [Simplified Issuance](#simplified-issuance)
* [Issuer Fees](#issuer-fees)
* [DBTEE Contracts](#dbtee-contracts)
* [BOLT-based Exchange](#bolt-based-exchange)
* [Asset-enabled Side-chains](#asset-enabled-side-chains)
* [Explanatory Notes](#explanatory-notes)
* [Open Points](#open-points)
* [Copyright](#Copyright)

## Abstract
This document contains the technical specification for the proposed “RGB” protocol for the issuance, the storage and the transfer of blockchain-based digital assets. The protocol aims to provide a standard to perform the aforementioned goal in a way that overcomes the major shortcomings of previous attempts. The protocol is based on Bitcoin, and it’s aimed to provide an acceptable level of scalability, confidentiality, and standardness.
Expand Down Expand Up @@ -95,136 +66,4 @@ Since any assumption of additional protocols for off-band communication weakens
The protocol will also include another L2 strategy for scalability/fungibility, an asset-specific implementation of the “Proofmarshal” concept, based on “Single-Use-Seals” and “Proof-of-Publication-Ledgers”. In this integration, a Publisher Server *might* also act as **“sealer”**, with the ability to censor transactions but not to manipulate/forge/falsify them by committing multiple proofs from different anonymous users to a single UTXO. This could decouple the anti-double-spending function of the Bitcoin blockchain from the specific asset transations, making possible to "seal" a huge number of them spending a single Bitcoin UTXO.

#### Lightning Network Integration
Being the protocol UTXO-based, it will be possible to link one or more assets owned to a Lightning Network channel which becomes *colored*, exchanging state updates which are compliant to the asset scheme, with strong guarantees that asset distribution will be preserved also in case of non-consensual closures. In this way, it will be possible to leverage the scalability and privacy features of the Lightning Network, as well as LN-enabled atomic swaps for decentralized asset exchange.

### Structure

##### Address-Based vs UTXO-Based

RGB allows the sender of a colored transaction to transfer the ownership of any asset in two slightly different ways:

* **Address-Based** if the receiver prefers to receive the colored UTXO itself;
* **UTXO-Based** if the receiver already owns one ore more UTXO(s) and would like to "bind" its new tokens he is about to receive to this/those UTXO(s). This allows the sender to spend the nominal Bitcoin value of the UTXO which was previously bound to the tokens however he wants (send them back to himself, make an on-chain payment, open a Lightning channel or more). The UTXO is serialized as `SHA256(TX_HASH:OUTPUT_INDEX)` in order to increase the privacy of the receiver.

##### Proofs

Every RGB on-chain transaction will have a corresponding **"proof"**, where the payer encrypts, using the payee’s dark-tag, the following information in a structured way:

* the entire chain of proofs received up to the issuance contract;
* a list of triplets made with:
* color of the token being transacted
* amount being transacted
* either the hash of an UTXO in the form (TX_hash, index) to send an *UTXO-Based* transaction or an index which will bind those tokens to the corresponding output of the transaction *spending* the colored UTXO.
* an optional free field to pass over transaction meta-data that could be conditionally used by the asset contract to manipulate the transaction meaning (generally for the "meta-script" contract blueprint);
* The parameters used to create the signature, in order to allow the payee and the following receivers of these tokens to verify the commitment **[expand]**

In order to help a safe and easy management of the additional data required by this feature, the dark-tag can be derived from the BIP32 derivation key that the payee is using to generate the receiving address.

**[note on safety of mixing Bitcoin and RGB addresses]**

This feature should enhance the anonymity set of asset users, making chain analysis techniques almost as difficult as ones on “plain bitcoin” transactions. The leakage of a specific transaction dark-tag gives away the path from the issuing to the transaction itself, and of the “sibling” transactions, but it preserves uncertainty about other branches.

#### Color Addition
[expand]
## Exemplified Process Description
The following Process Description assumes:

* one-2-one transfers after the issuance (many-to-many transfers are possible);
* single-asset issuance and transfers (multi-asset issuance and transfers are possible);
### Basic Asset Issuance

1. The issuer prepares the public contract for the asset issuing, with the following structure:

```c
{
"kind": 0x01 // The kind of contract we are creating, in this case a generic issuance
"version":{
// Version of this contract kind to use - https://semver.org
"major": <Integer>, // version when you make incompatible API changes
"minor": <Integer>, // version when you add functionality in a backwards-compatible manner
"patch": <Integer> // version when you make backwards-compatible bug fixes
},
"title": <String>, // Title of the asset contract
"description": <String>, // Description of possible reediming actions and non-script conditions
"issuance_utxo": <String>, // The UTXO which will be spent with a commitment to this contract,
"contract_url": <String>, // Unique url for the publication of the contract and the light-anchors
"total_supply": <Integer>, // Total supply in satoshi (1e-8)
"max_hops": <Integer>, // Maximum amount of onchain transfers that can be performed on the asset before reissuance
"min_amount": <Integer>, // Minimum amount of colored satoshis that can be transfered together

"owner_utxo": <String>, // The UTXO which will receive all the issued token. This is a contract-specific field.
}
```

2. The issuer spends the `issuance_utxo` with a commitment to this contract and publishes the contract. *`total_supply`* tokens will be created and sent to `owner_utxo`.

### On-chain Asset Transfer
1. The payee can either chose one of its UTXO or generates in his wallet a receiving address as per BIP32 standard, together with 30 bytes of entropy, which will serve as dark-tag for this transfer.
2. The payee transmits the UTXO or the address, the dark-tag and a list of storage servers he wishes to use to the payer.
3. The payer composes (eventually performing a coin-selection process from several unspent colored outputs), signs and broadcasts with his wallet a transaction with the following structure (the order of inputs and output is irrelevant):
* Inputs
* Colored Input 1: valid colored (entirely or partially) UTXO to spend
* Colored Input 2: (optional)
* Outputs
* Colored Output 1: address of the Nth receiver (if performing an *Address-Based* transaction)
* Colored Output 2: (optional) another address of the payer for the colored (up to capacity) and non-colored change

The payer also produces a new transfer proof containing:

* A list of triplets made with:
* color of the token being transacted;
* amount being transacted;
* either the hash of an UTXO in the form `SHA256(TX_HASH:OUTPUT_INDEX)` to send an *UTXO-Based* tx or the index of the output sent to the receiver to send an *Address-Based* tx;
* Signature(s) of the proof using the same pubkeys specified in the Bitcoin `scriptPubKey`;
* The parameter(s) used to create the signature, in order to allow the payee and the following receivers of these tokens to verify the commitment **[expand]**;
* Optional meta-script-related meta-data;

This proof is simmetrically encrypted with the dark-tag using AES 256 together with the entire chain of proofs up to the issuance of the token and uploaded to the storage server(s) selected by the payee.

Every signature performed in the transaction **should** include a commitment to the proof produced.

In the case of a multisig address spending funds at least one of the signatures **must** include a commitment to the proof.

### Lightning Asset Transfer
[expand]
### Proofmarshal Asset Transfer
[expand]
### Basic Asset Redeeming
[expand]
### Basic Asset Re-issuance
[expand]
## Reference Implementation
[expand]
## Requirements Check
### Standardness Check
[expand]
### Auditability Check
[expand]
### Blindness/Federation Check
[expand]
### Full Decentralization Check
[expand]
## Future Evolutions
### Advanced Scripts
#### Multiple Asset Management
[expand]
#### Simplified Issuance
[expand]
#### Issuer Fees
[expand]
### DBTEE Contracts
[expand]
### BOLT-based Exchange
[expand]
### Asset-enabled Side-chains
[expand]
## Explanatory Notes
[expand]
## Open Points
* General weaknesses of blockchain-asset capabilities
* General game-theory dangers
* Other off-chain compatibilities still to test
* Dust Limit (look at Todd’s python library)
* Payment protocol for dark-tags
## Copyright
[expand: DPL/MIT]
Being the protocol UTXO-based, it will be possible to link one or more assets owned to a Lightning Network channel which becomes *colored*, exchanging state updates which are compliant to the asset scheme, with strong guarantees that asset distribution will be preserved also in case of non-consensual closures. In this way, it will be possible to leverage the scalability and privacy features of the Lightning Network, as well as LN-enabled atomic swaps for decentralized asset exchange.
97 changes: 97 additions & 0 deletions 01-contracts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# RGB Protocol Specification #01: Contracts and Proofs
* [Exemplified Process Description](#exemplified-process-description)
* [Basic Asset Issuance](#basic-asset-issuance)
* [On-chain Asset Transfer](#on-chain-asset-transfer)
* [Structure](#structure)
* [Address-Based vs UTXO-Based](#address-based-vs-utxo-based)
* [Proofs](#proofs)
* [Color Addition](#color-addition)

## Exemplified Process Description
The following Process Description assumes:

* one-2-one transfers after the issuance (many-to-many transfers are possible);
* single-asset issuance and transfers (multi-asset issuance and transfers are possible);
### Basic Asset Issuance

1. The issuer prepares the public contract for the asset issuing, with the following structure:

```c
{
"kind": 0x01 // The kind of contract we are creating, in this case a generic issuance
"version":{
// Version of this contract kind to use - https://semver.org
"major": <Integer>, // version when you make incompatible API changes
"minor": <Integer>, // version when you add functionality in a backwards-compatible manner
"patch": <Integer> // version when you make backwards-compatible bug fixes
},
"title": <String>, // Title of the asset contract
"description": <String>, // Description of possible reediming actions and non-script conditions
"issuance_utxo": <String>, // The UTXO which will be spent with a commitment to this contract,
"contract_url": <String>, // Unique url for the publication of the contract and the light-anchors
"total_supply": <Integer>, // Total supply in satoshi (1e-8)
"max_hops": <Integer>, // Maximum amount of onchain transfers that can be performed on the asset before reissuance
"min_amount": <Integer>, // Minimum amount of colored satoshis that can be transfered together

"owner_utxo": <String>, // The UTXO which will receive all the issued token. This is a contract-specific field.
}
```

2. The issuer spends the `issuance_utxo` with a commitment to this contract and publishes the contract. *`total_supply`* tokens will be created and sent to `owner_utxo`.

### On-chain Asset Transfer
1. The payee can either chose one of its UTXO or generates in his wallet a receiving address as per BIP32 standard, together with 30 bytes of entropy, which will serve as dark-tag for this transfer.
2. The payee transmits the UTXO or the address, the dark-tag and a list of storage servers he wishes to use to the payer.
3. The payer composes (eventually performing a coin-selection process from several unspent colored outputs), signs and broadcasts with his wallet a transaction with the following structure (the order of inputs and output is irrelevant):
* Inputs
* Colored Input 1: valid colored (entirely or partially) UTXO to spend
* Colored Input 2: (optional)
* Outputs
* Colored Output 1: address of the Nth receiver (if performing an *Address-Based* transaction)
* Colored Output 2: (optional) another address of the payer for the colored (up to capacity) and non-colored change

The payer also produces a new transfer proof containing:

* A list of triplets made with:
* color of the token being transacted;
* amount being transacted;
* either the hash of an UTXO in the form `SHA256(TX_HASH:OUTPUT_INDEX)` to send an *UTXO-Based* tx or the index of the output sent to the receiver to send an *Address-Based* tx;
* Signature(s) of the proof using the same pubkeys specified in the Bitcoin `scriptPubKey`;
* The parameter(s) used to create the signature, in order to allow the payee and the following receivers of these tokens to verify the commitment **[expand]**;
* Optional meta-script-related meta-data;

This proof is simmetrically encrypted with the dark-tag using AES 256 together with the entire chain of proofs up to the issuance of the token and uploaded to the storage server(s) selected by the payee.

Every signature performed in the transaction **should** include a commitment to the proof produced.

In the case of a multisig address spending funds at least one of the signatures **must** include a commitment to the proof.

## Structure

### Address-Based vs UTXO-Based

RGB allows the sender of a colored transaction to transfer the ownership of any asset in two slightly different ways:

* **Address-Based** if the receiver prefers to receive the colored UTXO itself;
* **UTXO-Based** if the receiver already owns one ore more UTXO(s) and would like to "bind" its new tokens he is about to receive to this/those UTXO(s). This allows the sender to spend the nominal Bitcoin value of the UTXO which was previously bound to the tokens however he wants (send them back to himself, make an on-chain payment, open a Lightning channel or more). The UTXO is serialized as `SHA256(TX_HASH:OUTPUT_INDEX)` in order to increase the privacy of the receiver.

### Proofs

Every RGB on-chain transaction will have a corresponding **"proof"**, where the payer encrypts, using the payee’s dark-tag, the following information in a structured way:

* the entire chain of proofs received up to the issuance contract;
* a list of triplets made with:
* color of the token being transacted
* amount being transacted
* either the hash of an UTXO in the form (TX_hash, index) to send an *UTXO-Based* transaction or an index which will bind those tokens to the corresponding output of the transaction *spending* the colored UTXO.
* an optional free field to pass over transaction meta-data that could be conditionally used by the asset contract to manipulate the transaction meaning (generally for the "meta-script" contract blueprint);
* The parameters used to create the signature, in order to allow the payee and the following receivers of these tokens to verify the commitment **[expand]**

In order to help a safe and easy management of the additional data required by this feature, the dark-tag can be derived from the BIP32 derivation key that the payee is using to generate the receiving address.

**[note on safety of mixing Bitcoin and RGB addresses]**

This feature should enhance the anonymity set of asset users, making chain analysis techniques almost as difficult as ones on “plain bitcoin” transactions. The leakage of a specific transaction dark-tag gives away the path from the issuing to the transaction itself, and of the “sibling” transactions, but it preserves uncertainty about other branches.

### Color Addition
[expand]
20 changes: 20 additions & 0 deletions 02-wallet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# RGB Protocol Specification #02: Wallet Integration

* [Reference Implementation](#reference-implementation)
* [Requirements Check](#requirements-check)
* [Standardness check](#standardness-check)
* [Auditability check](#auditability-check)
* [Blindness/Federation check](#blindnessfederation-check)
* [Full Decentralization check](#full-decentralization-check)

## Reference Implementation
[expand]
## Requirements Check
### Standardness Check
[expand]
### Auditability Check
[expand]
### Blindness/Federation Check
[expand]
### Full Decentralization Check
[expand]
3 changes: 3 additions & 0 deletions 03-networking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# RGB Protocol Specification #03: Networking

[expand]
3 changes: 3 additions & 0 deletions 04-lightning-network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# RGB Protocol Specification #04: Lightning Network Integration

[expand]
3 changes: 3 additions & 0 deletions 05-proofmarshal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# RGB Protocol Specification #05: Proofmarshal

[expand]
35 changes: 35 additions & 0 deletions 06-future-evolution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# RGB Protocol Specification #06: Future Evolution

* [Future Evolutions](#future-evolutions)
* [Advanced Scripts](#advanced-scripts)
* [Multiple Asset Management](#multiple-asset-management)
* [Simplified Issuance](#simplified-issuance)
* [Issuer Fees](#issuer-fees)
* [DBTEE Contracts](#dbtee-contracts)
* [BOLT-based Exchange](#bolt-based-exchange)
* [Asset-enabled Side-chains](#asset-enabled-side-chains)
* [Explanatory Notes](#explanatory-notes)
* [Open Points](#open-points)

## Future Evolutions
### Advanced Scripts
#### Multiple Asset Management
[expand]
#### Simplified Issuance
[expand]
#### Issuer Fees
[expand]
### DBTEE Contracts
[expand]
### BOLT-based Exchange
[expand]
### Asset-enabled Side-chains
[expand]
## Explanatory Notes
[expand]
## Open Points
* General weaknesses of blockchain-asset capabilities
* General game-theory dangers
* Other off-chain compatibilities still to test
* Dust Limit (look at Todd’s python library)
* Payment protocol for dark-tags

0 comments on commit 7ba5e85

Please sign in to comment.