The process is the same for unidirectional payment channels except only one party deposits funds into the multi-signature output. A payrequest is a serialized invoice that has the amount owed encoded into it. Payrequests are strictly one time use and cannot be recycled. Since payrequests contain a payment hash, after an invoice is paid out the hash preimage becomes public. Multiple uses of a payrequest could lead to an attacker saving the preimages and reusing them for a future payment using the same payrequest.

Multi-hop Payments

Traditional payment channels are single-hop payments because they are made directly from one node to another through a direct channel. Multi-hop payments, on the other hand, are payments made from one party to another through an implicit channel. For example, let’s say Alice, Bob, Carol and Dave are participants on the Lightning Network and Alice has a channel with Bob, Bob has a channel with Carol and Carol has a channel with Dave (Alice -> Bob -> Carol -> Dave) . Alice wants to pay Dave 1BTC, but Alice does not have a direct channel with Dave. Luckily for Dave, Alice has a payment channel with Bob who has a payment channel with Carol who has one with Dave. By using this implicit payment channel, Alice can pay Dave via Bob and Carol.

Dave wants to get paid by Alice, so he generates a random secret x. From the preimage x Dave generates the hash h(x) and sends it over to Alice.

Then, Alice creates a Hashed TimeLock Contract (HTLC) with Bob for the amount of 1BTC and with an expiry so that if the funds are never claimed they don’t stay locked inside the contract.¹

Following Alice, Bob does the same thing with Carol, making a HTLC for 1BTC, and Carol does the same thing with Dave. The only difference between the HTLCs is that each successive one must have a shorter expiry time (timelock).²

Dave has the preimage for the for the HTLC that was created between him and Carol so he can redeem the 1BTC contained within the contract. As soon as Dave does this the preimage becomes public and Carol and Bob can do the same thing and each redeem 1BTC as well. Finally, Alice is left with 1BTC less than before the transaction and Dave is left with 1BTC more.