Skip to content

Commit b49f8fc

Browse files
authored
Merge pull request bitcoin#354 from tomichec/node_client
Node client chapter corrections
2 parents 599998a + 6dbb07f commit b49f8fc

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

node_client.asciidoc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,10 +1043,10 @@ As you can see from the output, the script first gets the node IDs (public keys)
10431043
Looking inside the script, we see the part that gets all the node IDs and stores them in temporary variables so that they can be used in subsequent command. It looks like this:
10441044

10451045
----
1046-
alice_address=$(docker-compose exec -T Alice lncli -n regtest getinfo | jq .identity_pubkey)
1047-
bob_address=$(docker-compose exec -T Bob lightning-cli getinfo | jq .id)
1048-
wei_address=$(docker-compose exec -T Wei eclair-cli -s -j -p eclair getinfo| jq .nodeId)
1049-
gloria_address=$(docker-compose exec -T Gloria lncli -n regtest getinfo | jq .identity_pubkey)
1046+
alice_address=$(docker-compose exec -T Alice bash -c "lncli -n regtest getinfo | jq .identity_pubkey")
1047+
bob_address=$(docker-compose exec -T Bob bash -c "lightning-cli getinfo | jq .id")
1048+
wei_address=$(docker-compose exec -T Wei bash -c "eclair-cli -s -j -p eclair getinfo| jq .nodeId")
1049+
gloria_address=$(docker-compose exec -T Gloria bash -c "lncli -n regtest getinfo | jq .identity_pubkey")
10501050
----
10511051

10521052
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.
@@ -1058,8 +1058,8 @@ The following three lines do the same for each of the other nodes. Because they
10581058
Next, we tell each node to establish a network connection to the next node and open a channel:
10591059

10601060
----
1061-
docker-compose exec -T Alice lncli -n regtest connect ${bob_address}@Bob
1062-
docker-compose exec -T Alice lncli -n regtest openchannel ${bob_address} 1000000
1061+
docker-compose exec -T Alice lncli -n regtest connect ${bob_address//\"}@Bob
1062+
docker-compose exec -T Alice lncli -n regtest openchannel ${bob_address//\"} 1000000
10631063
----
10641064

10651065
Both of the commands are directed to the +Alice+ container since the channel will be opened _from_ +Alice+ _to_ +Bob+, and +Alice+ will initiate the connection.
@@ -1072,20 +1072,20 @@ We do the same with the other nodes, setting up connections and channels. Each n
10721072

10731073
To Bob's node (c-lightning), we send the command:
10741074
----
1075-
lightning-cli connect ${wei_address}@Wei
1076-
lightning-cli fundchannel ${wei_address} 1000000
1075+
docker-compose exec -T Bob lightning-cli connect ${wei_address//\"}@Wei
1076+
docker-compose exec -T Bob lightning-cli fundchannel ${wei_address//\"} 1000000
10771077
----
10781078

10791079
To Wei's node (Eclair), we send:
10801080
----
1081-
eclair-cli -p eclair connect --uri=${gloria_address}@Gloria
1082-
eclair-cli -p eclair open --nodeId=${gloria_address} --fundingSatoshis=1000000
1081+
docker-compose exec -T Wei eclair-cli -p eclair connect --uri=${gloria_address//\"}@Gloria
1082+
docker-compose exec -T Wei eclair-cli -p eclair open --nodeId=${gloria_address//\"} --fundingSatoshis=1000000
10831083
----
10841084

10851085
Now, on Gloria's node, we create a new invoice, for 10,000 satoshi:
10861086

10871087
----
1088-
lncli -n regtest addinvoice 10000 | jq .payment_request
1088+
gloria_invoice=$(docker-compose exec -T Gloria lncli -n regtest addinvoice 10000 | jq .payment_request)
10891089
----
10901090

10911091
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, and we use +jq+ to extract it.
@@ -1095,7 +1095,7 @@ Next, we have to wait. We just created a bunch of channels, which means that our
10951095
The final command is the actual payment. We connect to Alice's node and present Gloria's invoice for payment.
10961096

10971097
----
1098-
lncli -n regtest payinvoice --json --inflight_updates -f ${gloria_invoice}
1098+
docker-compose exec -T Alice lncli -n regtest payinvoice --json --inflight_updates -f ${gloria_invoice//\"}
10991099
----
11001100

11011101
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, so we can study and learn!

0 commit comments

Comments
 (0)