Renaming in scripts, image filename and other

pull/623/head
Andreas M. Antonopoulos 3 years ago
parent 1e94af5b81
commit 40835e9d7b

@ -3,14 +3,14 @@
echo Getting node IDs
alice_address=$(docker-compose exec -T Alice bash -c "lncli -n regtest getinfo | jq -r .identity_pubkey")
bob_address=$(docker-compose exec -T Bob bash -c "lightning-cli getinfo | jq -r .id")
wei_address=$(docker-compose exec -T Wei bash -c "eclair-cli -s -j -p eclair getinfo| jq -r .nodeId")
gloria_address=$(docker-compose exec -T Gloria bash -c "lncli -n regtest getinfo | jq -r .identity_pubkey")
chan_address=$(docker-compose exec -T Chan bash -c "eclair-cli -s -j -p eclair getinfo| jq -r .nodeId")
dina_address=$(docker-compose exec -T Dina bash -c "lncli -n regtest getinfo | jq -r .identity_pubkey")
# Let's tell everyone what we found!
echo Alice: ${alice_address}
echo Bob: ${bob_address}
echo Wei: ${wei_address}
echo Gloria: ${gloria_address}
echo Chan: ${chan_address}
echo Dina: ${dina_address}
echo Setting up channels...
echo Alice to Bob
@ -18,20 +18,20 @@ docker-compose exec -T Alice lncli -n regtest connect ${bob_address}@Bob
docker-compose exec -T Alice lncli -n regtest openchannel ${bob_address} 1000000
echo Bob to Chan
docker-compose exec -T Bob lightning-cli connect ${wei_address}@Chan
docker-compose exec -T Bob lightning-cli fundchannel ${wei_address} 1000000
docker-compose exec -T Bob lightning-cli connect ${chan_address}@Chan
docker-compose exec -T Bob lightning-cli fundchannel ${chan_address} 1000000
echo Chan to Dina
docker-compose exec -T Chan eclair-cli -p eclair connect --uri=${gloria_address}@Dina
docker-compose exec -T Chan eclair-cli -p eclair open --nodeId=${gloria_address} --fundingSatoshis=1000000
docker-compose exec -T Chan eclair-cli -p eclair connect --uri=${dina_address}@Dina
docker-compose exec -T Chan eclair-cli -p eclair open --nodeId=${dina_address} --fundingSatoshis=1000000
echo Get 10k sats invoice from Gloria
gloria_invoice=$(docker-compose exec -T Gloria bash -c "lncli -n regtest addinvoice 10000 | jq -r .payment_request")
echo Get 10k sats invoice from Dina
dina_invoice=$(docker-compose exec -T Dina bash -c "lncli -n regtest addinvoice 10000 | jq -r .payment_request")
echo Gloria invoice ${gloria_invoice}
echo Dina invoice ${dina_invoice}
echo Wait for channel establishment - 60 seconds for 6 blocks
sleep 60
echo Alice pays Dina 10k sats, routed around the network
docker-compose exec -T Alice lncli -n regtest payinvoice --json --inflight_updates -f ${gloria_invoice}
docker-compose exec -T Alice lncli -n regtest payinvoice --json --inflight_updates -f ${dina_invoice}

@ -1077,8 +1077,8 @@ Looking inside the script, we see the part that gets all the node IDs and stores
----
alice_address=$(docker-compose exec -T Alice bash -c "lncli -n regtest getinfo | jq .identity_pubkey")
bob_address=$(docker-compose exec -T Bob bash -c "lightning-cli getinfo | jq .id")
wei_address=$(docker-compose exec -T Chan bash -c "eclair-cli -s -j -p eclair getinfo| jq .nodeId")
gloria_address=$(docker-compose exec -T Dina bash -c "lncli -n regtest getinfo | jq .identity_pubkey")
chan_address=$(docker-compose exec -T Chan bash -c "eclair-cli -s -j -p eclair getinfo| jq .nodeId")
dina_address=$(docker-compose exec -T Dina bash -c "lncli -n regtest getinfo | jq .identity_pubkey")
----
If you have followed the first part of the chapter you will recognise these commands and be able to "decipher" their meaning. It looks quite complex, but we will walk through it step-by-step and you'll quickly get the hang of it.
@ -1106,22 +1106,22 @@ We do the same with the other nodes, setting up connections and channels. Each n
To Bob's node (c-lightning) we send these commands:
[source,bash]
----
docker-compose exec -T Bob lightning-cli connect ${wei_address//\"}@Chan
docker-compose exec -T Bob lightning-cli fundchannel ${wei_address//\"} 1000000
docker-compose exec -T Bob lightning-cli connect ${chan_address//\"}@Chan
docker-compose exec -T Bob lightning-cli fundchannel ${chan_address//\"} 1000000
----
To Chan's node (Eclair) we send:
[source,bash]
----
docker-compose exec -T Chan eclair-cli -p eclair connect --uri=${gloria_address//\"}@Dina
docker-compose exec -T Chan eclair-cli -p eclair open --nodeId=${gloria_address//\"} --fundingSatoshis=1000000
docker-compose exec -T Chan eclair-cli -p eclair connect --uri=${dina_address//\"}@Dina
docker-compose exec -T Chan eclair-cli -p eclair open --nodeId=${dina_address//\"} --fundingSatoshis=1000000
----
At this point we create a new invoice for 10,000 satoshis on Dina's node:
[source,bash]
----
gloria_invoice=$(docker-compose exec -T Dina lncli -n regtest addinvoice 10000 | jq .payment_request)
dina_invoice=$(docker-compose exec -T Dina lncli -n regtest addinvoice 10000 | jq .payment_request)
----
The +addinvoice+ command creates an invoice for the specified amount in satoshis and produces a JSON object with the invoice details. From that JSON object we only need the actual bech32-encoded payment request, which we extract with +jq+.
@ -1132,7 +1132,7 @@ The final command is the actual invoice payment. We connect to Alice's node and
[source,bash]
----
docker-compose exec -T Alice lncli -n regtest payinvoice --json --inflight_updates -f ${gloria_invoice//\"}
docker-compose exec -T Alice lncli -n regtest payinvoice --json --inflight_updates -f ${dina_invoice//\"}
----
We ask Alice's node to pay the invoice, but also ask for +inflight_updates+ in +json+ format. That will give us detailed output about the invoice, the route, the HTLCs, and the final payment result. We can study this additional output and learn from it!

@ -382,7 +382,7 @@ You can see this in the following graph.
image:images/rebalancing-2.png[]
you can see that after Bob made a payment of 1 million satoshi to Chan the channel balance was shifted.
Bob now has 1.5 million satoshi on the channel and wei has 3.5 million satoshi on the channel.
Bob now has 1.5 million satoshi on the channel and chan has 3.5 million satoshi on the channel.
The balance ratio went from 50/50 to 30/70.
The other 2 channels however styed with 50/50.

@ -25,9 +25,9 @@ The innovation of routed payment channels allows Dina to receive tips without ma
As long as there exists a path of well-funded channels from that viewer to Glori, she will be able to receive payment from that fan.
The nodes along the path from the fan to Dina are intermediaries and called "routing nodes" in the context of routing a payment.
[[gloria-routing-diagram]]
[[dina-routing-diagram]]
.Any one of Dina's fans in the diagram can pay her by routing via the nodes in between them and Dina
image:images/gloria-routing-diagram.PNG["Any one of Dina's fans in the diagram can pay her by routing via the nodes in between them and Dina"]
image:images/dina-routing-diagram.PNG["Any one of Dina's fans in the diagram can pay her by routing via the nodes in between them and Dina"]
Importantly, the routing nodes are unable to steal the funds while routing a payment from a fan to Dina.
Furthermore, routing nodes cannot lose money while participating in the routing process.
@ -81,7 +81,7 @@ In the physical world contracts could be used for safely carrying out a series o
Alice could negotiate a contract with Bob which reads:
[alice-gloria-routing-1]
[alice-dina-routing-1]
====
_I (Alice) will give you (Bob) 10 gold coins if you pass them on to Chan_
====
@ -92,7 +92,7 @@ Assuming these issues are magically solved, it's still unclear how to leverage s
We thus improve our contract:
[alice-gloria-routing-2]
[alice-dina-routing-2]
====
_I (Alice) will reimburse you (Bob) with 10 gold coins if you can prove to me (for example via a receipt) that you already have delivered 10 gold coins to Chan_
====
@ -106,7 +106,7 @@ Thus Bob and Chan face both risk and opportunity cost for agreeing to this contr
Alice can this make this attractive to both Bob and Chan, by offering them fees of 1 gold coin each, if they transmit her payment to Dina.
The final contract would instead read:
[alice-gloria-routing-3]
[alice-dina-routing-3]
====
_I (Alice) will reimburse you (Bob) with 12 gold coins if you can prove to me (for example via a receipt) that you already have delivered 11 golden coins to Chan_
====
@ -134,7 +134,7 @@ footnote:[You can verify this by typing `echo -n "Dinas secret" | sha256sum` to
To facilitate Alice's payment, Dina will create the secret and the payment hash and send the payment hash to Alice. Alice doesn't know the secret but she can rewrite her contract to use the hash of the secret as a proof of payment:
[alice-gloria-routing-4]
[alice-dina-routing-4]
====
_I (Alice) will reimburse you (Bob) with 12 gold coins if you can show me a valid message that hashes to:`+f23c83...+`.
You can acquire this message by setting up a similar Contract with Chan who has to set up a similar contract with Dina.
@ -151,7 +151,7 @@ Similarly, Chan will also demand a fee and will expect to receive 11 gold coins
Bob's contract with Chan will read:
[alice-gloria-routing-5]
[alice-dina-routing-5]
====
_I (Bob) will reimburse you (Chan) with 11 gold coins if you can show me a valid message that hashes to:`+f23c83...+`.
You can acquire this message by setting up a similar contract with Dina.
@ -160,7 +160,7 @@ In order to assure you that you will get reimbursed I will provide the 11 gold c
Once Chan gets the message from the escrow that Bob has deposited the 11 gold coins, Chan sets up a similar contract with Dina:
[alice-gloria-routing-6]
[alice-dina-routing-6]
====
_I (Chan) will reimburse you (Dina) with 10 golden coins if you can show me a valid message that hashes to:`+f23c83...+`.
In order to assure you that you will get reimbursed after revealing the secret I will provide the 10 gold coins to an trusted escrow._
@ -199,7 +199,7 @@ The deposit is locked with the escrow service for a certain amount of time, and
In order to factor this in, the contract between Alice and Bob is once again amended with a new clause:
[alice-gloria-routing-7]
[alice-dina-routing-7]
====
_Bob has 24 hours to show the secret after the contract was signed.
If Bob does not provide the secret by this time, Alice's deposit will be refunded by the escrow service and the contract becomes invalid._
@ -210,7 +210,7 @@ Even if he successfully pays Chan, if he receives the proof of payment later tha
In turn, Bob will alter his contract with Chan in the following way:
[alice-gloria-routing-8]
[alice-dina-routing-8]
====
_Chan has 22 hours to show the secret after the contract was signed.
If he does not provide the secret by this time, Bob's deposit will be refunded by the escrow service and the contract becomes invalid._
@ -218,7 +218,7 @@ If he does not provide the secret by this time, Bob's deposit will be refunded b
As you might have guessed, Chan is now incentivized to also alter his contract with Dina:
[alice-gloria-routing-9]
[alice-dina-routing-9]
====
_Dina has 20 hours to show the secret after the contract was signed.
If he does not provide the secret by this time, Bob's deposit will be refunded by the escrow service and the contract becomes invalid._

Loading…
Cancel
Save