Optimism API FAQ

Frequently asked questions about the Optimism API

What is Optimism?

Optimism is a layer 2 (L2) scaling solution for Ethereum. As an L2 solution Optimism operates on top of Ethereum’s mainnnet and because of this can utilize Ethereum’s strong security and support Ethereum dApps. All transactions that occur on Optimism are eventually posted and validated on the mainnet of Ethereum using Optimistic Rollups.

Founded by Jinglan Wang, Karl Floersch, and Kevin Ho in 2019, Optimism continues to grow as an L2 solution that offers higher throughput and reduced expenses compared to Ethereum.

What is the Optimism API?

The Optimism API allows applications to connect to an Optimism node that is part of the Optimism network. Developers can interact with on-chain data and send different types of transactions to the network by utilizing the endpoints provided by the API. The API follows a JSON-RPC standard. JSON-RPC is a stateless, lightweight, remote procedure call (RPC) protocol encoded in JSON.

How can I get started using the Optimism API?

Explained in the Optimism API Quickstart Guide

What type of Layer 2 solution is Optimism?

As a Layer 2 solution, Optimism is an Optimistic Rollup network. Optimistic rollups (ORUs) run parallel to the Ethereum Mainnet. ORUs bundle multiple transactions into one transaction and send them back to the Ethereum Chain. Optimistic rollups assume all transactions are valid unless challenged by a fraud-proof, which makes the chain extremely scalable.

Is Optimism EVM-compatible?

Yes! Optimism is fully compatible with all Solidity smart contracts and Ethereum libraries. As Optimism acts as a second layer operating on top of the main Ethereum network, it can utilize the Ethereum Virtual Machine just like Ethereum.

What is the Optimistic Virtual Machine (OVM)?

The Optimistic Virtual Machine (OVM) is an EVM-compatible virtual machine that executes transactions “optimistically,” which means it relies on the L1 chain to arbitrate disputes concerning the correctness of state transitions using fraud proofs.

How do I add Optimism to MetaMask Mainnet?

Adding Optimism to the Metamask takes four steps:

  1. Create a free Alchemy account
  2. Create an API key
  3. Choose custom RPC in Metamask
  4. Fill in the Optimism network details

What testnet should I use for Optimism?

Developers should use the Optimism Goerli testnet and a Goerli faucet to get test ETH when testing Optimism applications.

If you sign in to your Alchemy account, you’ll get 5x more ETH. On Goerli, developers can get 0.05ETH every 24 hours, and use that on the testnet to make sure their applications are working properly before putting them on the Optimism mainnet.

How do I build an app on Optimism?

To start building a dApp on Optimism, sign up for Alchemy and log in. Then click the “Apps” tab and “Create App”, and you’re ready to build your new app on the Optimism mainnet!

How do you bridge Optimism to Ethereum?

You can find a number of bridges to use on the Optimism site. To use one of these bridges, connect your Metamask wallet to send and receive tokens between Optimism and Ethereum. Cross-chain bridges are instrumental components of the multi-chain future of blockchain.

What wallets can be used on Optimism?

Many Web3 wallets can be used on Optimism. As Optimism continues to grow, it supports many of the most popular wallets. Some wallets that people choose to use on Optimism include Metamask, Ledger Nano X, and SafePal S1.

What does Optimism use for gas?

Optimism uses ETH tokens for gas, and because Optimism transactions are bundled using Optimistic Rollups, the gas costs to complete the transaction on the Optimism network are usually cheaper than native transactions on Ethereum.

What projects are on Optimism?

Some of the most popular dApps on Optimism include Perpetual, Lyra, Synthetix, and Synapse.

Perpetual is a DeFi dApp that allows users to exchange perpetual contracts. Lyra, one of the first Dapps built natively on Optimism, is a crypto options exchange. Synthetix is a DeFi protocol built for trading derivatives trading, and Synapse is a cross-chain protocol for swapping assets between blockchains.

How do you withdraw ETH from Optimism?

Withdrawing ETH from Optimism takes three easy steps: go to The Optimism Gateway, enter the amount you would like to remove from the network, and click “Withdraw”. Because Optimism uses fraud poofs, it takes 7 days for withdraws to Ethereum to be completed.

What API does Optimism use?

Optimism uses the JSON-RPC API standard. The Optimism JSON-RPC API serves as the backbone for the Optimism network and powers any blockchain interaction.

In aggregate, this API suite allows users to read block/transaction data, query chain information, execute smart contracts, and store data on-chain. Developer interacts with Optimism’s base JSON-RPC APIs to communicate with its decentralized network of nodes.

What is an Optimism API key?

When accessing the Optimism network via a node provider, API providers like Alchemy require developers to use an API key to query the blockchain.

For the best development experience, we recommend that you sign up for a free API key! With a dedicated API key, developers can:

  • access higher request throughput and increased concurrent requests
  • query enhanced APIs, gaining access to free archive data, logs, and API abstractions
  • Leverage individualized usage metrics

Which libraries support Optimism?

Three libraries support Optimism, including Alchemy-web3, Web3.js, and Ethers. Of these three, Alchemy is an improvement over Web3 and Ethers libraries, providing enhanced API calls, upgraded WebSockets, and many other benefits.

What programming languages work with Optimism?

Many programming languages work with Optimism including Go, Javascript, Solidity, Typescript, and Shell. Javascript and Solidity are some of the best languages to use, Solidity for smart contracts and Javascript for off-chain requests.

Before you get started, update your Optimism RPC URL to Alchemy.

What methods does Alchemy support for the Optimism API?

You can find the list of all the methods Alchemy support for the Ethereum API on the Optimism API Endpoints page.

My question isn't here, where can I get help?

Don't worry, we got you. Check out our feel free to post in discord with any questions you have!