Interoperability - Proof of Work vs Proof of Stake [Deep dive Analysis]
Today’s guide will look into the two factors that can have a profound impact on a crypto project’s success: its choice of consensus mechanism and how it achieves interoperability. So, we will make an in-depth comparison between the two most prominent consensus algorithms in the crypto space – proof-of-stake (POS) vs. proof-of-work (POW). We will look into their current status and short term future expectations. We will also be looking into interoperability projects like RSK to achieve interoperability.
POW vs POS -& Interoperability
What is Consensus?
Consensus is a dynamic way of reaching an agreement in a group. While voting just settles for a majority rule without any thought for the feelings and well-being of the minority, a consensus, on the other hand, makes sure that an agreement is reached, which could benefit the entire group. From a more idealistic point-of-view, Consensus can be used by a group of people scattered around the world to create a more equal and fair society.
A method by which consensus decision-making is achieved is called “consensus mechanism.”
So now, we have defined a consensus: let’s look at what the objectives of a consensus mechanism are (data taken from Wikipedia).
- Agreement Seeking: A consensus mechanism should bring about as much agreement from the group as possible.
- Collaborative: All the participants should aim to work together to achieve a result that puts the group’s best interest first.
- Cooperative: All the participants shouldn’t put their own interests first and work as a team more than individuals.
- Egalitarian: A group trying to achieve consensus should be as impartial as possible. What this basically means that each and every vote has equal weightage. One person’s vote can’t be more important than another’s.
- Inclusive: As many people as possible should be involved in the consensus process. It shouldn’t be like regular voting where people don’t feel like voting because they believe that their vote won’t have any weightage in the long run.
- Participatory: The consensus mechanism should be such that everyone should actively participate in the overall process.
What is POW?
Made famous by bitcoin, POW is a consensus mechanism that achieves byzantine fault tolerance. So, how does this process work? Let’s take a quick look.
- The miners solve cryptographic puzzles to “mine” a block to add to the blockchain.
- This process requires an immense amount of energy and computational usage. The puzzles have been designed in a way that makes it hard and taxing on the system.
- When a miner solves the puzzle, they present their block to the network for verification.
- Verifying whether the block belongs to the chain or not is a straightforward process.
Advantages of POW
One of the best things about the POW protocol is that it’s extremely secure. Let’s look at the security provided by Bitcoin’s POW.
- As per calculations, it can take as much as .4 billion to hack the bitcoin blockchain with a successful 51% attack.
- Even if someone does have the funds to launch such an attack, they will tank the BTC’s price, making all of their investments pointless. As such, it is the very definition of a zero-sum game.
Disadvantages of POW
Having said that, there are several drawbacks in the traditional POW protocol:
- It is an extremely inefficient process because of the sheer amount of power and energy that it eats up.
- People and organizations that can afford faster and more powerful ASICs usually have a better chance of mining than the others. As a result of this, bitcoin isn’t as decentralized as it wants to be.
- POW isn’t well-suited to host scalable applications due to its inherent flaws.
- Other POW chains may not be anywhere near as secure as bitcoin due to a lack of mining activity.
What is proof of stake algorithm?
Proof of stake will make the entire mining process virtual and replace miners with validators. Validators lock up tokens within the ecosystem and then earn rewards for signing off on blocks. This is how the process will work:
- The validators will have to lock up some of their coins as stake.
- After that, they will start validating the blocks. Meaning, when they discover a block that they think can be added to the chain, they will validate it by placing a bet on it.
- If the block gets appended, then the validators will get a reward proportionate to their bets.
As you can see, the POS protocol is a lot more resource-friendly than POW. In POW you NEED to waste a lot of resources to go along with the protocol. It is basically resource wastage for the sake of resource wastage.
Proof of stake coins
Advantages of POS
- Staking leads to decreasing token velocity. Token velocity is a term used to measure how often a token is traded and is inversely proportional to the network value. Since staking locks up the tokens, it prevents them from getting repeatedly traded.
- POS is less wasteful than POW since it doesn’t use a real-world resource.
- Staking can also be a great way of earning passive income. Simply lock up your tokens and watch your investment appreciate.
Proof of Stake vs Proof of Work
The future of POW and POS
A lot of projects that belong to Gen 3 and beyond like EOS, Cardano, TOP Network, etc., have already adopted the POS protocol. As we move on from pure cryptocurrencies to full-on blockchain ecosystems, it looks like POS, or at least a variation of it, is going to be the algorithm of choice. However, bitcoin is going to remain the dominant cryptocurrency and they don’t have any designs of moving on from POW.
Blockchain and Interoperability
Having tackled the consensus issue, we will move on to the next big problem. Currently, interoperability is a big issue. We have several blockchain platforms with different requirements. As of now, there is no convenient and decentralized way for this exchange to happen. If you want to replace your Cardano tokens with ethereum, you’ll need to do it through a centralized exchange. While these exchanges are pretty fast and efficient, certain issues need to be considered every time you use them:
- Since the exchanges are centralized they are a prime hotspot for hacking attempts and activities.
- The exchanges are subject to the governing laws of the country that they are registered in.
- The exchange may do routine maintenance, which could seize up trading activity.
This is why to prevent different blockchain platforms from becoming silos. They must know how to communicate with each other efficiently. Since bitcoin and Ethereum are the two most significant projects in the space, it makes sense to understand how these two plan on communicating with each other. The project that is currently making this happen is RSK.
RSK Innovation: Token Bridge
RSK has created a token bridge that allows users to cross ERC-20 tokens between RSK and Ethereum. A smart contract creator can choose to cross tokens through a network during the contract execution. This way, they can take advantage of lower fees on one network while leveraging faster consensus on the other chain.
This is how it works:
- The bridge smart contract locks the original tokens on the original chain.
- The bridge emits an event and the federation governing the two-way peg in the sidechain takes the information in the event and sends it to the bridge on the other chain.
- Once more than 50% of the federation members have validated the transaction, the other chain’s bridge will create ERC777 tokens for the same amount that were locked on the other chain
- The ERC777 tokens are ERC20 compatible and are a lot more functional.
Since RSK also has a two-way bridge with bitcoin, it empowers Bitcoiners to transition over on to RSK and interact with smart contracts.
Decentralizing the Bridge: HawkClient
RSK has currently worked several implementations to decentralize the bridge, interconnecting different networks. The first implementation is called HawkClient, which is an interactive smart contract system that maintains a smart contract in one host while being synced to a foreign blockchain.
Features of HawkClient
- Allows for the transfer of information having explicit monetary value
- Two HawkClient systems are implemented in a mirrored fashion between two blockchains. This enables them to transfer tokens from one blockchain to the other.
- This reduces the sizes of the proofs but allows the bridge to work under a cryptoeconomic model of security. So, achieve high-levels of security while putting stress on your systems.
A HawkClient system has the following four roles:
- Approximate Merkle Mountain Range (AMMR) Updater or AMMR-Updater
How does the system work?
- A prover commits to the remote blockchain and submits the commitment to the verifier.
- The verifier issues a challenge and the prover answers it by creating a HawkClient proof.
- This HawkClient proof has a selected subset of headers from the main chain and the linkage proofs.
- This subset of headers is retrieved by sampling over the cumulative difficulty space. This is done based on a pseudo-random number generator is derived from the verifier’s challenge.
- The verifier allows other provers to challenge the proof or present alternate proofs. The network will select the proof with the highest cumulative proof-of-work.
RSK Innovation: Syncchains
It has long been known that projects can achieve interoperability and several other functional features through sidechain integration. However, RSK has further taken the concept of sidechains with syncchains, a new merged-mined sidechain that allows for faster peg-ins and peg-outs while protecting it from double-spends. A SyncChain requires each sidechain client to run both an instance of the mainchain node and the sidechain-specific node. The three main features of syncchains are as follows:
- Delayed dual-parenting.
- Peg transaction linking.
- Coinbase anchoring.
#1 Delayed dual-parenting
Dual parenting is one of the core concepts behind syncchains. The idea is that each sidechain block must have a sidechain parent and a mainchain parent. RSK uses a variation of dual-parenting called delayed dual-parenting (DDP). The mainchain parent is also known as a “checkpoint.” With DDP, the checkpoint is set to lag by a number of blocks (let’s say K) based both on timestamps and mainchain block confirmation count.
In the diagram above, the value of the lag or K is 3. Since three blocks delay the checkpoint, which amounts to around 3*10 = 30 mins. So, why is there a delay here in the first place? Consider this:
- Let’s assume that the block time for the RSK chain is 30 seconds.
- Each bitcoin block is mined in 10 mins. So, between two blocks is the main chain, 20 RSK blocks are mined in the side chain.
- What this means is, that if a single bitcoin block gets overturned, it adversely affects 20 RSK blocks. This is why the delay helps in maintaining synchronization.
As you can see in the diagram above, overturning one block didn’t have any effect on the RSK chain.
To create this delayed effect, syncchains require a special kind of consensus algorithm called “Checkpoint Selection Algorithm” or CSA. A CSA selects the mainchain checkpoint and sees if it’s appropriately validated, or not. A CSA bases its decisions on the block timestamps.
The SyncChain white paper presents two RTA algorithms:
- MedianTime11: MedianTime11, requires the existence of 5 bitcoin blocks following the block to checkpoint. The algorithm establishes the reference time of a bitcoin block B to be the median of 11 blocks centered on B.
- Time: This algorithm sets the reference time of a bitcoin block B to be the more recent of the block timestamp and previous block reference time.
#2 Peg transaction linking
All the peg-in and peg-out transactions are linked together for the following reasons:
- Avoid attacks where the attacker reorganizes the bitcoin and RSK blockchains to double-spend funds from the point where the attacker himself has pegged-in or out.
- Secures peg-outs and makes peg-out double-spends infeasible.
The following diagram depicts a peg-in and a peg-out for a classic federated sidechain.
There are two things that you need to keep in mind about the diagram above:
- A federated multi-sig protects the peg funds, and the parties that have the private keys of this multisig are called functionaries.
- The red line in the diagram contains all the transactions signed by functionaries. Since each of the transactions consumes one dummy input and creates one dummy output, there is only one unspent transaction output or UTXO at all times. This UTXO is known as link token or “loken” and the red line is known as the loken chain.
The diagram above shows the peg-in process.
- The bridge smart contract automatically allows functionaries to forward the coins received in the peg-in transactions to a different UTXO. The bridge smart contract will be in control of the peg-in and peg-out transactions.
- The transaction that moves you from the bitcoin blockchain into the sidechain is known as the link-in transaction. The link-in consumes a loken and creates a new loken
In the diagram, a user initiates a transaction in the main chain at block 1, to move into the side chain. This movement triggers several actions across the bridge where sidechain block A checkpoints the block 1.
- A waiting period of three sidechain blocks is initiated.
- The bridge orders the federation functionaries in block B to sign and broadcast the link-in transaction.
- Post-broadcast, the protocol immediately consumes the peg-in funds and moves them to the final multi-sig peg address.
- The sidechain coins are now released in block A.
- The user can’t peg-out of the sidechain until the link-in transaction is included in the mainchain.
In standard proof-of-work sidechains, the full atomicity of peg-in and peg-outs can’t be achieved without the collaboration of the miners. Theoretically speaking, if the attacker quickly moves in and out of the main and side chain, they can succeed in keeping both the mainchain and sidechain tokens.
To guarantee the infeasibility of peg-out double-spends, it’s necessary to add to the Nakamoto Consensus in the sidechain. As per IOVLabs’ research, three different protocols achieve that along with M.A.D. (Mutually Assured Destruction) and unconditional guarantees.
- Peg-out for a More-Populous-Chain-Wins (MPCW) SyncChain
- Peg-out for T-Synchronized (TS) SyncChain
- Peg-out for a GHOST-CSC (not T-synchronized) SyncChain
#3 Coinbase Anchoring
As per IOVLabs, an easy way to anchor transactions to a specific block by adding a new opcode to the bitcoin protocol – OP_CHECK_INPUT_BLOCK_HASH. This code receives a block hash as an argument and invalidates the block if it doesn’t match up with the hash. However, since this opcode restricts moving transactions, it would make bitcoins less fungible, which it won’t be acceptable by the bitcoin community. An alternative option with a lesser effect on fungibility would be OP_CHECK_INPUT_BLOCK_TIME. The opcode invalidates the transaction if the block corresponding to the spent input has a timestamp higher than the opcode argument.
However, one can achieve the same result without any new opcode, by consuming in the peg-out transactions as an output from a coinbase transaction that exists in a block B between the link-out and the peg-out transactions blocks. This can be seen in the image below.
This peg-out transaction would be invalid if B is reverted, and the only way to remove the link-out would be to revert to B.
However, there is one big disadvantage of coinbase anchoring. These coinbase transaction outputs have a 100-block maturity period, which introduces a 100-block delay for the peg-out. To bind the peg-out to a coinbase, RSK can request that RSK merge-miners to include an extra output paying an amount 1 satoshi to a specific federation address and that satoshi is consumed in the peg-out transaction.
While using the AdjustedTime algorithm, for low-value payments, the whole peg-out process takes only 12 minutes. In contrast, high-value payments would require coinbase anchoring, and therefore would take on average 16 hours (100 bitcoin blocks).
Conclusion – POW vs POS & Interoperability
This guide should give you some clarity over how projects like RSK are looking to integrate interoperability. Before that, we told you about the difference between POS and POW and the various qualities that make them highly desirable. If you have any questions, then sound off in the comments below.
Get started today and earn 128 bonus blocks
Already have an account? Sign In