- Add a
.env
file (in the hardhat/truffle folder of the project) that contains the PRIVATE_KEY of the wallet that will be used to deploy the contracts and API_KEY (if you want to verify using hardhat-etherscan)
PRIVATE_KEY = XXXXXXXXXX
API_KEY = XXXXXXX
- Install
dotenv
to allow the config files to read PRIVATE_KEY from.env
file
npm i dotenv
- Create a deployment script
- Update the
hardhat.config.js
file with these networks
- Run the following command to deploy the contract
npx hardhat run --network mainnet scripts/sample-script.js
npx hardhat run --network testnet scripts/sample-script.js
- You should see the deployed contract address
- Create a deployment script
- Update the
truffle-config.js
file with these networks
- Run the following command to deploy the contract
truffle migrate --network opera_mainnet
truffle migrate --network opera_testnet
- You should see the deployed contract address