Onyx Mainnet accepts signed EVM transactions through JSON-RPC on Chain ID 327.
javascript
import { JsonRpcProvider } from "ethers";
const provider = new JsonRpcProvider("https://rpc.onyx.org", 327);
const network = await provider.getNetwork();
if (network.chainId !== 327n) throw new Error("Wrong network");
console.log(await provider.getBlockNumber());Mainnet endpoints
| Service | URL |
|---|---|
| JSON-RPC | https://rpc.onyx.org |
| Explorer | https://onyxscan.org |
| Markets and OpenAPI | https://markets.onyx.org |
End users can also add Onyx with one click from Onyx Scan (bottom-left Add Onyx Network button). See Quick Start.
Add Onyx programmatically
For wallet dApps and browser providers, request the chain with EIP-3085:
javascript
await window.ethereum.request({
method: "wallet_addEthereumChain",
params: [{
chainId: "0x147",
chainName: "Onyx Mainnet",
nativeCurrency: { name: "XCN", symbol: "XCN", decimals: 18 },
rpcUrls: ["https://rpc.onyx.org"],
blockExplorerUrls: ["https://onyxscan.org"]
}]
});Verify the network before signing:
bash
curl -sS https://rpc.onyx.org \
-H 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'The result must be 0x147 (decimal 327).
Before sending value
- Verify
eth_chainIdreturns0x147. - Use
eth_estimateGasfor every transaction, especially transfers to unused addresses. - Use the gas price returned by the RPC. See Network Fees for the current snapshot, calculation, and USD denomination.
- Keep native XCN values aligned to the ledger's 8-decimal precision.
- Wait for a successful transaction receipt and reconcile balances through an independent read path.
Onyx supports the commonly used EVM read, transaction, contract-call, log, and subscription methods documented in EVM JSON-RPC. It does not claim complete parity with every Ethereum client extension.