Update docs/liquid/liquid-part3.md

This commit is contained in:
b0xxer 2024-02-02 10:14:01 -06:00
parent 716e318097
commit d1a8a50367

View File

@ -25,7 +25,51 @@ Obviously, we could build some type of webservice that had SQL databases and nod
Luckily, due to the additional OPCODEs in Liquid, it supports atomic swaps between assets. In fact, Blockstream has a tool to simplify using it (obviously the steps we do here manually with the tool would be automated within the server / client in production). Luckily, due to the additional OPCODEs in Liquid, it supports atomic swaps between assets. In fact, Blockstream has a tool to simplify using it (obviously the steps we do here manually with the tool would be automated within the server / client in production).
![](2-part3-swaptool-proposal.png) Obviously to do a swap, we will need another wallet, as you can't swap between the same wallet (you can refer to individual wallets in the swap-tool URL connect string by using the `http://user:password@localhost:7041/wallet/walletname` path)
In my case, I have 2 nodes each running `elementsd` server (Umbrel and another). So I will use that, but point is this can be done one a single node by setting up mutliple wallets and using distinct URL connect strings.
Before we start, let's look at state of our 2 wallets:
```
#Node1 - StackerNews Airline, Inc.
"balance": {
"bitcoin": 0.00131755,
"3e62af3c80c56ab6fec3d1e5646637152afebaf2a86ace075bbb7a88702e1fe5": 8.00000000
}
#Node2 - The Customer
"balance": {
"bitcoin": 0.00010623,
"3e62af3c80c56ab6fec3d1e5646637152afebaf2a86ace075bbb7a88702e1fe5": 1.00000000
},
```
For our example, we can assume that StackerNews Airline (Node 1) is willing to accept a SND-1 token and return to the client 23,000 sats (approx $1 USD currently). So they make the following proposal
```
$ liquidswap-cli -u http://$E_RPCUSER:$E_RPCPASS@localhost:7041 propose -o proposal.txt 3e62af3c80c56ab6fec3d1e5646637152afebaf2a86ace075bbb7a88702e1fe5 1 6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d 0.000023
```
This file was exported to `proposal.txt` and transfered to Node2 (the customer), which was then inspected:
We can see that this proposal matches our expectation (1 SND token in exchange for .000023 L-BTC). So Node2 accepts the proposal:
Now the file `accept.txt` is transferred back to Node1 where it is finalized and sent.
```
$ liquidswap-cli -u http://$E_RPCUSER:$E_RPCPASS@localhost:7041 finalize accepted.txt -s
{
"broadcast": true,
"txid": "e427ff20ee93b5c9fef74031492357f3fcb535ec834f2035918008d3de406808"
}
```
## Securities / Transfer Restricted / etc ## Securities / Transfer Restricted / etc