Sometime, soon, we need to realise that we are running a legacy world of finance, and that we need to build a more trusted digital infrastructure. In fact, it’s not just finance we need to transform, it is any areas that need high levels of trust, security and distribution. For this, we can have Layer-1 blockchain methods such as Ethereum, but it has shown a scaling problem, where the main ledger and computation infrastructure cannot cope with more than 15–30 transactions per second.
But, new methods are now being applied to alleviate the load on Ethereum — while still maintaining trustworthiness and distribution. These include Layer 1 implementations for sharing and a transition toward Proof-of-Stake (PoS). The most interesting advancements, though, are happening within Layer 2- methods, and which build on the core Ethereum network (Mainnet).
State channels were initially implemented with the Bitcoin Lightning network, and have since been scaled on the Ethereum. With this, we basically have two records on the Mainnet ledger, and where the party involved must commit some funds that might or might not be spent. For example, let’s say Bob wants to create a side channel to pay his customers, and will commit 10 Eth. He will then create a channel contract. The committed Ether will then be locked for the time of the channel, and which cannot be spent. Bob could then give 2 $Eth to Alice, and 3 $Eth to Carol. Once he is finished with this, he will commit the finished transaction back, and where Bob will get 5 $Eth back, and Alice will get 2 $Eth and Carol will get 3 Eth. In the end, Bob just posts the summary data and will only pay gas fees for the two commitments to the ledger. The implementation of state channels is offered by Polygon, and who implement full EVM compatibility and low transaction fees. An example from here is:
pragma solidity ^0.7.0;
contract PaymentChannel {
address public sender;
address public receiver;
uint256 public expiration;
uint256 public amount;
constructor(
address _receiver,
uint256 _amount,
uint256 _expiration
) payable {
sender = msg.sender;
receiver = _receiver;
amount = _amount;
expiration = block.timestamp + _expiration;
}
function close(uint256 _payment) public {
require(
msg.sender == receiver,
"Only the receiver can close the channel"
);
require(
_payment <= amount,
"Payment amount exceeds amount in the channel"
);
selfdestruct(receiver);
}
function extendExpiration(uint256 _expiration) public {
require(
msg.sender == sender,
"Only the sender can extend the expiration"
);
require(
_expiration > expiration,
"Expiration must be set to a longer time than the current expiration"
);
expiration = _expiration;
}
}
One of the best mechanisms to scaling up Ethereum is moving transactions off-chain through roll-ups and side chains.
These process transactions off-chain and assume that the transactions are valid (basically, a “trust and verify” approach). They only take up computation resources on the Mainnet when there is a dispute in the transactions. There will thus be a “challenge period” delay that is required before transactions are actually confirmed onto the Mainnet.
With Arbitrum, fraud observers analyse transactions, and if a fraudulent transaction is identified, the observer will post a fraud proof to the Mainnet. In fact, Arbitrum can identify the lines of the code that relate to the fraud analysis, and then post that to the Mainnet. The Mainnet can then adjudicate on the fraud proof and decide whether to execute the required code. For Arbitrum, there is a seven-day withdrawal period [here].
Optimism also uses off-chain methods with optimistic roll-ups and assumes that the transactions are valid. It uses watchers (or verifiers) to determine if there is a fraudulent transaction, and can submit a fraud proof, and where the transaction can be removed. The watcher will be rewarded for finding a fraudulent transaction. Overall, there is a delay of around seven days for the challenge, and where the transaction is reversed if it is found that the fraud proof is correct [here]:
These move the computations and the storage of state to off-chain and involve a trustless approach. Once posted back onto the Mainnet, there will be minimal updates required for the change of state and the proofs associated with this. As we have the proofs in a compressed form, we can have fast validation of the updated transactions, along with supporting the privacy of the transactions. With this, rather than with optimistic roll-ups that take days to commit, with zk-Rollups (based on zkSnarks), we only need about an hour to verify the proofs. This ensures there are no double spending and that all the transactions are solvent. An example is ZKsync [here]:
With zk-Rollups, there are cryptographic proofs of the validity of transactions, and then they link to the Mainnet. It would thus be extremely difficult to perform a fraudulent transaction. With optimistic roll-ups, there is a lack of cryptographic proof, so before there is a commitment back onto the Mainnet, and thus a delay so that fraudulent transactions can be detected.
This is an independent side chain and is a separate blockchain that is bridged to the Mainnet. Unlike the roll-up methods, the updated transactions can then be echoed back onto the Mainnet when required. Overall, they have their own blockchain and their own consensus mechanisms — such as Proof of Authority (PoA). Polygon is an example of a side-chain infrastructure. The overall weakness of side channels is that they are likely to have a different security model than the main Ethereum network [here]:
To me, Zero Knowledge Proofs in an offline chain is the best solution, as it is fast to verify the transactions onto the main chain, and to keep the privacy of those transacting. We can also use selective disclosure within ZKPs, and which could be useful in revealing important information, such as whether a person has the right to access a resource.
With optimistic rolls-ups, we assume the transactions are valid unless proven otherwise, and where we need a challenge period for transactions to be challenged before finalised. With zk-Rollups, our transactions will be valid as there is a proof associated with this, and where we have a fast commitment to the Mainnet. Unfortunately, zk-Rollups need a strong understanding of cryptography and blockchain, and which can slow down developments.
Obviously, Ethereum isn’t the only show in town, and Polygon [here], Solana [here], Cardano [here], and Polkadot [here] are providing alternatives which scale better than Ethereum. But, we love the blockchain that brought us smart contracts and the EVM (Ethereum Virtual Machine), and many hope that it can overcome its scalability issues, and keep the same levels of distribution and security.