Update docs/liquid/liquid-part2.md

This commit is contained in:
b0xxer 2024-01-28 09:17:55 -06:00
parent 9b591e590f
commit ac9bd667e1

View File

@ -122,44 +122,35 @@ The publication of asset metadata info on Liquid works on a `.well-known` system
2. Generate a Contract and Contract Hash using the information we want to appear in the public registry. 2. Generate a Contract and Contract Hash using the information we want to appear in the public registry.
3. Create our asset with Contract Hash embedded in it 3. Create our asset with Contract Hash embedded in it
4. If we ever want to delete the asset from the registry, generate a delete script 4. If we ever want to delete the asset from the registry, generate a delete script
5. Generate a `liquid-asset-proof` json file and place in `.well-known` location on domain that matches contract 5. Generate a `liquid-asset-proof` text file and place in `.well-known` location on domain that matches contract
6. Register (or unregister) the asset via Blockstream web API 6. Register (or unregister) the asset via Blockstream web API
Thats a lot of steps, and many are prone to error. Luckily for us there exist a bash script to basically do all of it. [Download script from Blockstream](https://docs.liquid.net/docs/blockstream-liquid-asset-registry#issuing-with-a-contract-hash) Thats a lot of steps, and many are prone to error. Luckily for us there exist a bash script to basically do all of it. [Download script from Blockstream](https://docs.liquid.net/docs/blockstream-liquid-asset-registry#issuing-with-a-contract-hash)
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.
Running the above will result in a file named `liquid-asset-proof-41c19a...` being created, and inside that file it will say `Authorize linking the domain name coins.b0xxy.net to the Liquid asset 41c19a...`
First you need to place this `liquid-asset-proof` file in the root directory of your domain under a folder named `.well-known`
Before you proceed to the next step, please verify that they above file is reachable. Go to an external machine and issue:
`$ curl https://nulldata.org/.well-known/liquid-asset-proof-409b1d0cb614822ea703576b71958ab051d66ff6708b368f378f2ffea458d15a`
...and it should output the `Authorize linking the domain` text.
* We can validate our request before submitting to make sure everything is correct
``` ```
$ curl https://assets.blockstream.info/contract/validate -H 'Content-Type: application/json' -d '{"contract": '$CONTRACT', "contract_hash": "2b14c6c7ff4009ce6cf4dfa59099fdda4f27459d153b45fe91790e9d1bca42a0"}' NAME="StackerNewsDemo-1"
valid TICKER="SND-1"
``` DOMAIN="coins.b0xxy.net"
Since everything looks ok, we can submit: ASSET_AMOUNT=10.0
TOKEN_AMOUNT=0
``` PRECISION=8
$ curl https://assets.blockstream.info/ --data-raw '{"asset_id":"409b1d0cb614822ea703576b71958ab051d66ff6708b368f378f2ffea458d15a","contract":{"entity":{"domain":"coins.b0xxy.net"},"issuer_pubkey":"02ada219afbd424afca568e01370161d68ab3aa0697cd759a6105c23b81d20b397","name":"StackerNewsDemo-1","precision":8,"ticker":"SND-1","version":0}}' COLLECTION=""
alias e1-cli="sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS"
``` ```
With these values set, you can run the script. This script will output 3 files:
* Now we can push the data to blockstreams server, lets create a script: * liquid-asset-proof-ASSET (put this file in .well-known location of domain you set)
` $ echo "curl $ASSET_REGISTRY_URL --data-raw '{\"asset_id\":\"$ASSET\",\"contract\":$CONTRACT}'" > register-asset.sh` * register_asset_ASSET.sh (Bash curl script to submit via Blockstream API)
* delete_asset_ASSET.sh (Bash curl script to delete asset from registry)
Verify that this script looks sane, mark it as executable and run it.
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**.
Then you can run the `register_asset_ASSET.sh` script and you should get a json response back indicating success.
Having done the above,
[^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