Ethereum has been facing a long prolonged history of being slow and too expensive to use. Layer 2 scaling solutions like Optimisistic rollup come into play here to solve these issues. Arbitrum is among the first L2 solutions for Ethereum to hit the mainnet. Furthermore, it follows an optimistic rollup. As a result, Arbitrum makes the transaction much cheaper on Ethereum.
Also, read Rollups โ Layer 2 Scaling | Is it the Next Big Thing?
Working of Arbitrum
Smart contract developers prefer using Arbitrum instead of Ethereum. The following are the benefits of using Arbitrum:
- Trustless security: The security of Arbitrum is associated with the Ethereum blockchain.
- Scalability: Arbitrum allows higher throughput to make the network faster.
- Cost reduction: Arbitrum aims to minimise the transaction cost.
- Compatibility with Ethereum: It means if you have something running on the Ethereum mainnet, you can deploy it to Arbitrum without any changes.
Arbitrum gives the freedom of using any solidity version and language for the development of Dapps.
There are three main components of Arbitrum’s design-
- The Compiler
- The EthBridge
- The Validator
Arbitrum works on the same principle as Opmistic rollup: as long as one of the validators is honest, the network will run fun, and dispute resolution occurs in case of any dispute.
Let’s Dive into the Bigger Picture
Nowadays, Decentralized Applications (Dapps) are not about a single contract. Instead, a group of contracts makes up a Dapp. An Arbitrum Compiler takes this group of contracts, compiles them, and runs it on an Arbitrum Virtual Machine (AVM). A separate virtual machine (VM) is designed to reduce the footprint on-chain and make the system faster.
The EthBridge, as the name suggests, is used as a bridge between Ethereum and Arbitrum. For example, You can call the EthBridge to interact with Arbitrum for sending ETH or other tokens to Arbitrum VM. A demonstration to bridge asset using Arbitrum and Uniswap is discussed below. The job of EthBridge also comes in handy while solving disputes between validators.
The most crucial component of an Arbitrum Network is the validator. The dapp creator chooses the validators, and every VM has its own validators. A VM validator always knows the current state of the VM. In most cases, the validator is on the same line as VM. The validator validates the new state hash, and Ethbridge is then responsible for keeping track of each state’s hash.
In case if the validator is malicious or dishonest, Arbitrum optimizes its dispute resolution activity. So basically, all validators are required to stake some amount of Ether in the EthBridge. If the validators try to make a disputable assertion or raise a fake dispute towards a valid transaction, the stake pool of the validator is forfeited. This dispute-solving design is quite effective.
Some of the notable projects launched under Arbitrum are Uniswap, Aave, Augur, Sushi, etc. Artitrum has also partnered with Reddit. They will be focusing on establishing a separate rollup chain that will allow Reddit to scale its reward system.
Let’s witness how fast and cheap the transactions are on Arbitrum by following the below demonstration.
Bridging Assets using Arbitrum and Uniswap
This tutorial assumes that you have a Metamask wallet installed in your system.
Step 1: Get Ether
For demonstration purposes, test Ether will be used (so that we don’t lose any real funds), provided by the Rinkeby Test network. Click here to get Ethers, post the Ethereum address on Twitter and then copy the tweet link and paste it in the required field. The account will soon be credited with the promised Ether.
Fig: Rinkeby Faucet
Step 2: Bridging Arbitrum
Visit Arbitrum. A Metamask notification will pop up, “Confirm” that. Now we will transfer funds from Layer 1 to Layer 2.
First, we will enter the amount of ETH that we want to deposit. (Make sure you are using the “Rinkeby Test Network”.Here, I am depositing 3ETH.
First, the layer 1 transaction takes place, and then Layer 2. It takes a few minutes for the Layer 2 transaction to get confirmed.
We can also use the bridge to transfer funds from layer 2 back onto Layer 1, but it takes up to about seven days. On the testnet, it’s just a single day, but on Mainnet, it takes around seven days. Essentially this happens because the validator nodes should have enough time to validate the funds and raise a dispute against any malicious activity. This period is essentially known as Challenge Period.
Step 3: Switching to Arbitrum Network on Metamask
Click on the “Add/ Switch to Arbitrum Network”. A metamask notification will pop, “Approve” that.
In the Network list, you will see a new Network ” RinkArby”. This is a Layer 2 network. The previous one that is “Rinkeby Test Network”, is a Layer 1 network.
As you switch to the “RinkArby” network, you will see the ETH you transferred, meaning that you have successfully transferred a few amounts of ETH from Layer 1 to Layer 2.
Hence, one part of the tutorial is done. You have bridged your asset from Layer 1 to Layer 2. Now, let’s get into the part where you can swap one cryptocurrency for another on Uniswap using Arbitrum.
Step 4: Layer 2 swap using Uniswap
Before we go further, let’s understand what Uniswap is.
Uniswap is a Decentralized Exchange (DEX) platform built on top of Ethereum. Uniswap allows us to trade ERC-20 tokens. A hundred of thousands of traders trade on Uniswap each day. You can also use Uniswap’s ecosystem to build applications. Uniswap’s native token is “UNI”.
Uniswap follows the Constant Market Maker Model. This model follows a simple formula of “X*Y=K”. This means when trading ETH for any other cryptocurrency, for example, DAI, the amount of ETH available times the amount of DAI available on Uniswap’s ETH/DAI liquidity pool should always be a constant number.
Visit Uniswap. Connect your Metamask wallet and the RinkArby Network.
Please enter the amount of ETH you want to swap and select the token you want to swap it for. For example, I am choosing DAI in this tutorial.
In the figure above, I am swapping 0.005ETH, which amounts to 28606700000 DAI. As soon as you “Confirm Swap”, a Metamask notification will pop “Confirm” that. And you will also notice that the gas price is low.
You can also add DAI to your wallet by confirming the Metamask notification that asks whether you want to add the token to your wallet.
View the transaction history on Etherscan.
That’s all about Arbitrum and bridging assets using Arbitrum.
Also, read