Deploying Contracts
Deploy and verify Solidity contracts on Onyx Mainnet.
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());Last updated
