eth_chainId
Overview
Returns the Movement EVM chain ID as a hex string.
Movement-Specific Considerations
- Movement supports both EVM and MoveVM; this method reflects the EVM network (3073).
- Finality is fast (~1–3s), but chain ID is static per network.
Parameters
Name | Type | Required | Description |
---|---|---|---|
(none) | — | — | No parameters. |
Returns
Hex string chain ID, e.g., 0xc01
(3073) for mainnet.
Code Examples
cURL
curl -X POST https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_chainId",
"params": [],
"id": 1
}'
Ethers.js v6
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1');
const chainId = await provider.send('eth_chainId', []);
console.log(chainId); // 0xc01
Web3.js
import Web3 from 'web3';
const web3 = new Web3('https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1');
const id = await web3.eth.getChainId();
console.log(id); // 3073
viem
import { createPublicClient, http } from 'viem';
const movement = {
id: 3073,
name: 'Movement',
nativeCurrency: { name: 'MOVE', symbol: 'MOVE', decimals: 18 },
rpcUrls: { default: { http: ['https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1'] } },
} as const;
const client = createPublicClient({
chain: movement,
transport: http('https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1'),
});
const chainId = await client.getChainId();
console.log(chainId); // 3073
Move Equivalent
N/A. Move side exposes chain info via REST (e.g., ledger info at /v1
), not eth_chainId
.
Common Errors
- None. This method should not error on a healthy node.