Update docs/liquid/liquid-part2.md
This commit is contained in:
parent
7ad5ec191a
commit
1b4a14f0d3
@ -10,21 +10,21 @@ This is a multipart DeepDive that will focus on the Liquid Sidechain. It will be
|
|||||||
|
|
||||||
In Part I, we successfully Pegged-In our BTC and received L-BTC, now lets use that L-BTC to do some interesting things with Asset Issuance:
|
In Part I, we successfully Pegged-In our BTC and received L-BTC, now lets use that L-BTC to do some interesting things with Asset Issuance:
|
||||||
|
|
||||||
Before we jump straight into creating an asset, let us first look at the assets we already have inside our pegged-in wallet[^1]:
|
Before we jump straight into creating an asset, let us first look at our wallet[^1]:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS getwalletinfo
|
$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS getwalletinfo
|
||||||
|
|
||||||
"balance": {"bitcoin": 0.00149155}`
|
"balance": {"bitcoin": 0.00149155}
|
||||||
|
|
||||||
$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS dumpassetlabels`
|
$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS dumpassetlabels
|
||||||
|
|
||||||
{"bitcoin": "6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d"}
|
{"bitcoin": "6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d"}
|
||||||
```
|
```
|
||||||
|
|
||||||
So our wallet already has an asset called 'bitcoin' and there is an associated UUID of `6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d`. Everything in Liquid is an 'Asset' (including L-BTC) and each of these Assets can have different features.
|
So our wallet already has an asset called 'bitcoin' and there is an associated UUID of `6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d`. Everything in Liquid is an 'Asset' (including L-BTC) and each of these Assets can have different features.
|
||||||
|
|
||||||
Looking up this value on [https://blockstream.info/liquid/assets](https://blockstream.info/liquid/asset/6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d) we can see some info about it:
|
Looking up this asset label on [https://blockstream.info/liquid/assets](https://blockstream.info/liquid/asset/6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d) we can see some info about it:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -32,7 +32,7 @@ This shows us the total amount of L-BTC in circulation, additionally we can see
|
|||||||
|
|
||||||
### Issuing our own Asset
|
### Issuing our own Asset
|
||||||
|
|
||||||
Issuing assets is pretty straight forward
|
Let's issue our own asset, luckily this is pretty straight forward:
|
||||||
```
|
```
|
||||||
$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS issueasset 10 0 true
|
$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS issueasset 10 0 true
|
||||||
|
|
||||||
@ -58,18 +58,18 @@ $ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
* So publicly we know the following about our new asset:
|
* So publicly we know the following:
|
||||||
- It cannot be re-issued (fixed supply token)
|
- It cannot be re-issued (fixed supply token)
|
||||||
- It has only been issued once
|
- It has only been issued once
|
||||||
- However both the *issued amount and the circulating supply* has been hidden from us.
|
- However both the *issued amount and the circulating supply* has been hidden from us.
|
||||||
|
|
||||||
It's nice to have hidden assets, but practically speaking they might not be useful in lots of situations. For instance, suppose that we wanted users to be able to verify the circulating amounts (i.e. to prevent debasement).
|
It's nice to have hidden assets, but practically speaking they might not be useful in many situations. For instance, suppose that we wanted users to be able to verify the circulating amounts (i.e. to prevent debasement).
|
||||||
|
|
||||||
It is possible to 'unblind' this information to clients, but that would involve distributing an unblinding key to each client. Luckily there is a simple solution: we can simply issue the asset as unblinded - which will permit this information to be publicly available *without* affecting the security of the actual transactions:
|
It is possible to 'unblind' this information to clients, but that would involve distributing an unblinding key to each client. Luckily there is a simple solution: we can issue the asset as unblinded - which will permit this information to be publicly available *without* affecting the security of the actual transactions:
|
||||||
|
|
||||||
### Issuing a Non-Confidential Asset
|
### Issuing a Non-Confidential Asset
|
||||||
|
|
||||||
* Let's create another address[^5] and another asset and this time choose a different option (specifically, lets create this asset unblinded by setting the last value to **false**. This option controls blinded / unblinded behavior):
|
* Let's create another asset and this time choose a different option (specifically, lets create this asset unblinded by setting the last value to **false**. This option controls blinded / unblinded behavior):
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS issueasset 10 0 false
|
$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS issueasset 10 0 false
|
||||||
@ -92,7 +92,7 @@ $ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER
|
|||||||
* Let's try sending 2 of these unblinded assets to another wallet (my Blockstream Green mobile wallet) and see what is visible on the network.
|
* Let's try sending 2 of these unblinded assets to another wallet (my Blockstream Green mobile wallet) and see what is visible on the network.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo ./scripts/app compose elements exec node elements-cli -named -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS sendtoaddress address="VJLKDWB..." amount=2.0 assetlabel="41c19a..."`
|
$ sudo ./scripts/app compose elements exec node elements-cli -named -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS sendtoaddress address="VJLKDWB..." amount=2.0 assetlabel="41c19a..."
|
||||||
b1d0592319fc5a6ed4e2ea912ddbc9e630e0a13a083a178f69054129ef589d25
|
b1d0592319fc5a6ed4e2ea912ddbc9e630e0a13a083a178f69054129ef589d25
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -100,7 +100,9 @@ b1d0592319fc5a6ed4e2ea912ddbc9e630e0a13a083a178f69054129ef589d25
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
This is interesting: So although the transaction is visible, we can't see what was actually transferred (even though the details of the asset are visible, *it is still hidden inside the transaction*). Further, where is my Green Wallet address (ie. VJLKDWB...)? We can see 3 output addresses, presumably these are: Change, Fee, and Recipient...but where the actual Green Wallet address?
|
This is interesting: So although the transaction is visible, we can't see what was actually transferred (even though the details of the asset are visible, *it is still hidden inside the transaction*).
|
||||||
|
|
||||||
|
Further, where is my Green Wallet address (ie. VJLKDWB...)? We can see 3 output addresses, presumably these are: Change, Fee, and Recipient...but where the actual Green Wallet address?
|
||||||
|
|
||||||
* Let's look up my [Green Wallet address directly in the explorer](https://blockstream.info/liquid/address/VJLKDWB6zezPptnxQu3zAJbNBFqSKER6VWjnnDaVQxsUivQB974qRZWzW9yDa9ziokVquRkuiL6muC1c):
|
* Let's look up my [Green Wallet address directly in the explorer](https://blockstream.info/liquid/address/VJLKDWB6zezPptnxQu3zAJbNBFqSKER6VWjnnDaVQxsUivQB974qRZWzW9yDa9ziokVquRkuiL6muC1c):
|
||||||
|
|
||||||
@ -112,7 +114,7 @@ Now, lets look at how things look on the Green mobile wallet:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
We can see that we've received 200,000,000 'sats' of our custom asset. However, notice how there is no label. Whereas, for L-BTC and Tether it shows complete with name and ticker symbol. Showing just the contract address is not very user friendly. Let's see if we can remedy.
|
We can see that we've received 200,000,000 'units' of our custom asset. However, notice how there is no label. Whereas, for L-BTC and Tether it shows complete with name and ticker symbol. Showing just the asset UUID is not very user friendly. Let's see if we can remedy.
|
||||||
|
|
||||||
# Registering our Asset
|
# Registering our Asset
|
||||||
|
|
||||||
@ -130,7 +132,7 @@ Thats a lot of steps, and many are prone to error. Luckily for us there exist a
|
|||||||
Save that file as `issue_and_prepare_register.sh` and open with text editor to customize the following values.
|
Save that file as `issue_and_prepare_register.sh` and open with text editor to customize the following values.
|
||||||
|
|
||||||
```
|
```
|
||||||
#NOTE: SET YOUR OWN VALUES HERE, THESE ARE WHAT I USED
|
#NOTE: SET YOUR OWN VALUES HERE, THESE ARE WHAT I USED AS A DEMO
|
||||||
|
|
||||||
NAME="StackerNewsDemo-1"
|
NAME="StackerNewsDemo-1"
|
||||||
TICKER="SND-1"
|
TICKER="SND-1"
|
||||||
@ -144,11 +146,11 @@ alias e1-cli="sudo ./scripts/app compose elements exec node elements-cli -rpcuse
|
|||||||
|
|
||||||
With these values set, you can run the script. This script will output 3 files:
|
With these values set, you can run the script. This script will output 3 files:
|
||||||
|
|
||||||
* liquid-asset-proof-ASSET (put this file in .well-known location of domain you set)
|
* liquid-asset-proof-<ASSET> (put this file in .well-known location of domain you set)
|
||||||
* register_asset_ASSET.sh (Bash curl script to submit via Blockstream API)
|
* register_asset_<ASSET>.sh (Bash curl script to submit via Blockstream API)
|
||||||
* delete_asset_ASSET.sh (Bash curl script to delete asset from registry)
|
* delete_asset_<ASSET>.sh (Bash curl script to delete asset from registry)
|
||||||
|
|
||||||
Take the `liquid-asset-proof-ASSET` file and place it in `.well-known` folder in root of domain (or sub-domain in this case). **Verify that you can actually reach it before proceeding to the next step**.
|
Take the `liquid-asset-proof-<ASSET>` file and place it in `.well-known` folder in root of domain (or sub-domain in this case). For instance, this will be placed in `https://coins.b0xxy.net/.well-known/liquid-asset-proof-3e62af3c80c56ab6fec3d1e5646637152afebaf2a86ace075bbb7a88702e1fe5` in this case. **Verify that you can actually reach it before proceeding to the next step**.
|
||||||
|
|
||||||
Then you can run the `register_asset_ASSET.sh` script and you should get a json response back indicating success.
|
Then you can run the `register_asset_ASSET.sh` script and you should get a json response back indicating success.
|
||||||
|
|
||||||
@ -177,7 +179,7 @@ Now it shows up in a much more user-friendly format. The only thing missing is a
|
|||||||
|
|
||||||
# Wrap-up and Next Session
|
# Wrap-up and Next Session
|
||||||
|
|
||||||
In this session we issued assets and looked at their basic features. In the next part in the series, we will delve into even more advanced aspects of Liquid like: Swaps, Contracts, etc. Then finally we will peg-out and return our Bitcoin to mainchain.
|
In this session we issued assets and looked at their basic features. In the next part in the series, we will delve into even more advanced aspects of Liquid like: Swaps, Contracts, etc.
|
||||||
|
|
||||||
|
|
||||||
[^1]: The values E_RPCUSER and E_RPCPASS, where environmental variables we set in Part I
|
[^1]: The values E_RPCUSER and E_RPCPASS, where environmental variables we set in Part I
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user