Add Thesis

Evaluation of Payment Channels for Bitcoin Exchange Inflows and Outflows

Written by Fredrik Mörtberg

Paper category

Bachelor Thesis


Computer Science




Thesis: Bitcoin The purpose of this chapter is to provide a basic understanding of some key concepts in the use of lightning technology, with a focus on Bitcoin transactions. Bitcoin is a broad collection of technologies, and only a subset is covered in this chapter. For example, you can find more information about Bitcoin on the Bitcoin Wiki site [4] or SatoshiNakamoto [1]’s original white paper. Lightning is not unique to Bitcoin and can also be applied to other currencies, but in order to limit the complexity and scope of this article, other currencies will not be included. 2.1 Bitcoin transactions In order to understand the technology behind Lightning, we also need to understand that the transaction network in Bitcoin is constructed. Bitcoin transactions are used to transfer value between participants in the Bitcoin network. Every transaction becomes a public entry on the Bitcoin blockchain when it is broadcast and accepted by the network. Transactions have inputs and outputs, describing where the funds are obtained from and where the funds will flow next. The transaction also includes rules for expenditure output. Spending output is the same as transferring value from one location to another. The number of bitcoins you have is the sum of all the outputs you can spend with the keys you have. Bitcoin uses public key cryptography to ensure security and proof of ownership. Bitcoin can be called unspent transaction output (UTXO). UTXO is linked to the public key, and its output has not been used. Owning Bitcoin is equivalent to knowing the corresponding private key. Ownership is proved by a signature generated using the private key. The transaction is only valid if it is signed with a valid signature according to the requirements specified in the transaction. The signature can be verified by using the public key in the transaction, and is only valid when it is created by the matching private key. Everyone can verify this. The output of a transaction can consist of multiple addresses. An important aspect of Bitcoin is that the output can only be spent once. This is because transactions are only valid when UTXO is used and verified and executed by Bitcoin nodes in the network. Each block added after the transaction is included in the blockchain increases its finality. When enough blocks (called confirmations) are added after the transaction, it is considered irreversible [5]. Therefore, if you wait for enough confirmations [6], it is impossible to double spend in Bitcoin. Double spending means that the same funds can be used in other places after they have been accepted in one place. If you accept the transaction with too few confirmations, you risk spending it elsewhere. 2.1.1 Script The transaction in Bitcoin is defined by the script [7]. The script describes how to spend transactions. 3.1 Payment channels Payment channels are a proposal to expand blockchain-based currencies. Payment channels can be used to make payments that are not recorded on the underlying blockchain, usually referred to as off-chain payments. Off-chain payment is one of the more promising solutions for the expansion of blockchain-based currencies. The basic security and stability of the payment channel are inherited from the underlying blockchain, but in order to use it securely, the payment channel protocol also needs to be secure. Over the years, there have been different suggestions for payment channels [11]. We are interested in two-way payment channels, which means that value can be transferred in both directions. There are two main suggestions for two-way payment channels compatible with Bitcoin. Duplex Micropayment Channels [12] and Lightning [3] of which the latter has received the most attention. The advantage of a two-way channel is that it is still useful when the balance on one side is low. The disadvantage of one-way payment channels is that they cannot balance channels. A balanced channel means that when the balance at one end of the channel is low, participants can send funds through the channel first, making them more balanced. Different fees can be used to incentivize sending funds in a certain direction. The inability to send in both directions means that it will be useless when funds are consumed. In Figure 1, we see the payment channel between two nodes A and B. The two nodes have 5 units on each side of the channel. Nodes can now pay each other back and forth. In Figure 2, node A sends 3 units to B, resulting in a new state, where node A has a balance of 2 units and node B has a balance of 8 units. The capacity of the channel is the total balance in the channel, which is 10 units, which is the maximum number of nodes. 3.2 Payment Channel Network Payment Channel Network (PCN) is a network of nodes connected by payment channels. In this network, payments can be routed between two nodes without directly connecting a channel between them. In Figure 3, a simple PCN composed of three nodes is shown, all of which can send funds between each other under the restriction of the routing balance. In Figure 4, it is illustrated how the balance is affected when a node pays another node through an intermediate node. 3.3 The general idea behind the Lightning Network Lightning is that if only two participants care about a repeated transaction, then all other nodes in the network do not need to know the transaction. Due to the scalability problem of the Bitcoin network [9], we hope to avoid broadcasting information to the Bitcoin network as much as possible. By performing off-chain transmission, we can reduce this information. The Lightning Network is a layer 2 solution for off-chain Bitcoin transactions, mainly using the Bitcoin network as the settlement layer. Read Less