For the complete documentation index, see llms.txt. This page is also available as Markdown.

Deploying Contracts

Deploy and verify Solidity contracts on Onyx Mainnet.

Use ordinary Solidity tooling with Chain ID 327. Estimate gas and read the current gas price instead of pinning values copied from another network.

import "dotenv/config";
import { JsonRpcProvider, Wallet, ContractFactory } from "ethers";
import artifact from "./artifacts/Example.json" with { type: "json" };

const provider = new JsonRpcProvider("https://rpc.onyx.org", 327);
const signer = new Wallet(process.env.DEPLOYER_PRIVATE_KEY, provider);
const factory = new ContractFactory(artifact.abi, artifact.bytecode, signer);
const contract = await factory.deploy();
await contract.waitForDeployment();
console.log(await contract.getAddress());

Keep private keys out of source code and shell history. After deployment, confirm eth_getCode is non-empty and verify the source through the Onyx Explorer.

Onyx follows EVM execution semantics but is not required to expose every Ethereum client-specific debug or tracing extension. Test the exact RPC methods your deployment and verification pipeline needs before Mainnet use.

Last updated