Deployment
Deploying on a Local Network
Compile the contract:
npx hardhat compile
Deploy the contract: Create a script
/scripts/deploy.js
:async function main() { const Contract = await ethers.getContractFactory("MyContract"); const contract = await Contract.deploy(); console.log("Contract deployed to:", contract.address); } main() .then(() => process.exit(0)) .catch((error) => { console.error(error); process.exit(1); });
Run the deployment script:
npx hardhat run scripts/deploy.js --network localhost
Deploying on Testnet
Configure Networks in Hardhat: Edit
hardhat.config.js
to include testnet configurations:codemodule.exports = { networks: { phron: { url: "https://testnet.phron.ai", } }, solidity: "0.8.4", };
Last updated