Sidechains - Crypto Academy / S4W8 - Homework post for pelon53.

in hive-108451 •  3 years ago 

Hello,

This is a homework post for @pelon53 .


Screenshot (933).png


Question : 1

Explain in detail the Sidechains with the use of ZK-Rollups.

Answer :


Sidechains: As the term speaks for itself, it means that sidechains are chains that are not part of the main chain but somehow connected to the main chain. The main purpose of the sidechains is to mitigate the limitation of the main chain by reducing the workload on the main chain.

Sidechains can be beneficial for the blockchain in the following ways:

(1) Scalability(ability to handle the transactions and avoid saturation)

(2) Speed(improves the speed of the main chain as it reduces the workload on the main chain)

(3) Interoperability(make it easy to operate in more than 1 blockchain)

(4) Can be subjected to experiments and tests without disturbing the operations in the main chain.

Examples of the sidechain is:

  • Matic or Polygon(sidechain) of Ethereum, Matic or Polygon was created to reduce the workload on the main Ethereum blockchain.

  • Liquid network(sidechain) of Bitcoin, created for the fast transactions.

Sidechains were developed and created to counter the problems like privacy and scalability faced by the main blockchain.


ZK-Rollups


ZK-Rollups serves as a solution to the problems faced by the developers while placing the 2nd layer on the main blockchain, developers wanted to create a sidechain that is user friendly and requires fewer resources and they find ZJ-Rollups as a solution to their problem.


Sidechains with use of ZK-Rollups


What is ZK-Rollups


ZK-Rollups or Zero-knowledge Rollups is a solution to the layer 2 scalability in a blockchain, it aggregates or bundles all the transfers and validate them faster than the main blockchain and at a lower gas fee than the main blockchain.

By using ZK-Rollups for layer 2 scalability solution, the speed of the main blockchain and scalability can easily increase along with the lower gas fee than the main blockchain. ZK-Rollups are being used with Plasma(scalability method for layer 2 in Ethereum) to establish a layer 2 in the Ethereum blockchain to reduce the workload of Ethereum blockchain.

ZK-Rollups uses the zero-knowledge proof approach to record the validity of the Ethereum blockchain publicly, by using the zero-knowledge approach, a blockchain can reduce the data that is to be held for the validation of transaction and thus leading to less storage space and computational power required to validate a block.


Features of ZK-Rollups


(1) Scalability: scalability plays an important role in a blockchain as it tells us about the capability of a blockchain to handle the transactions, Ethereum blockchain is one of the busiest blockchains because of the introduction of Defi and NFT on its blockchain.

Growing users on the Ethereum platform makes it very hard for Ethereum blockchain to handle all the transactions at once and thus the delay in the various process on the Ethereum blockchain can be seen. To counter this a 2 layer system was introduced and the ZK-Rollups solution was used to overcome the problem of scalability, ZK-Rollups bundles or aggregates several transfers and take them to layer 2 for validation and all these aggregated transfers are counted as 1 transaction, this leads to the removal of unnecessary data and needs less storage space required to save that transaction. It all becomes possible by using Zero-knowledge proof.

(2) Off-chain transactions and Use of Merkel tree: Ethereum blockchain validates block and confirm transactions by using on-chain activities and on the other side ZK-Rollups can validate blocks and confirm and process transactions off-chain also to reduce the workload of the main chain, by doing this ZK-Rollups provide the stability as well as reduces the workload of the main blockchain.

The use of Merkel tree made ZK-Rollups faster than layer 1 of the blockchain as the Merkel tree only contains necessary data related to smart contracts and the remaining data stores off-chain. Data stored in the Merkel tree is asked and accessed for output information very less often than layer 1 thus saving time and computational power involved in the process.

(3) Cost-efficient: Using ZK-Rollups is cost-efficient as the process of validating blocks and processing transactions by ZK-Rollups require less time and processing power than layer 1. Additionally, the transfers are bundled together and considered as a single transaction and making it less costly for every user involved in it.

We can understand it by a daily life example if we order a cab for ourselves only, we have to pay for the whole fare but when we carpool, the fare gets distributed between all the passengers travelling on that cab.


Working of ZK-Rollups


IMG_20211028_213939.jpg

Working of ZK-Rollups, made by me


Working of ZK-Rollups requires two types of users and these users are:

  • Tranasctors

  • Relayers or Certifiers

Transactors are the users that made a transaction and send it to the network for execution. The data that is filled by the transactor is stated below:

  • Sender's address
  • Receiver's address
  • Nonce(a random value generated only once)
  • Amount
  • Network fee

The main thing is the sender and receiver's addresses are shortened to 3-byte indexed addresses to reduce the processing power involved in the process.

Now, smart contracts are used to send the data to the Merkel tree for the recording of the data. Two Merkel data are placed on-chain, one of which stores the address and the other one stores the amount of the transfers.

Now, the role of a certifier comes into action whose role is to certify the transactions. Certifier aggregates a large number of transactions sent to the network and makes a rollup. Now the most important task of a certifier is to make a SNARK proof. SNARK proof serves as a hash function used to represent the delta(∆) of the blockchain state before and after the starting of the process of computation. T0 represents the state before the process of transaction computation, a snapshot is taken of the blockchain state at time T0. The snapshot that is taken at time T0 is then compared to the snapshot taken after the completion of the process of transaction computation, this process is called the SNARK test.

The change in the hash value before(at time T0) and after the process of transaction computation is then sent to the main chain for the verification and computation of the transactions.


Project that uses ZK-Rollups


We have good about the working, advantages and proof that works behind ZK-Rollups, now we will talk about a project that uses ZK-Rollups.

zkSync is the protocol that uses the ZK-Rollups to provide scalability and low gas fee on the Ethereum blockchain. By using zkSync, many problems of the Ethereum blockchain regarding scalability and high gas fee for transferring ETH and ERC20 tokens is solved.


IMG_20211027_173230.jpg

zkSync platform, source


ZkSync uses ZK-Rollups technology to make transactions on layer 2 at a very cheaper rate than layer 1. Along with this, the process of transaction is faster than layer 1 by using ZK-Rollups.

ZkSync supports NFT and DeFi projects making it a very suitable option for the Ethereum blockchain, you can write the contracts as well as buy or sell NFTs by connecting the wallet(Ethereum wallet) with zkSync.

Using ZK-Rollups makes zkSync a secure network too as the Rollups validators can never disclose the state of computation as well as steal the funds and data.


Steps for connecting Metamask wallet with zkSync


  • Click on open wallet.

  • Choose Layer 1 Ethereum wallet.

  • Choose Metamask.

  • Login into Metamask and unlock Metamask.

  • Confirm account and click on next.

  • Connect wallet and you can see your assets in layer 2.


IMG_20211027_173848.jpg

Step1, click on open wallet, source


IMG_20211027_174024.jpg

Step2, Choose Layer 1 Ethereum wallet, source


IMG_20211027_174125.jpg

Step3, Choose Metamask wallet, source


IMG_20211027_174248.jpg

Step4, Login into Metamsk, source


IMG_20211027_174352.jpg

Step5, confirm account and click next, source


IMG_20211027_174455.jpg

Step6, Click on connect, source


IMG_20211027_174545.jpg

Step7, Metamask connected and Layer 2 wallet appears, source


Question : 2

Explain the Liquid Network side chain


Answer :


Liquid network Sidechain

The liquid network is a federated sidechain of the most popular blockchain in the world of cryptocurrency, Bitcoin. This sidechain or network is created for traders as well as exchanges to process faster, confidential bitcoin transactions and issue new assets.


IMG_20211028_174702.jpg

Liquid network platform, source


Who developed Liquid network, Why it was needed and what is the native currency of liquid network?


Developed by: The liquid network was developed by Blockstream, which is a global leader of bitcoin as well as blockchain technology. Blockstream officially launched liquid technology on the 11th of October 2018 to improve the main bitcoin blockchain.

Governance: Governance of the Liquid network is controlled by the federation parties, as I mentioned it is a federated blockchain. Liquid federation members are categorised in:


IMG_20211028_204331.jpg

Liquid federation member, source

IMG_20211028_204706.jpg

Liquid members, source


(a) Exchanges: exchanges like Huobi, Bitfinex, BitMex etc. 21 exchanges are federated members of the liquid network.

(b) Trading desks and brokerages: Trading desks like Autonomy and Bitcoin reserve is listed in the federated members of the liquid network. There are 16 brokerages, federated members, on the liquid network.

(c) Infrastructure: Cryptogarage and INX are listed as federated infrastructure devs on the liquid network. There are 14 infrastructure federated members on the liquid network.

(d) Wallets: Wallets like Ledger and Open node are federated members of the liquid network. There are 6 wallets and payment federated members on the liquid network.


Need of liquid network:


To mitigate the shortcomings of the bitcoin blockchain and to increase the efficiency of the bitcoin blockchain, the liquid network was launched as a federated sidechain of the bitcoin blockchain.

Problems like block generation time of bitcoin(10 minutes or probabilistic), liquidity and privacy can be seen in the bitcoin blockchain and to remove these problems the liquid network was launched as the federated sidechain of the bitcoin blockchain.


Native currency of the liquid network


IMG_20211028_205322.jpg

Assets supported on Liquid network platform, source


The native currency of the liquid network is L-BTC, which is also called liquid Bitcoin, its value is pegged to the real value of a bitcoin.

Assets that are supported on the liquid network are L-BTC, USDT and the asset a user want to issue.


Features and Advantages of the Liquid network


Features and advantages provided by the liquid network are:


IMG_20211028_204923.jpg

Features of the Liquid network platform, source

IMG_20211028_205158.jpg

Features of the Liquid network platform, source


(A) Interoperability: As I mentioned above that new assets can be issued on the Liquid Network, so these assets can also use atomic swaps and Bitcoin-style multi-sig. It can be achieved using the liquid network and issuance of assets on it.

(B) Speed: As we all know that the block generation time of the Bitcoin blockchain is 10 minutes or probabilistic and thus processing the final settlement of transactions in 10 minutes or more. But by using the liquid network that produces its block every minute, the process of settlement of transactions can become faster.

(C) Confidential Transactions: By using the liquid network, the user can hide the amount of asset transacted as well as the asset type. The above information will not be shown to anyone on the public ledger, only the parties involved in the transaction can see the amount of the asset transacted and the asset type. It helps in increasing the privacy of the users on a blockchain.

(D) Issuance of new assets in the liquid network: New assets can also be issued on the liquid network provided that the assets are being issued correctly by a user. This will lead to an increase in interoperability as well as the growth of the platform.


Working involved in the Liquid network


The liquid network is a federated sidechain of the bitcoin and thus it doesn't need Proof of work consensus, instead, the liquid network uses a consensus called Strong federation. All the actions ate the result of a consensus among distrusting participants, called Functionaries.

Now, these distrusting participants or Functionaries are responsible for the jobs of the blocksigners(operates the liquid network) and Watchmen(secure the held bitcoins on the liquid network).

The Liquid network generates its own block instead of using Bitcoin blocks and thus generates a block every minute, the role of the blocksigners is to sign a block and track it. Blocksigners also take care that the block that can lead to reorganised of several blocks must not be signed. The parent block of the signed block must not reorganise from the longest chain and this is the reason why transactions on the liquid network need only two confirmations and the process of settlement of transactions is faster than the bitcoin blockchain.

Quorum of the liquid network to sign a block: To validate a block under the liquid federated model, 2/3rd of the blocksigners must sign the block.

If more than 1/3rd blocksigners are offline then the process of validating and signing blocks can not happen and the blocks will not get signed thus resulting in freezing of the liquid network blockchain.


IMG_20211028_212405.jpg

Working of the Liquid network platform, source


Peg-in(BTC to L-BTC)


It is the process through which the BTC can be converted into L-BTC. The user who wants to get L-BTC in return for BTC will send his/her asset to the bitcoin blockchain or the address of liquid client software and then creates a Peg-in transaction. 102 confirmations are required to change the BTC into L-BTC. After the 102 confirmations, the user can see the same amount of L-BTC in his/her liquid wallet which he went on the bitcoin blockchain or liquid client software address.


Peg-out(L-BTC to BTC)


Peg-out is the reverse process of Peg-in, in this process, the liquid asset is moved back to the bitcoin blockchain, as the watchmen are responsible for the security of held bitcoins in the liquid network, watchmen process these transactions. It usually takes 11 minutes to 35 minutes considering traffic in blockchain.


Disadvantages of Liquid network side-chain


(1) Centralised nature: As I mentioned above that the liquid network is a federal side chain and is controlled by federal members of the liquid networks. The control is all in the hands of the federation making it a centralised platform.

(2) Trust questions: For the security and safety of our funds we are relying on the watchmen, a part of the federation, in the process of Peg-in, we send our BTC to the address of liquid client software and we have to completely trust watchmen to take care of our funds which is not good, we must control our assets or funds.


So I have stated all the features/advantages, working, governance, Federation members and the assets used on the platform with the help of the Liquid network platform and I explored the Liquid network platform too and told about the main features in it in the above answer.


Question : 3

Describe the steps to connect the Metamask wallet and the Polygon network wallet. Show screenshots.

Answer :


For this question, we need to have a metamask account and after that, we connect it to polygon wallet. Let us see step by step how to do this.


Creating Metamask Wallet


First, we need to add metamask extension to our browser and later we need to create an account on Metamask. To do this please follow these steps :

(1) Go to the google chrome web browser and search for MetaMask. Now, click on the Metamask icon.


1.png

Step 1, Search for Metamask Extension on Chrome Browser Source


(2) Once you click, you now need to click on Add to Chrome option.


2.png

Step 2, Click on ADD option to add extension to your browser Source


(3) After clicking, it will take some time to download and install. Once this process is done you see on the screen that your extension is added to your browser.


3.png

Step 3, Metamask extension is added to browser Source


(4) When your extension is installed it automatically opens and you see a screen like this:


4.png

Step 4, Click on get started to make a Metamask Wallet


(5) Now click on get started and later on create wallet option.


5.png

Step 5, Click on create wallet


(6) On the next screen click on I Agree option.


6.png

Step 6, Click on I agree option


(7) On this step you are asked to create a password for your Metamask Wallet. After filling in your password click on Create option.


7.png

Step 7, Creating Password


(8) Now you get the secret code for your wallet, please note it down because you need to fill it in the next step.


8.png

Step 8, Copy your secret key


(9) In this step you need to fill in the password from the previous step. Fill in the secret code and click on confirm.


9.png

Step 9, Fill your secret key


(10) Once you are done with filling in the secret password your wallet is created. Congratulations!!!


10.png

Step 10, Your wallet is created


Hence, our Metamask wallet is created. You can create your wallet easily by following these steps. Now, we see how to connect polygon wallet with Metamask wallet.


Connecting Polygon Wallet to Metamask Wallet


To connect polygon wallet with metamask wallet follow these steps :

(1) First, we go to polygon website. Click here Polygon Website. On the homepage click on Polygon wallet.


1.1.png

Step 1, Click on Polygon Wallet Source


(2) In this step you see different ways to connect wallet. We select Metamask option and click on it.


1.2.png

Step 2, Click on Metamask Wallet Option Source


(3) Now you need to fill in the password for your Metamask Wallet that you just created. After filling password click on unlock option.


1.3.png

Step 3, Fill in your Metamask wallet password Source


(4) Now you need to select your account in metamask and click on next.


1.4.png

Step 4, Click on Next option Source


(5) Once you click on next you now get a signature request for connecting wallet. Click on Sign option to connect wallets.


1.5.png

Step 5, Click on Sign to sign Source


(6) Your Polygon wallet and Metamask wallets are now connected. Congratulations !!!


1.6.png

Step 6, Polygon Wallet is connected with Metamask Wallet Source


So, by following these steps you can easily create a Metamask wallet and connect your Polygon wallet with Metamask wallet.


Question : 4

According to the polygonscan block explorer, when will the block 25,000,000 be generated? Show screenshot. Explore the 12,000,000 block, at that time, what was the price of the Matic? Show screenshots.

Answer :


For this question, we need block explorer for Polygon. So, I search Polygonscan block explorer on my browser and click on the first link. In this way, you can find Polygonscan website Block Explorer for Polygon.


5.1.png

Searching for Polygon Block Explorer Source


5.2.png

Polygon Block Explorer Website Source


On this site, you get all the information about the blocks of the polygon. You just need to search the block number and you will get all the details about that particular block.


When will the block 25,000,000 be generated?


To find the answer to this question, we need to search for the block number in the search box of the polygon block explorer site. I write the block number in the search bar and search for the block.


5.3.png

Searching for block number 25,000,000 on Polygon Block Explorer Website Source


When I click on the search icon I get to know that Block Number 25,000,000 is expected to be generated on Sunday, 20 Feb. 2022 at 00:57:15 UTC.


5.4.png

Details of block #25,000,000 on Polygon Block Explorer Website Source


This block number is expected to be generated in approx 116 Days, 7 hours, 59 minutes, 35 seconds at the time I am writing this homework task. The latest block that is generated at the time I am doing homework is #20629881.

If you want to get notified when this block number 25,000,00 is generated you can turn on the notification bell for an alert, which can be seen in the bottom part of the picture.


Block #12,000,000


To find the details about block number 12,000,000. We first go to polygon block explorer site Block Explorer for Polygon. Now we need to search for block number #12,000,000 in the search box to get details about the block.


5.5.png

Searching for block number 12,000,000 on Polygon Block Explorer Website Source


Once we search block number #12,000,000 in the search box we get details about the block. We get to know about details like timestamp at which block created, number of transaction in block, block reward of block, difficulty, total difficulty, gas used, Matic price at the time of creating block, hash, and many more.


5.6.png

Details of block number 12,000,000 on Polygon Block Explorer Website Source


As you can see in the picture from block explorer of polygon, the details of block number #12,000,000. Following are details we get about block :

MATIC Price: $0.38 / MATIC

Block Height: 12000000

Timestamp: 226 days 2 hrs ago (Mar-14-2021 09:35:48 AM +UTC)

Transactions: 14 transactions and 0 contract internal transactions in this block

Validated by:

0x7fcd58c2d53d980b247f1612fdba93e9a76193e6 in 6 secs

Block Reward: 0.00877199352 MATIC

Difficulty: 15

Total Difficulty: 99,921,518

Gas Used: 3,022,128 (15.11%)

These are all the details of block number 12,000,000 that we get when we search for block on the polygon block explorer site. You can see more details of the block when we click on the more details option shown at the bottom of the picture :


5.7.png

Clicking more details option for block number 12,000,000 on Polygon Block Explorer Website Source


Once you click on more details option in bottom you get some more details about the block. The following details we get after click on this more details option.


5.8.png

More details of block number 12,000,000 on Polygon Block Explorer Website Source


From the picture above we get some more details about the block.

MATIC Price: $0.38 / MATIC

Hash:

0x54c6805f441801ea05620f26950ca70c401e1642ab27f76d5097f9f500689965

Parent Hash:

0x3592bd9a6a5ad7f855d5c1fca02c8d4ac8b5e24f99af3c6706beba0b37222ce7

Sha3Uncles:

0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347

At the time when block number #12,000,000 is created the price of 1 MATIC is $0.38 and current price of 1 MATIC is $ 1.78 The price of MATIC asset now is approx 4.6 times the price during the creation of block number #12,000,000 .


Conclusion


The everyday increasing popularity of crypto assets in the world has made crypto projects and blockchains work on them so that they can handle the newcomers in the crypto world. For this many blockchains work on their scalability, privacy, security and interoperability. This growing popularity has made developers work on the project and handle the scalability problem by introducing layer 2 on a blockchain or sidechains.

ZK-Rollups are now being used in the Ethereum blockchain with Plasma technology to decrease the workload on the Ethereum blockchain and to make Ethereum blockchain more scalable. ZK-Rollups uses smart contracts, Merkel tree, SNARK proof and Zero-knowledge proof for validating a transaction and sending it to the main layer, later 1. The introduction of layer 2 in the Ethereum blockchain was very necessary as Ethereum blockchain supports DeFi and NFTs too and all this puts so much workload on the main chain of Ethereum.

Bitcoin is also using the Liquid network, by using the liquid network the bitcoin blockchain was able to increase its efficiency in terms of scalability, speed, security, interoperability and privacy. But it has its limitation and that is the use of federated blockchain which makes it a centralised platform.

I have also connected my Metamask wallet with the Polygon network wallet and checked Polygonscan block explorer to find the generation time of block 25,000,000. I also explored polygonscan explorer to find the price of Matic at the time of block 12,000,000.


Thank you !!!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
Loading...

#club5050 😀

#club5050 😀