Description |
---|
Tutorial on output coins in the Incognito network. |
The most important aspect of a blockchain is transactions. Everything else in is intended to ensure that transactions can be created, broadcast to the network, validated, and finally added to the global transaction ledger (the blockchain). In most cases, a transaction refers to previous transaction outputs as new transaction inputs and converts all input values to new outputs. In this tutorial, we will look at UTXOs, which are the basic building blocks of an Incognito transaction.
A UTXO can have an arbitrary value denominated as a multiple of nano-token (10^-9). Just like dollars can be divided down to two decimal places as cents, a UTXO inside the Incognito network can be divided down to night decimal places. An Incognito transaction can combine upto 32 inputs and create at most 32 outputs.
As we have upgraded the Privacy layer to the version 2, the Incognito network is now accepting two versions of output coins. However, the acceptance of output coins of version 1 will soon be suspended.
Next, we'll walk through the two versions of output coins within the Incognito network.
A CoinV1 is used as an input, or an output coin of a transaction v1, or it can be used as an input of a conversion transaction. It can be expressed as follows.
type CoinV1 struct {
publicKey *crypto.Point
commitment *crypto.Point
snDerivator *crypto.Scalar
serialNumber *crypto.Point
randomness *crypto.Scalar
value uint64
info []byte
CoinDetailsEncrypted *hybridencryption.HybridCipherText
}
Here is a quick explanation of these fields.
Name | Description |
---|---|
Version | The version of the coin. |
PublicKey | The public key of the coin. This value is the same as the public key of its owner. |
Commitment | The coin commitment. The commitment of a CoinV1 commits to its public key, its amount, the shardID it belongs to, its SNDerivator. |
SNDerivator | The coin serial number derivator used to calculate the serial number. |
KeyImage | The key image of the input coin, for checking double-spending (a.k.a serial number). |
Randomness | The blinding factor in the commitment. |
Value | The input coin amount. |
Info | Memo of the input coin. |
CoinDetailsEncrypted | The encrypted content of coins, used in privacy transaction. When used as an output of a transaction V1, this field contains the hybrid-encrypted information only known to the sender and the receiver. |
A CoinV2 is used as an input, or an output coin of a transaction v2. It includes the following fields.
type CoinV2 struct {
version uint8
info []byte
publicKey *crypto.Point
commitment *crypto.Point
keyImage *crypto.Point
sharedConcealRandom *crypto.Scalar
sharedRandom *crypto.Scalar
txRandom *TxRandom
mask *crypto.Scalar
amount *crypto.Scalar
assetTag *crypto.Point
}
A CoinV2 shares a lot of common fields with a CoinV1. We will only explain some of the prominent differences.
- PublicKey. Unlike a CoinV1, the public key of a CoinV2 is unique thanks to the use of one-time addresses. That is, two different CoinV2 of a user have different public keys.
- AssetTag. In Privacy V2, we employ a so-called confidential assets to hide the actual token being transferred.
- SharedRandom, SharedConcealRandom. Two private values generated by the sender to ensure anonymity and confidentiality of transactions.
- TxRandom. This value consists of the shared randomness factors only known to the sender and the receiver to ensure asset confidentiality, sender and receiver anonymity.
- Mask. This is the same as the Randomness field in a CoinV1.
- Commitment. The commitment of a CoinV2 only commits to its value.
There is a special type of transactions which helps convert a CoinV1 into a CoinV2, called ConversionTransaction. Please see this tutorial for more detail. In the next tutorial, we will learn how to retrieve our output coins from the network.
Return to the table of contents.