Page 68 - ITU Journal Future and evolving technologies Volume 2 (2021), Issue 5 – Internet of Everything
P. 68
ITU Journal on Future and Evolving Technologies, Volume 2 (2021), Issue 5
Multisignature Multisignature
Address: 5 Address: 5
On-Chain
Alice: 5 Alice: 1
Transactions
Alice: 5 Bob: 4
Open a Channel Close a Channel
Alice: 4 Alice: 2 Alice: 1
Off-Chain
Transactions 1 2 1
Bob: 1 Bob: 3 Bob: 4
Fig. 2 – A depiction of the on‑chain channel opening and closing transactions and off‑chain payments in LN.
Transaction HTLCs: Hash Time Locked Contracts (HTLCs) are a core
o chan- part of LN and they enable sending conditional payments.
nel will change. In Fig. 2, Alice sends 3 different pay‑ As the name suggests, an HTLC payment is hash and time
ments to Bob with amounts 1 Bitcoin, 2 Bitcoins, 1 Bitcoin locked. This means that the recipient of the payment has
respectively. Since these transactions are not on‑chain to redeem it within a certain period of time by revealing
(i.e. not mined by miners thus not included in the blocks), a secret otherwise the payment is returned to the sender.
there has to be a different mechanism to keep track of When Alice initiates a payment of 1 Bitcoin to Bob, she
each parties’ balances in the channel. This is done by creates a new commitment transaction and adds an addi‑
the commitment transactions. A commitment transaction tional output to it called the HTLC output (Output 3 in Fig.
is a type of Bitcoin transaction ically designed for 3). The steps taken in this process are as follows: Alice
LN. A payment channel consists of states, changing with asks Bob to generate a secret called preimage. Bob takes
each payment. In each state, parties have different bal‑ a hash of the preimage and sends the hash to Alice. Al‑
ances which are recorded onto their commitment trans‑ ice creates an HTLC using this hash and sends the HTLC
actions. We illustrated Alice’s commitment transaction in to Bob. Receiving the HTLC, Bob reveals the preimage to
Fig. 3 after she initiates a payment of 1 Bitcoin to Bob. Alice to prove that he was the intended recipient of the
The inputs to her commitment transaction are: 1) fund‑ payment. This inalizes the payment. The important de‑
ing transaction outpoint and a signature from Bob. She tail here is that, if Bob does not reveal the preimage on
receives Bob’s signature for each new state which enables time, 1 Bitcoin will be returned to Alice.
her to broadcast her commitment transaction if required.
Revoked State Broadcast: We ly mentioned in the
As for the outputs, there are 3 of them as shown in Fig.
commitment transaction part that, the irst output of
3. Output 1 is for Alice’s balance on the channel. If she
Alice’s commitment transaction is conditional. If Al‑
broadcasts her commitment transaction for any reason, ice broadcasts her commitment transaction, she can re‑
she can claim her funds from this output after waiting k deem her funds from Output 1 only after waiting k num‑
number of blocks. Output 2 is for Bob’s balance on the
ber of blocks, in other words, her funds are timelocked.
channel which Bob can spend immediately. Finally, Out‑ This mechanism of LN is to prevent possible cheating at‑
put 3 is for the 1 Bitcoin payment Alice sent to Bob. We tempts that might arise from broadcasting old commit‑
will explain it next.
ment transactions. If Alice broadcasts a revoked (old)
Commitment Tx (Held by Alice) state, Bob can sweep Alice’s funds in the channel (Out‑
Input Funding Transaction Outpoint, Bob's Signature put 1) by using the revocation private key of the respective
Output 1 channel state while Alice is waiting to redeem the funds
Alice's balance on the channel. She can spend this output for the duration of the timelock. Publishing an old state
using her private key but has to wait k number of blocks is tempting for Alice since she initially had 5 Bitcoins in
or the channel which is more than what she has now (i.e. 4
Bob can spend this output immediately using Alice's
revocation private key if Alice cheated Bitcoins). However, this cheating attempt will result in Al‑
Amount: 4 BTC ice losing all her funds in the channel. Therefore, channel
Output 2
parties are disincentivized from cheating with this time‑
Bob's balance on the channel and it is immediately lock mechanism in the commitment transactions.
spendable by Bob
Amount: 0 BTC
Output 3 3.3 Basis of lightning technology
Output for the HTLC payment and spendable by Bob if he
knows the payment preimage R Basis of Lightning Technology (BOLT) documents spec‑
or
Alice gets it back after block height w ify the LN’s layer‑2 protocol completely. Different imple‑
Amount: 1 BTC mentations of LN follow these speci ications to be com‑
patible with each other. We propose changes to BOLT #2
Fig. 3 – An illustration of the commitment transaction stored at Alice. and BOLT #3 to implement our protocol. These two spec‑
i ications are explained below.
56 © International Telecommunication Union, 2021