Skip to content
PenyuOnCore
Menu
  • Home
  • Core Ecosystem Analysis
  • Personal Finance & Investing
  • Make Money Online
  • Bitcoin
  • About Us
Menu
ethers.js v6 with Core blockchain graphic showing a JsonRpcProvider code snippet pointing to rpc.coredao.org and Core chain ID 1116

How to Use ethers.js with Core Blockchain (v6 Guide, Chain ID 1116)

Posted on November 20, 2026

Short answer: To use ethers.js with Core, create a provider with new JsonRpcProvider("https://rpc.coredao.org", 1116, { staticNetwork: true }), then use it with Contract for reads and a Wallet or BrowserProvider signer for writes. Core works with ethers v6 like any EVM chain. The main surprise is fees: Core blocks report a base fee of 0, so ethers v6 sends legacy (type 0) transactions with gasPrice by default.

This guide shows how to use ethers.js with Core blockchain (mainnet chain ID 1116) step by step. We ran every snippet on 20 November 2026 (between about 05:20 and 05:30 UTC) with ethers 6.17.0 on Node.js 24 against Core’s public RPC. All reads hit mainnet. The write examples ran only on a local Anvil fork, and the “mainnet” signer was an unfunded random wallet that never sent anything. If you prefer viem, see our viem with Core guide.

What you need

  • Node.js 18 or newer, plus a project with "type": "module" (or save files as .mjs) so top-level await works.
  • The Core endpoints from the official RPC list: https://rpc.coredao.org (HTTP), wss://ws.coredao.org (WebSocket) and https://rpcar.coredao.org (archive). Testnet2 is chain 1114 at https://rpc.test2.btcs.network, according to Core’s network config page.
  • For writes, CORE for gas. On testnet, use the faucet.
npm init -y
npm i ethers
npm ls ethers        # ethers@6.17.0 in our test

Connect ethers.js with Core using JsonRpcProvider

import { JsonRpcProvider, formatEther } from 'ethers'

const provider = new JsonRpcProvider(
  'https://rpc.coredao.org',
  1116,
  { staticNetwork: true }
)

console.log((await provider.getNetwork()).chainId)  // 1116n
console.log(await provider.getBlockNumber())        // 40612625 at test time

const block = await provider.getBlock('latest')
console.log(block.gasLimit, block.baseFeePerGas)    // 50000000n 0n

const WCORE = '0x191E94fa59739e188dcE837F7f6978d84727AD01'
console.log(formatEther(await provider.getBalance(WCORE)))  // 442435.42... CORE

Two settings matter here:

  • Pass the chain ID (1116). ethers v6 has no built-in name for Core. When we let it auto-detect, getNetwork() returned name: "unknown" with chainId: 1116n. That works, but passing 1116 makes your intent clear and catches a wrong URL early.
  • staticNetwork: true tells ethers not to call eth_chainId again to check the network. The JsonRpcProvider docs say to use it only when the network can’t change, which is true for a fixed RPC URL. It is not safe for a browser wallet, because users can switch chains.

All numbers come back as bigint (note the n). Format them with formatEther or formatUnits before you display them. Call provider.destroy() at the end of a script so Node can exit cleanly.

Read an ERC-20 token with Contract

ethers v6 accepts human-readable ABIs, so you don’t need a JSON file for standard calls. Here is USDT on Core. Check the address on Core Scan before you use it.

import { Contract, formatUnits } from 'ethers'

const USDT = '0x900101d06A7426441Ae63e9AB3B9b0F63Be145F1'
const abi = [
  'function symbol() view returns (string)',
  'function decimals() view returns (uint8)',
  'function totalSupply() view returns (uint256)',
  'function balanceOf(address) view returns (uint256)',
  'event Transfer(address indexed from, address indexed to, uint256 value)'
]
const usdt = new Contract(USDT, abi, provider)

const [symbol, decimals, supply] = await Promise.all([
  usdt.symbol(), usdt.decimals(), usdt.totalSupply()
])
console.log(symbol, decimals, formatUnits(supply, decimals))
// USDT 6n 558628.005254

Two v6 details trip people up. decimals() returns 6n (a bigint), not the number 6. formatUnits accepts it, but math like 10 ** decimals will throw unless you convert it with Number(decimals). Also, USDT on Core has 6 decimals, so use parseUnits(amount, 6), never parseEther.

Query past events with queryFilter

const head = await provider.getBlockNumber()
const events = await usdt.queryFilter(usdt.filters.Transfer(), head - 1000, head)
console.log(events.length, events[0]?.args.value)   // 148 2566631n in our run

In our test, a 10,000-block range worked on the public RPC. Still, keep ranges small and loop in chunks for long histories. If the node rejects a range, split it into smaller chunks. For many reads in one call, use Multicall3 on Core.

How ethers v6 handles gas fees on Core

This is the part most tutorials skip. We called getFeeData() on mainnet:

const fee = await provider.getFeeData()
console.log(fee.gasPrice, fee.maxFeePerGas, fee.maxPriorityFeePerGas)
// 60000000000n null null

The gas price was 60 gwei, but both EIP-1559 fields were null. In the ethers source, getFeeData only computes maxFeePerGas when block.baseFeePerGas is truthy. Core’s latest block reported 0n, so that check fails. The signer then treats Core as a non-EIP-1559 chain. We checked this by populating (not sending) a transaction from an unfunded random wallet:

import { Wallet } from 'ethers'

const wallet = Wallet.createRandom(provider)   // throwaway, holds nothing
const tx = await wallet.populateTransaction({ to: wallet.address, value: 0n })
console.log(tx.type, tx.gasPrice, tx.gasLimit, tx.chainId)
// 0 60000000000n 21000n 1116n

So by default, ethers v6 builds a type 0 legacy transaction with the node’s gas price and chain ID 1116 (EIP-155 replay protection). That is fine on Core. If you want a type 2 transaction, set type: 2 with maxFeePerGas and maxPriorityFeePerGas yourself. ethers populated that without complaint in our test. Because the base fee is 0, a type 2 transaction effectively pays its priority fee, so setting both fields to the current gas price is a simple choice. Read fees fresh at send time; 60 gwei was a snapshot, not a constant.

Flowchart showing ethers v6 getFeeData on Core returning a 60 gwei gas price with null EIP-1559 fields because the base fee is 0, leading to a default legacy type 0 transaction or an opt-in type 2 transaction

Send transactions with a Wallet signer

We ran this against a local fork (anvil --fork-url https://rpc.coredao.org) using Anvil’s public dev key, so no real funds moved. To set one up, see how to fork Core mainnet with Anvil. On mainnet, load your key from an environment variable and never commit it.

import { JsonRpcProvider, Wallet, Contract, parseEther } from 'ethers'

const provider = new JsonRpcProvider(process.env.RPC_URL)  // fork or Core RPC
const wallet = new Wallet(process.env.PRIVATE_KEY, provider)

// 1. Send native CORE
const tx = await wallet.sendTransaction({ to: '0xRecipient...', value: parseEther('1') })
const receipt = await tx.wait()
console.log(tx.type, receipt.status)          // 0 1 on our fork

// 2. Write to a contract (wrap CORE into WCORE)
const wcore = new Contract(
  '0x191E94fa59739e188dcE837F7f6978d84727AD01',
  ['function deposit() payable', 'function balanceOf(address) view returns (uint256)'],
  wallet
)
await wcore.deposit.staticCall({ value: parseEther('2') })   // simulate first
const dep = await wcore.deposit({ value: parseEther('2') })
await dep.wait()

On the fork, both transactions were type 0 with status 1, and the wallet ended with 2.0 WCORE. Calling .staticCall() first runs the call without sending it. That catches reverts before you pay gas. Note that Anvil sets its own fee values on a fork (it reported a 1 gwei gas price for us), so don’t copy fork fees to mainnet.

Connect a browser wallet with BrowserProvider

In v6, ethers.providers.Web3Provider became BrowserProvider, as the v6 migration guide explains. Core’s official dApp tutorial still uses the v5 syntax, so translate it like this. We did not run this snippet in a browser, so treat it as a template:

import { BrowserProvider } from 'ethers'

const provider = new BrowserProvider(window.ethereum)
try {
  await provider.send('wallet_switchEthereumChain', [{ chainId: '0x45c' }])
} catch (e) {
  // 4902 = chain not added yet in MetaMask
  await provider.send('wallet_addEthereumChain', [{
    chainId: '0x45c', chainName: 'Core Blockchain Mainnet',
    nativeCurrency: { name: 'CORE', symbol: 'CORE', decimals: 18 },
    rpcUrls: ['https://rpc.coredao.org'],
    blockExplorerUrls: ['https://scan.coredao.org']
  }])
}
const signer = await provider.getSigner()

Users can also add the network by hand. See how to add Core to MetaMask.

Listen for live blocks and events over WebSocket

import { WebSocketProvider, Contract } from 'ethers'

const ws = new WebSocketProvider('wss://ws.coredao.org')
ws.on('block', (n) => console.log('new block', n))

const usdtLive = new Contract(USDT, abi, ws)
usdtLive.on('Transfer', (from, to, value, ev) => {
  console.log(from, to, value, ev.log.transactionHash)
})

In our test, wss://ws.coredao.org reported chain 1116 and delivered a new block about every 3 seconds. We also opened a raw eth_subscribe("logs") subscription for two minutes. It delivered 64 logs, while an HTTP getLogs over the same window returned 65. The one-log gap is most likely just where the two windows started and stopped. USDT transfers are bursty: in one 2.5-minute window, no Transfer events happened at all. A silent listener doesn’t always mean a broken one. For production, add reconnect logic, because WebSocket connections can drop.

Common gotchas

  • “network does not support ENS”: resolveName('vitalik.eth') threw UNSUPPORTED_OPERATION on Core. Use plain 0x addresses.
  • v5 code: BigNumber, ethers.utils.* and contract.callStatic are gone in v6. Use bigint, top-level helpers like formatUnits, and contract.method.staticCall().
  • Wrong chain: chain 1115 is the old, decommissioned testnet. Use 1114 for testing.
  • Batching errors: ethers batches JSON-RPC calls by default. If a node returns odd errors, try { batchMaxCount: 1 }.

FAQ

Does ethers.js support Core blockchain?

Yes. Core is EVM-compatible, so the standard v6 JsonRpcProvider, Contract and Wallet classes work. ethers has no named preset for Core, so pass chain ID 1116 and the RPC URL yourself.

Should I use legacy or EIP-1559 transactions on Core?

ethers built both types in our populate tests (we did not broadcast either on mainnet). ethers v6 picks legacy (type 0) by default because Core blocks report a 0 base fee. If you set type: 2, provide both fee fields yourself.

What is the Core WebSocket URL for ethers?

Mainnet: wss://ws.coredao.org. Testnet2: wss://rpc.test2.btcs.network/wsp, per Core’s RPC list. Use WebSocketProvider for both.

Can I use ethers with Hardhat on Core?

Yes. Hardhat’s toolbox bundles ethers v6. Core’s Hardhat guide uses ethers in its deploy scripts.

Disclaimer: This article is for educational purposes only and is not financial or investment advice. Test on testnet or a local fork first, protect your private keys, and check every transaction before you sign it.

Recent Posts

  • iStock Contributor Payout: $100 Minimum, Payment Schedule & Methods (2026)
  • Panic Code 0x11 in Solidity: “Arithmetic Underflow or Overflow” Explained and Fixed
  • Can You Transfer a Child Trust Fund to a Lifetime ISA? (2026/27 Rules)
  • How to Use web3.py with Core Blockchain (Chain ID 1116)
  • Shutterstock Contributor Payout: Schedule, $25 Minimum & Why Payments Fail (2026)
Subscription form is not available at the moment
  • Altcoin News
  • Bitcoin
  • Core Ecosystem Analysis
  • DeFi
  • Free Crypto Signals
  • Make Money Online
  • Personal Finance & Investing
  • Token Analysis
  • About Us
  • Contact
  • Privacy Policy
  • Disclaimer
©2026 PenyuOnCore | Design: Newspaperly WordPress Theme