web3/web3.js

Create documentation Guide: EVM Chain Support

Closed this issue · 2 comments

The guide explains how Web3.js seamlessly integrates with various EVM-compatible chains. It provides instructions on configuring the Web3 instance with a provider URL, which can be easily found on platforms like Chainlist. The guide also includes examples for popular EVM-compatible L1s and L2s.

As of today, the most popular (based on TVL) L2s are:

  • Base
  • Arbitrum
  • Optimism

Popular EVM-compatible L1s include:

  • Binance Smart Chain (BSC)
  • Avalanche
  • Polygon

Sources:

Here’s an example code for Mantle, but the guide should primarily focus on configuring the provider. It should also highlight new provider options, if relevant, such as QuickNode, PublicNode, and others.

Here are the RPC URLs and example ERC-20 token addresses that I’ve verified to work with basic Web3.js functionality, as described in my Mantle example code above.

const polygon_rpc = "https://polygon.llamarpc.com";
const polygon_rpc_ws = "wss://polygon-bor-rpc.publicnode.com";
// https://polygonscan.com/token/0x2791bca1f2de4661ed88a30c99a7a9449aa84174
const polygon_erc20 = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";

const avalanche_rpc = "https://avalanche-c-chain-rpc.publicnode.com";
const avalanche_rpc_ws = "wss://avalanche-c-chain-rpc.publicnode.com";
// https://snowscan.xyz/token/0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e
const avalanche_erc20 = "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e";

const binance_rpc = "https://binance.llamarpc.com";
const binance_rpc_ws = "wss://bsc-rpc.publicnode.com";
// https://bscscan.com/token/0xe9e7cea3dedca5984780bafc599bd69add087d56
const binance_erc20 = "0xe9e7cea3dedca5984780bafc599bd69add087d56";

const base_rpc = "https://base.llamarpc.com";
const base_rpc_ws = "wss://base-rpc.publicnode.com";
// https://basescan.org/token/0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
const base_erc20 = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";

const arbitrum_rpc = "https://arbitrum.llamarpc.com";
const arbitrum_rpc_ws = "wss://arbitrum-one-rpc.publicnode.com";
// https://arbiscan.io/token/0xaf88d065e77c8cc2239327c5edb3a432268e5831
const arbitrum_erc20 = "0xaf88d065e77c8cc2239327c5edb3a432268e5831";

const optimism_rpc = "https://optimism.llamarpc.com";
const optimism_rpc_ws = "wss://optimism-rpc.publicnode.com";
// https://optimistic.etherscan.io/token/0x0b2c639c533813f4aa9d7837caf62653d097ff85
const optimism_erc20 = "0x0b2c639c533813f4aa9d7837caf62653d097ff85";

After becoming more familiar with web3.js, I’ve realized this guide is no longer necessary. I'm closing this for now.