Update docs/liquid/liquid-part2.md

This commit is contained in:
b0xxer 2024-01-27 08:51:58 -06:00
parent 6e95a0fd14
commit 098790b960

View File

@ -39,14 +39,11 @@ Issuing assets is pretty straight forward, it can be roughly broken down into 3
* STEP 1: Let's generate our legacy address and set the output to a variable and get its public key
`$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS getnewaddress "" legacy`
lq1qq2s92z0uq78kd4gfepua6qvfwx40g4lqqer9e3tzrr0j04ugyzsed39mnh9wvuhw0hmaqy5mxs9egqrr7j3rx8j2sdyun9m90
lq1qq03fq9jz20qnfqw4utjhdh3feasg3rtzf7l2qd9snrkctjm8g4ey4wvu225kq79wqclq9qg7ak8ycnhuekwuw9r38t94qr60a
- `$ export LEG_ADDRESS="lq1qq2s92....."`
- `$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS getaddressinfo $LEG_ADDRESS | jq '.pubkey'`
025aa49d444a150c99c904c8e779e5317aff4aee15ee9171f450e14af9dd8b8780
- `$ export PUBKEY="025aa49d444a150c99c904c8e779e5317aff4aee15ee9171f450e14af9dd8b8780"`
02fc3b404d9785d2dc26ea1867e25cf047702e45d29559a4657fafe8c0dd53877e
* STEP 2: In order to generate the contract hash, it requires a few steps - so I've simplified it by making a bash script. Copy this into a file named `gen_asset_contract.sh` and mark as executable
@ -60,9 +57,8 @@ shopt -s expand_aliases
###EDIT THESE VALUES###
DOMAIN="nulldata.org"
PUBKEY="032703d8249cd55935253a9ba504103a21ea71fa7268448f1bfb3edd9905c86c90"
ASSET="2250b062c55b83f26e14bd370391b52a41c0620792e2b1315c1a25e851e33385"
DOMAIN="coins.b0xxy.net"
PUBKEY="02fc3b404d9785d2dc26ea1867e25cf047702e45d29559a4657fafe8c0dd53877e"
NAME="StackerNewsDemo-1"
PRECISION=8
TICKER="SND-1"
@ -74,49 +70,48 @@ CONTRACT_HASH=$(python3 -c 'import json,sys; sys.stdout.write(json.dumps(json.lo
echo CONTRACT=$CONTRACT
echo CONTRACT_HASH=$CONTRACT_HASH
```
* Now we can use the script we saved before to generate the contract:
- `$ ./gen_asset_contract.sh $PUBKEY`
- `$ ./gen_asset_contract.sh`
CONTRACT={"entity":{"domain":"nulldata.org"},"issuer_pubkey":"025aa49d444a150c99c904c8e779e5317aff4aee15ee9171f450e14af9dd8b8780","name":"StackerNews-Demo1","precision":8,"ticker":"SND-1","version":0}
CONTRACT_HASH=967f329b873d20253852236bcb4aab8df355356c06a4f0190361dfe6e58a838b
CONTRACT={"entity":{"domain":"coins.b0xxy.net"},"issuer_pubkey":"02fc3b404d9785d2dc26ea1867e25cf047702e45d29559a4657fafe8c0dd53877e","name":"StackerNewsDemo-1","precision":8,"ticker":"SND-1","version":0}
CONTRACT_HASH=a742ef224aedad0b26902822abd05f163ab965a1f5195d06ca8429b6d2a9ffdc
* Finally export those variables via bash to use later:
```
export CONTRACT={"entity":{"domain":"nulldata.org"},"issuer_pubkey":"025aa49d444a150c99c904c8e779e5317aff4aee15ee9171f450e14af9dd8b8780","name":"StackerNews-Demo1","precision":8,"ticker":"SND-1","version":0}
export CONTRACT='{"entity":{"domain":"coins.b0xxy.net"},"issuer_pubkey":"02fc3b404d9785d2dc26ea1867e25cf047702e45d29559a4657fafe8c0dd53877e","name":"StackerNewsDemo-1","precision":8,"ticker":"SND-1","version":0}'
export CONTRACT_HASH=967f329b873d20253852236bcb4aab8df355356c06a4f0190361dfe6e58a838b
export CONTRACT_HASH=a742ef224aedad0b26902822abd05f163ab965a1f5195d06ca8429b6d2a9ffdc
```
####REDO HERE####
* STEP 3: Now Issuing our own asset is straight-forward, as its a single line command in the client. Let's issue 10 new tokens and set the supply to be fixed (no re-issuance)
- `$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS issueasset 10 0 true $CONTRACT_HASH`
{
"txid": "6ef6b04b34e27d79c0b66d817bc23a81bc6a56b289b6a45a28b71489adca0825",
"txid": "8a12dd64c43de200cc7addb6c59f67bdbc6481ef1cc8b24253c7c1daba3c4e06",
"vin": 0,
"entropy": "570671c45afd4b9bfd085e5e965333e32f3988d3b68d4baf276ff3f833f8f531",
"asset": "b142fb9ec2c7821f025f3ae806cfbec6e9faccbf876a531e8a207b45bc6a285a",
"token": "f13a9858f5acec84f8195d95c764c839812deeee297ca654ba1f25d650e1b8ea"
"entropy": "3b8ded63f872d53d93b40ea415f3473b50c033a8e9abc1f0e7418e7f16e98dec",
"asset": "8aa889f0bd16bab7d236ab6f3583481382bf976433360ff240cf22b79181a50f",
"token": "2eb4da7c84a7b4db2944ead6b05041a5d8d8f4a73cd1413b140b44c4ec42fbdf"
}
u
### Exploring our new Asset
* Checking out our wallet we see:
- `$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS getwalletinfo`
"balance": {"b142fb9ec2c7821f025f3ae806cfbec6e9faccbf876a531e8a207b45bc6a285a": 10.00000000,
"balance": {"8aa889f0bd16bab7d236ab6f3583481382bf976433360ff240cf22b79181a50f": 10.00000000,
"bitcoin": 0.00140447,}
* We can see our wallet has 10 of our assets[^2], lets checkout what the [Liquid network knows about it](https://blockstream.info/liquid/asset/b142fb9ec2c7821f025f3ae806cfbec6e9faccbf876a531e8a207b45bc6a285a):
* We can see our wallet has 10 of our assets[^2], lets checkout what the [Liquid network knows about it](https://blockstream.info/liquid/asset/8aa889f0bd16bab7d236ab6f3583481382bf976433360ff240cf22b79181a50f):
####REDO HERE####
![](2-part2-firstasset.png)