Ethereum Layer 2 solutions channels and roll ups
Now in todays world ethereum supports only 15 transactions per second. Also the gas fees required to do this transactions also increasing .If we want to do transactions with higher speed then it requires a gas fees more than 100$ . So we have to find the solution to overcome this problem .also we have to increase transaction speed.
that is why layer 2 solutions were created some of this are as follows
1. Channels :-
To understand this lets take the famous example, i.e. Alice and Bob.
Consider Bob wants internet connection which is providing by Alice. so for every one Megabyte usage of data Bob has to pay 1$ to Alice and that transaction is recorded on blockchain.so for every one Megabyte use of data Bob needs to pay and that need to be updated on the blockchain . but this solution increases traffic on blockchain and also make blockchain to run slow.
for this problems the channels were created.
so how channels overcome this problem lets see.
For transaction purpose Alice and Bob needs to create a separate channel. Channel means separate path for transactions where all transactions are recorded .first Bob
lock some ethers in the smart contract . for every usage of one Megabyte of data a ticket is generated for 1$ and transfers to the Alice.
if Alice wants money then he simply give that ticket to the smart contract and if the ticket is valid then Alice gets the ethers from smart contract. and if the ticket founds to be invalid then that transaction is rejected.
So by using this approach traffic on the blockchain gets reduces also there no need to verify every transaction so transaction is done in faster ways.
Lets see major disadvantages of channels :
If we want to create channels between two parties then they should trust each other. In channels there is no mechanism called transaction validation . No one will check whether this transaction is valid or not. Because one party have trust on other there no need to check for transaction validation . Because of trust we know that the second one will not do any kind of fraud with us. so channels are useful only if we know second one very well.
Otherwise channels are useless because there is no any transaction validation mechanism.
2. Rollups :-
In rollups side chain is present and all the mining process will be done on that side chain reducing load on main chain after transaction is mined that will be pushed or updated on main layer or layer 1.
Rollups are of two types :-
1. ZK Rollups : -
It also known as Zero knowledge Rollup. ZK rollup accepts transactions in bundles or thousands of transactions and verifies it by generating SNARK which is also known as validity proof .This all process is done on the sidechain of Rollup doing this will reduce load on main chain.
After generating SNARK it submits transaction to the main chain i.e. layer 1
layer 1 only sees the SNARK i.e. validity proof and again not verifies the transactions because they are already verified in the side chain of rollup and confirms the transactions to be valid.
so by doing validating a block is quicker and because all the mining is done is side chain.
2. Optimistic Rollups :-
This are works completely different from ZK Rollups only similarity is they run on side chain as ZK Rollups .
In this technique instead of verifying the transaction it declares that transaction as valid so no any computation is required in this type of transactions and transaction speed is also increases . According to this project its speed be will 10-100X faster than current processing time.
But there is problem what if transactions are invalid and they are fraud transactions because it not verifying the transactions instead of that it declaring transactions as valid, for that it provides a fraud handling mechanism.
If anyone or beneficiary of the transaction noticed that this transaction is not valid then they can challenge the transaction that if it is proved that if transaction is fraud then the bond related to this transaction will get slashed also who did this fraud transaction will have to pay fine or penalty and transaction is reverted.
But one problem with this roll up is to prove the transaction to be fraud it requires moer time and more gas will be used and this all process has to be done on ethereums main chain ,so all other transactions have to wait until this fraud transaction get determined or transaction could run on slow speed and to prove the transaction is fraud one ethereum blockchain has to keep track of transaction that from where transaction is generated ,after that to which peer or node it is shifted and all information but in ZK Rollups we can skip to save some data because we are verifying the transaction . that is why Optimistic roll up mechanism is somewhat complicated than ZK roll up also space required is more .