Leased Proof of Stake Consensus Algorithm and the Waves-NG protocol
Author: Guy Brandon, Waves contributor.
Waves network operates on a leased proof-of-stake (LPoS) consensus algorithm combined with the Waves-NG protocol, allowing for a high degree of scalability and transaction throughput.
Waves network was launched in 2016 after an ICO that raised 30,000 BTC – around $16 million at the time. The project is developing a comprehensive blockchain ecosystem for use in business processes, with a wide-ranging toolkit covering diverse needs – including easy creation of custom cryptocurrency tokens; straightforward smart contracts; peer-to-peer trading on a built-in decentralized exchange (DEX); and a safe, convenient means of interacting with dApps and web services through the Waves Keeper browser plug-in.
From the outset, Waves recognized that scalability would be required for mass blockchain adoption, and prioritized the development of technology to address the limitations of existing blockchains. For example, Bitcoin is highly secure but relatively slow, and can only support around 7 transactions per second (TPS). As such, Bitcoin is not efficient enough to be used as an everyday currency worldwide. Second-tier solutions such as the Lightning Network are required for Bitcoin to serve this purpose. Waves has taken a different approach, focusing initially on high on-chain scalability before considering second-tier applications.
Waves’ original consensus algorithm was a simple Proof of Stake implementation. All 100 million WAVES tokens were distributed after the ICO, and supply is fixed: there is no inflation, as there is with PoW-mined coins. Therefore, Waves block validators (forgers, though they are typically known simply as ‘miners’ within the Waves ecosystem) receive transaction fees from the blocks they process, but no block rewards.
The Leased Proof of Stake (LPoS) system was fully launched in May 2017, allowing users of the Waves lite client – those who did not run a full node – to lease their WAVES tokens to mining nodes. Leased WAVES are locked in the user’s account and cannot be transferred or traded. Still, the tokens remain in the full control of the account holder and leases can be canceled at any time. Given the technical overheads associated with running a mining node and the need to be online 24/7, only a relatively small proportion of the Waves community runs nodes (a list of block generators can be found at https://dev.pywaves.org/generators/).
WAVES tokens that are leased to a mining node are used to increase the stakeweight of the miner, which in turn increases the chances of that miner finding the next block. The Leased Proof of Stake system improves network security in at least two ways. Firstly, the more WAVES are used to secure the network the better, because it becomes harder for an attacker to accumulate the tokens necessary to carry out a 51% attack. Secondly, WAVES can be leased to a node from a user’s cold storage address, but the node itself – which remains online – may only have a minimal balance. This significantly reduces the risk of WAVES tokens being hacked from computers that are online, since the leased funds are not transferred to the miner.
A new approach to consensus: Waves-NG
A further upgrade to the network occurred in December 2017, with the launch of Waves-NG. This was a new protocol based on the Bitcoin-NG proposal by Cornell IT professor Emin Gün Sirer.
The original Bitcoin protocol chooses each miner retrospectively. After a block has been added to the blockchain, miners compete to find a valid hash for the next block, based on the current state of the blockchain. Meanwhile, newly-generated transactions go into the memory pool (mempool), where they will remain pending until a miner eventually collects and validates them.
Although both Bitcoin and Bitcoin-NG protocols are considered Byzantine fault tolerant (BFT) systems, the latter was proposed in 2015 as a scalable alternative based on a different working mechanism. On a Bitcoin-NG system, the next miner is chosen in advance and this miner creates an empty ‘key block’ – which is the block that will be ultimately added to the blockchain. Small blocks called ‘microblocks’ (consisting of a few transactions each) are added in near-real time to this key block. To use an everyday analogy, this is like adding several bags of shopping (microblocks) to a trolley (keyblock), before the full trolley is ultimately wheeled to the checkout (added to the blockchain). This means that transactions can be added to the blockchain in just a few seconds, with the only real delay being network latency. Waves updated this idea for a proof-of-stake network, creating the Waves-NG protocol – the first deployment of Bitcoin-NG for an open, public blockchain.
A further addition to the ecosystem has been MassTransfers. These allow up to 100 transfers to be packaged within a single transaction, with reduced fees. The limit of 100 txs per MassTransfer was chosen as a compromise between adding significant capacity and convenience, on the one hand, and limiting the ability to send very large batches of low-cost transactions all at once, on the other hand. If more transfers need to be made, multiple MassTransfers can be submitted sequentially.
In other words, users can simply choose a MassTransfer as a different kind of ‘Send transaction’, allowing them to include up to 100 recipients in a single transaction. Moreover, the recipient addresses can be provided via JSON or uploaded from a CSV file, making it straightforward and efficient to conduct large airdrops or perform weekly payouts to those who lease their WAVES to mining nodes. Combined with Waves-NG, the MassTransfer feature enabled a very high rate of throughput on the network.
A number of stress tests have been conducted on the Waves network to gauge the throughput potential of the new protocol. In October 2018, a major stress test was conducted on MainNet. This demonstrated that the public, open blockchain protocol (not simply a limited and controlled TestNet) could support over 6.1 million transactions within a 24-hour period – an average of 4,200 txs per minute or 71 txs per second, with peak throughput reaching hundreds of transactions per second.
The Leased Proof-of-Stake system enabled everyday users without technical expertise to help secure the Waves network, leasing their WAVES to full nodes without losing control of their tokens. Meanwhile, Waves-NG enabled a throughput of up to 100 TPS, which is an order of magnitude more than many blockchains. Fees are low because there is no need to pay miners with block rewards to compensate them for high electricity costs and expensive hardware.
On-chain scalability has been a priority for Waves, but there are limits to the extent that any blockchain can scale this way due to the storage and bandwidth required. Waves’ developers believe that the current approach can be optimized to support up to 1,000 TPS before further scaling solutions are required. Waves is currently exploring options for a second-tier scaling solution involving sidechains, enabling a large number of transactions to be processed on a parallel chain but ultimately secured on the main Waves blockchain.