Update docs/liquid/liquid-part2.md

This commit is contained in:
b0xxer 2024-01-27 09:36:34 -06:00
parent 6e7e597fd5
commit 34436f2aaf

View File

@ -39,15 +39,14 @@ Issuing assets is pretty straight forward, it can be roughly broken down into 3
3. Issue the Asset 3. Issue the Asset
* STEP 1: Let's generate our legacy address and set the output to a variable and get its public key * 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)`
lq1qq03fq9jz20qnfqw4utjhdh3feasg3rtzf7l2qd9snrkctjm8g4ey4wvu225kq79wqclq9qg7ak8ycnhuekwuw9r38t94qr60a
`$ export NEWADD='lq1qq03fq9j....'` ```
$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS getnewaddress "" legacy)
- `$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS getaddressinfo $NEWADD | jq '.pubkey'` lq1qq03fq9jz20qnfqw4utjhdh3feasg3rtzf7l2qd9snrkctjm8g4ey4wvu225kq79wqclq9qg7ak8ycnhuekwuw9r38t94qr60a
$ export NEWADD='lq1qq03fq9j....'
02fc3b404d9785d2dc26ea1867e25cf047702e45d29559a4657fafe8c0dd53877e $ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS getaddressinfo $NEWADD | jq '.pubkey'
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 * 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
@ -86,12 +85,12 @@ echo CONTRACT_HASH=$CONTRACT_HASH
* Now we can use the script we saved before to generate the contract: * Now we can use the script we saved before to generate the contract:
- `$ ./gen_asset_contract.sh 02fc3b404d9785d2dc26ea1867e25cf047702e45d29559a4657fafe8c0dd53877e` ```
$ ./gen_asset_contract.sh 02fc3b404d9785d2dc26ea1867e25cf047702e45d29559a4657fafe8c0dd53877e
CONTRACT={"entity":{"domain":"coins.b0xxy.net"},"issuer_pubkey":"02fc3b404d9785d2dc26ea1867e25cf047702e45d29559a4657fafe8c0dd53877e","name":"StackerNewsDemo-1","precision":8,"ticker":"SND-1","version":0}
CONTRACT_HASH=a742ef224aedad0b26902822abd05f163ab965a1f5195d06ca8429b6d2a9ffdc
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: * Finally export those variables via bash to use later:
@ -102,7 +101,9 @@ export CONTRACT_HASH=a742ef224aedad0b26902822abd05f163ab965a1f5195d06ca8429b6d2a
``` ```
* 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) * 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`
```
$ sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS issueasset 10 0 true $CONTRACT_HASH
{ {
"txid": "8a12dd64c43de200cc7addb6c59f67bdbc6481ef1cc8b24253c7c1daba3c4e06", "txid": "8a12dd64c43de200cc7addb6c59f67bdbc6481ef1cc8b24253c7c1daba3c4e06",
@ -111,15 +112,17 @@ export CONTRACT_HASH=a742ef224aedad0b26902822abd05f163ab965a1f5195d06ca8429b6d2a
"asset": "8aa889f0bd16bab7d236ab6f3583481382bf976433360ff240cf22b79181a50f", "asset": "8aa889f0bd16bab7d236ab6f3583481382bf976433360ff240cf22b79181a50f",
"token": "2eb4da7c84a7b4db2944ead6b05041a5d8d8f4a73cd1413b140b44c4ec42fbdf" "token": "2eb4da7c84a7b4db2944ead6b05041a5d8d8f4a73cd1413b140b44c4ec42fbdf"
} }
u ```
### Exploring our new Asset ### Exploring our new Asset
* Checking out our wallet we see: * Checking out our wallet we see:
- `$ 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": {"8aa889f0bd16bab7d236ab6f3583481382bf976433360ff240cf22b79181a50f": 10.00000000, "balance": {"8aa889f0bd16bab7d236ab6f3583481382bf976433360ff240cf22b79181a50f": 10.00000000,
"bitcoin": 0.00140447,} "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/8aa889f0bd16bab7d236ab6f3583481382bf976433360ff240cf22b79181a50f): * 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):