Skip to main content

Cross-Chain EVM Requests

All our API methods are supported for cross-chain calls. You only need to specify the chain parameter. For example, this request will query block info on Polygon:

import Moralis from "moralis";
import { EvmChain } from "@moralisweb3/common-evm-utils";

evmApi.block.getBlock({
blockNumberOrHash: "33000000",
chain: EvmChain.POLYGON,
});

If no chain is specified, it will, by default, be set to the defaultEvmApiChain, which is set in your config (defaults to "Ethereum mainnet").

Change the Default Chain​

To change the default chain, you can specify defaultEvmApiChain in your config:

import Moralis from "moralis";
import { EvmChain } from "@moralisweb3/common-evm-utils";

Moralis.start({
apiKey: "YOUR_API_KEY",
defaultEvmApiChain: EvmChain.POLYGON,
});

Moralis.EvmApi.block.getBlock({
blockNumberOrHash: "33000000",
});

Supported EVM Chains​

NameChain idEvmChainType
Ethereum Mainnet1EvmChain.ETHEREUMMainnet
Ethereum Ropsten (deprecated)3EvmChain.ROPSTENTestnet
Ethereum Rinkeby (deprecated)4EvmChain.RINKEBYTestnet
Ethereum Görli5EvmChain.GOERLITestnet
Ethereum Kovan (deprecated)42EvmChain.KOVANTestnet
Ethereum Sepolia11155111EvmChain.SEPOLIATestnet
Polygon Mainnet137EvmChain.POLYGONMainnet
Polygon Mumbai80001EvmChain.MUMBAITestnet
BNB Mainnet56EvmChain.BSCMainnet
BNB Chain Testnet97EvmChain.BSC_TESTNETTestnet
Avalanche C-Chain43114EvmChain.AVALANCHEMainnet
Avalanche Fuji Testnet (deprecated)43113EvmChain.FUJITestnet
Fantom250EvmChain.FANTOMMainnet
Cronos Mainnet25EvmChain.CRONOSMainnet
Cronos Testnet (deprecated)338EvmChain.CRONOS_TESTNETTestnet
Palm Mainnet11297108109EvmChain.PALMMainnet
Arbitrum Mainnet42161EvmChain.ARBITRUMMainnet

Solana​

Change the Default Network​

We have two networks for the Solana API, which you can configure similarly. You can specify the mainnet or devnet:

import Moralis from "moralis";
import { SolNetwork } from "@moralisweb3/sol-utils";

Moralis.start({
apiKey: "YOUR_API_KEY",
defaultSolNetwork: SolNetwork.DEVNET,
});

Moralis.SolApi.account.getBalance({
address: "ADDRESS",
});

Supported Solana Networks​

NameSolNetwork
Solana mainnetSolNetwork.MAINNET
Solana devnetSolNetwork.DEVNET