How to Start Developing on Arbitrum
Written by Alchemy
Reviewed by Brady Werkheiser
Arbitrum is an Ethereum layer-2 blockchain that uses optimistic rollups to provide developers with greater scalability and lower gas costs than running dapps on Ethereum's base layer blockchain while benefiting from Ethereum's layer 1 security.
If you're interested in learning how to develop Arbitrum, this article will be perfect for you! In this guide, we will walk you through the steps necessary to start coding on the Arbitrum network.
What Is Arbitrum?
Arbitrum is a layer-2 optimistic rollup blockchain that helps to scale the main Ethereum chain while remaining trustlessly secure. While it is based on Ethereum's Virtual Machine (EVM), Arbitrum offers a unique design that makes it much more scalable and user-friendly than the Ethereum network.
In addition, Arbitrum smart contracts are EVM-compatible meaning they work with existing Ethereum tooling, wallets, and dapps. Arbitrum was created as one of the Ethereum scaling solutions available to create low cost smart contracts and to address long transaction times.
The Arbitrum Virtual Machine, which runs on ArbOS, helps act as a record-keeper, traffic cop, and enforcer for the execution of smart contracts on the Arbitrum chain.
How to Start Developing on Arbitrum
Before you start developing on Arbitrum, it is important to understand how the blockchain works and configure a few prerequisites:
Hardhat
An Alchemy account
A web3 wallet (E.g. MetaMask, Apex, etc.)
1. Understand How Arbitrum Works
Before you start developing on Arbitrum, it's important to have a good understanding of how the platform works. You can read the Arbitrum Whitepaper to learn more about the technical details.
According to Offchain Labs, the team who created and maintains Arbitrum, the architecture of Arbitrum is as follows: Users and service providers are part of the off-chain on the left, and the Arbitrum system consists of Layer 1 and Layer 2 on the right.
Arbitrum is a layer-2 rollup solution (green) that sits on top of Layer-1 Ethereum chain (orange).
In addition, the Arbitrum team has created several resources to help developers get started, including an overview of the platform and a step-by-step guide to creating your first smart contract.
2. Download Hardhat (Integrated Development Environment)
There are two ways to develop on Arbitrum: using the online IDE or by setting up a local development environment. Either way, you’ll need to choose and configure an IDE for Solidity development before you start.
For this article we will build with Hardhat, a local development environment. Once you're done with installing Hardhat, create a Hardhat project.
3. Create An Arbitrum App on Alchemy
To deploy a smart contract, you will need an Arbitrum RPC node. Fortunately, you don't need to run your own Arbitrum node, instead you can sign up for Alchemy for free and create an app on the Arbitrum-Goerli testnet.
Once you're signed up, here's what to do:
Click on the Dashboard
Click "Create App"
Pick a name for your app
Select the Arbitrum Nitro Goerli testnet.
Then click "Create App"
Your app should appear in the Alchemy Dashboard.
4. Get Fake ETH from the Goerli Faucet
In order to interact with Arbitrum contracts on the Arbitrum-Goerli testnet, you'll need some test ETH and an Arb-Goerli RPC endpoint.
The easiest way to get Goerli ETH is from a faucet.
Go to the Goerli faucet
Enter your Ethereum address
You should receive Goerli ETH in your MetaMask wallet in a few minutes
To check if you've received the ETH from the faucet, go into the MetaMask settings, and under Advanced, select "Show test networks".
If you're using the Goerli faucet that's compatible with the Arbitrum Nitro Testnet, here is how to bridge Goerli tokens to Arbitrum Nitro.
5. Write, Compile, and Deploy Your Smart Contract
At this point, you will be able to start writing your smart contract. Follow the steps in the Alchemy docs to build a simple "Hello World" smart contract. You can also follow this Hello World video tutorial on how to write, compile, and deploy the "Hello World" smart contract. This github repo contains all the scripts covered in the video.
Once you're done writing your contract, compile it using Hardhat, connect to an Ethereum client (Ganache or Geth), and use the hardhat deploy command to deploy your contract.
If you want more inspiration, be sure to take a look at the Offchain Labs GitHub monorepo for demo examples such as a Pet Shop dapp and an Election dapp.
6. Interact With and Submit Your Smart Contract to Etherscan
After you've created your smart contract, you'll need to learn how to interact with a smart contract for it to be useful! Watch this video tutorial on how to read and interact with a smart contract.
The video will run you through the following steps:
Create an interact.js file
Update your env. file
Grab your contract ABI
Create a contract instance
Read and update the init message
Once done, you're ready to publish your contract to Etherscan. Watch this video to learn how to verify your contract on Etherscan.
This is done by:
Installing the hardhat-etherscan plugin
Changing the Etherscan config options
Verifying the smart contract on Etherscan
All transactions on Arbitrum can be seen on the Arbitrum block explorer.
7. Integrate Your Smart Contract With a Frontend
Creating and seeing your smart contract being published to Etherscan isn't the end! You'll now need to integrate your smart contract with a frontend interface.
The tutorial will cover these steps:
Cloning the starter files
Check out the starter files
Read from the smart contract
Set up an Ethereum wallet
Connect MetaMask to UI
Implement the updateMessage function
Make your own dApp
Congratulations! You just developed your own simple dApp on Arbitrum! 🎉
Ever since Arbitrum's mainnet launch, a growing number of developers have been building Arbitrum smart contracts on the blockchain, and learning how to develop on Arbitrum is an important step in becoming a well-rounded Solidity developer.
Before launching your smart contract to Arbitrum's mainnet, remember to test your dapp thoroughly on testnets and consider hiring a smart contract auditing company to test your contracts for vulnerabilities.
Related overviews
Learn about ZKsync Era - the EVM-compatible ZK rollup powering Ethereum scaling.
Learn About Where Rollups as a Service Fit In The Ethereum Layer 2 Ecosystem
Definitions, Distinctives, Functions, and a List of Top Optimistic Rollup Tools