How to connect to Optimism L2 with Magic

How to connect to Optimism L2 with Magic

#Resources

#Installation

Via Magic SDK, you can connect to Optimism. Optimism is EVM compatible so you can directly follow the Ethereum installation.

#Configure Optimism

#Mainnet

Mainnet Block Explorer: https://optimistic.etherscan.io

const customNodeOptions = {
  rpcUrl: 'https://mainnet.optimism.io',
  chainId: 10,
}

// Setting network to Optimism
const magic = new Magic('YOUR_PUBLISHABLE_API_KEY', { network: customNodeOptions });

#Testnet

Testnet Block Explorer: https://blockscout.com/optimism/goerli/

const customNodeOptions = {
  rpcUrl: 'https://goerli.optimism.io',
  chainId: 420
}

// Setting network to Optimism
const magic = new Magic('YOUR_PUBLISHABLE_API_KEY', { network: customNodeOptions });

Did you find what you were looking for?

How to connect to Optimism L2 with Magic

Did you find what you were looking for?