NERO
Wallets

Multi-Chain Support

Chain configuration, built-in presets, custom networks, and chain switching

Multi-Chain Support

The chain configuration subsystem is exposed by @nerochain/mpc-sdk/chains. It provides the ChainConfig type, built-in chain presets, ChainManager, and chain management methods on NeroMpcSDK.

ChainConfig Type

FieldTypeRequiredDescription
chainIdnumberYesEIP-155 chain ID
chainNamestringYesInternal machine-readable name
displayNamestringYesHuman-readable name
nativeCurrency.namestringYesFull name of the native token
nativeCurrency.symbolstringYesTicker symbol
nativeCurrency.decimalsnumberYesDecimal precision (always 18 for EVM)
rpcUrlsstring[]YesOrdered list of JSON-RPC endpoints
blockExplorerUrlsstring[]NoBlock explorer base URLs
isTestnetbooleanYesFlag distinguishing testnets
entryPointAddressstringNoERC-4337 EntryPoint contract address
simpleAccountFactoryAddressstringNoSimpleAccount factory contract address
bundlerUrlstringNoERC-4337 bundler endpoint
paymasterUrlstringNoPaymaster service endpoint

Built-in Chain Presets

import {
  NERO_TESTNET,
  NERO_MAINNET,
  ETHEREUM_MAINNET,
  ETHEREUM_SEPOLIA,
  POLYGON_MAINNET,
  ARBITRUM_ONE,
  BASE_MAINNET,
} from "@nerochain/mpc-sdk/chains";
ConstantChain IDDisplay NameTestnetBundlerPaymaster
NERO_TESTNET689NERO TestnetYesYesYes
NERO_MAINNET1689NERO MainnetNoYesYes
ETHEREUM_MAINNET1EthereumNoNoNo
ETHEREUM_SEPOLIA11155111Sepolia TestnetYesNoNo
POLYGON_MAINNET137PolygonNoNoNo
ARBITRUM_ONE42161Arbitrum OneNoNoNo
BASE_MAINNET8453BaseNoNoNo

NERO Testnet Details

FieldValue
RPChttps://rpc-testnet.nerochain.io
Explorerhttps://testnet.neroscan.io
Bundlerhttps://bundler-testnet.nerochain.io
Paymasterhttps://paymaster-testnet.nerochain.io
EntryPoint0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
Factory0x9406Cc6185a346906296840746125a0E44976454

NERO Mainnet Details

FieldValue
RPChttps://rpc.nerochain.io
Explorerhttps://neroscan.io
Bundlerhttps://bundler-mainnet.nerochain.io
Paymasterhttps://paymaster-mainnet.nerochain.io
EntryPoint0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
Factory0x9406Cc6185a346906296840746125a0E44976454

Utility Functions

FunctionSignatureReturns
getChainConfig(chainId: number) => ChainConfig | undefinedSingle config from BUILTIN_CHAINS
getAllChains() => ChainConfig[]All built-in configs
getTestnetChains() => ChainConfig[]Configs where isTestnet === true
getMainnetChains() => ChainConfig[]Configs where isTestnet === false
import { getChainConfig, getAllChains, getTestnetChains } from "@nerochain/mpc-sdk/chains";

const neroTestnet = getChainConfig(689);
const allChains = getAllChains();
const testnets = getTestnetChains();

Custom Chain Configuration

Register private or newly launched networks using addChain():

sdk.addChain({
  chainId: 1,
  chainName: "ethereum-mainnet",
  displayName: "Ethereum Mainnet",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: ["https://eth.llamarpc.com"],
  blockExplorerUrls: ["https://etherscan.io"],
  isTestnet: false,
});

Chain Switching

switchChain(chainId) updates the SDK's active chain. It validates the chain is either built-in or previously added via addChain, then calls notifyListeners to trigger UI updates or provider reconfigurations.

await sdk.switchChain(1689);

The SDK emits a chain_changed event when the active chain updates:

sdk.on("chain_changed", ({ chainId }) => {
  console.log("Switched to chain:", chainId);
});

RpcConnection Features

The ChainManager creates RpcConnection instances that provide:

  • Automatic RPC Rotation: Cycles through the rpcUrls list on call failures
  • Standard EVM Methods: Built-in helpers for getBalance, getTransactionCount, estimateGas, and sendRawTransaction
  • Transaction Polling: waitForTransaction polls for receipts until the specified confirmation count is reached

Local Signing Integration

When using the SDK for local signing (bypassing MPC rounds by reconstructing the private key), the ChainConfig initializes the LocalKeyProvider:

  • Signing: Intercepts personal_sign, eth_signTypedData_v4, and eth_sendTransaction to sign locally
  • State: Responds to eth_chainId using the chainId from active ChainConfig
  • Forwarding: Sends all other requests (e.g., eth_call) to the primary RPC URL

On this page