David Nettey

[email protected]

Abstract

Bitcoin was created as a new type of currency that could improve on the short falls of fiat currencies. It is decentralized, permission-less, immune to hyperinflation, and open source. Despite all these advantages, it does have flaws and limitations. One of the most pressing limitations in Bitcoin is scaling. Bitcoin has a low transaction throughput, about 3 to 7 transactions per second [5]. When the network is congested, transaction fees can skyrocket. In order for Bitcoin to be used widely as a peer to peer cash system, it must solve its scaling issues.

To increase transaction speeds, we can make use of a second layer network. This network will act as a verification layer, allowing transactions to be viewed and spent much faster. The Avalanche consensus mechanism will be used to track and verify transactions off-chain. The Bitcoin network will act as the settlement layer. A user's wallet will periodically post a settling transaction to the Bitcoin network containing verified but unsettled transactions. In order to save on fees, the settling transaction will be comprised of multiple off-chain transactions. The second layer network essentially acts as a decentralized, trustless bank card issuer and payment processor for the Bitcoin network.

Background

Bitcoin

Satoshi Nakamoto's idea of a distributed ledger is the core of Bitcoin. Each node on the bitcoin network has a copy of the ledger. This ledger is composed of blocks that are linked to one another, hence the name blockchain. Each block has a set of transactions, a header, and a block hash. Only 1 MB of transactions can be added to a block. In the block's header's is metadata like the previous block's hash and time. The block's hash is the result of passing all the data in the block's header through a hash function called sha256 [3, 7].

Each person on the bitcoin network has a public and private key. The public key is used to "lock" bitcoin to an address. The private key is used to create signatures. These signatures are intrinsically linked to an address and transaction. A signature can be used to "unlock" the funds at that address. The signature also ensures that only the linked transaction can be performed [3, 7].

Transactions are composed of inputs and outputs. Outputs are analogous to packages of bitcoin that belong to a someone. Each output is locked by the address using its owner(s)'s public key. Inputs point a set of existing, unspent outputs and uses them to create new outputs locked by new address. When a transaction is put on the blockchain, all outputs that the transaction's inputs point to are considered spent. The new outputs on that transactions are considered unspent. The sum of the spent outputs must be equal to the new, unspent outputs [3, 7].

Blocks of transactions are confirmed by a mechanism called Proof-of-Work. Nodes called miners listen for new transactions and add them to a candidate block. When 1 MB of transactions have been added, the miners begin mining. There is a special field in the block's header that a miner can change called a nonce. When they change the nonce, the block's hash changes. Mining is a race between miners to change the nonce until the block hash meets certain conditions. The miner who meets the hash conditions first broadcasts the new block onto the network. Baked into the new block is the block reward, newly created bitcoin that goes to the miner. The miner also gets all fees in that block. If there are conflicting blocks, nodes create a fork in their copy of the blockchain. Each fork has one of the conflicting blocks. The nodes continue listening for new blocks. The longest fork is the one that will be trusted [3, 7].

Proof-of-Work is a tried and true method of updating the blockchain. However, there are drawbacks. Mining uses large amounts of electricity. If this electricity is sourced from fossil fuels, it increases the amount of CO2 in the atmosphere, contributing to climate change. Another drawback is the transaction throughput. The mining process was designed to take approximately 10 minutes [3, 7]. The difficulty of mining automatically adjusts to ensure this timespan [3]. This is already impractical for day to day transactions. If the network is congested, transactions can take far longer. This is due to the fee system. Transactions compete to be included into a candidate block. Transactions can offer high fees to the miner to be prioritized. The higher the fee, the quicker a transaction can be added to a block [3]. This means transactions with low amounts must either offer disproportionately high fees or potentially wait for hours to be confirmed.

Avalanche

The Avalanche consensus mechanism is an alternative to Proof-of-Work and Proof-of-Stake created by a group called Team Rocket. Avalanche seeks to address the scaling issues in Proof-of-Work while achieving consensus in a leaderless fashion. The fundamental building block of Avalanche is the Snowball algorithm [4, 5].

Every node on the network chooses between a pair of binary choices. Lets call them A and B. A node has an initial preference for A. The node proceeds to query $k$ random nodes on the network for their choice. If $\alpha$ nodes out of $k$ have a preference for A, the node increments the number of consecutive successes. If B gets $\alpha$ out of $k$, then the node changes its preference to B and sets the consecutive successes to 1. If neither choice gets at least $\alpha$ votes, then the consecutive successes is set to 0. This repeats until the number of consecutive successes for a given preference reaches $\beta$; then the node finalizes its decision [4, 5].

Avalanche uses a directed acyclic graph (DAG) in order to track transactions. A graph is a data structure that has packets of information, nodes, connected to each other through edges. If a graph is directed, that means an edge can only be traversed in one direction. Acyclic means that it is impossible to end where one started while traversing the graph. A graph node's ancestors are all the nodes that can be reached by following edges that lead away from the node. That graph node is a descendant of all those nodes along each path [4, 5].

In Avalanche, each transaction in the graph is an output similar to those in Bitcoin. The consensus mechanism uses Snowball to ensure that conflicting transactions - such as a double spend - are not included in the DAG. Conflicting transactions belong to a conflict set. If there is only one transaction in the set, then it is likely to be an honest transaction. When a node the network learns about a new transaction, it performs a modified version of the Snowball algorithm [4, 5].

It queries $k$ random nodes about whether they prefer the transaction. If $\alpha$ nodes or more prefer it, then the transaction gets a chit. A chit is a boolean stating whether the transaction got a quorum of votes or not. As the transaction gets descendants with chits, its confidence increases. Confidence is simply the sum of chits in all a transaction's descendants plus its own chit. Once a transaction's confidence reaches $\beta$, it is accepted. If the transaction belongs to a conflict set with two or more members, then the transaction that achieves $\beta$ confidence is the only one that gets accepted [4, 5].

Avalanche's byzantine fault tolerance increases as $\alpha$ increases. This means that the network can handle a higher proportion of nodes being malicious as $\alpha$ increases. Consensus is probabilistically guaranteed. There's an incredibly small chance that the algorithm would result in no consensus. Snowball is also very scalable. $k$ and $\alpha$ can remain the same even as the number of nodes in the network increases. A network running Avalanche can theoretically process 3,400 transactions per second, with each transaction being verified in around 1.35 seconds [4, 5].

Verification Layer