From 4d64a3781824de79599f1c3ca865cb78db7a2c30 Mon Sep 17 00:00:00 2001 From: b0xxer Date: Sat, 27 Jan 2024 03:40:19 -0600 Subject: [PATCH] Update docs/liquid/liquid-part2.md --- docs/liquid/liquid-part2.md | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/docs/liquid/liquid-part2.md b/docs/liquid/liquid-part2.md index e49aa3e..678ec1c 100644 --- a/docs/liquid/liquid-part2.md +++ b/docs/liquid/liquid-part2.md @@ -35,8 +35,8 @@ Issuing assets is pretty straight forward, it can be roughly broken down into 3 2. Generate a Contract Hash using that PUBKEY 3. Issue the Asset -* STEP 1: Let's generate our legacy address and set the output to a variable - `$ LEG_ADDRESS=$(sudo ./scripts/app compose elements exec node elements-cli -rpcuser=$E_RPCUSER -rpcpassword=$E_RPCPASS getnewaddress "" legacy`) +* 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 @@ -72,23 +72,14 @@ DOMAIN="nulldata.org" NAME="StackerNews-Demo1" PRECISION=8 TICKER="SND-1" -CONTRACT='{"entity":{"domain":"'$DOMAIN'"},"issuer_pubkey":"'$PUBKEY'","name":"'$NAME'","precision":'$PRECISION',"ticker":"'$TICKER'","version":'0'}' -CONTRACT_HASH=$(echo -n "${CONTRACT}" | sha256sum | sed 's/ .*//g') - -#Generate a byte-aligned reveresed CONTRACT_HASH for use in asset Creation -TEMP=$CONTRACT_HASH -LEN=${#TEMP} -until [ $LEN -eq "0" ]; do - END=${TEMP:(-2)} - CONTRACT_HASH_REV="$CONTRACT_HASH_REV$END" - TEMP=${TEMP::$((${#TEMP} - 2))} - LEN=$((LEN-2)) -done ### END EDITING HERE ### +CONTRACT='{"entity":{"domain":"'$DOMAIN'"},"issuer_pubkey":"'$PUBKEY'","name":"'$NAME'","precision":'$PRECISION',"ticker":"'$TICKER'","version":'0'}' + +CONTRACT_HASH=$(python -c 'import json,sys; sys.stdout.write(json.dumps(json.loads(sys.argv[1]), sort_keys=True, separators=(",",":")))' "$CONTRACT" | sha256sum | head -c64 | fold -w2 | tac | tr -d "\\n") + echo CONTRACT=$CONTRACT echo CONTRACT_HASH=$CONTRACT_HASH -echo CONTRACT_HASH_REV=$CONTRACT_HASH_REV ``` * Now we can use the script we saved before to generate the contract: @@ -143,7 +134,7 @@ export CONTRACT_HASH_REV=967f329b873d20253852236bcb4aab8df355356c06a4f0190361dfe - It has only been issued once - However both the issued amount and the circulating supply has been hidden from us. -This Confidential Asset has ultimate privacy, we can't really see anything about it. But sometimes its useful to have assets where people can verify the total amount in circulation, so lets do that: +This Confidential Asset has ultimate privacy, we can't really see anything about it. It Is possible to export information to specific clients so that they can see this info, however in most cases its preferred that this information is publicly available. For instance, if we wanted th public to know the total issuance of an asset without needing any special information, so lets do that: ### Issuing a Non-Confidential Asset