Using Hardhat
Follow until step 7 of the Hardhat tutorial
Add Harmony testnet or mainnet entries to hardhat.config.js file.
1
require("@nomiclabs/hardhat-waffle");
2
3
// Replace this private key with your Harmony account private key
4
// To export your private key from Metamask, open Metamask and
5
// go to Account Details > Export Private Key
6
// Be aware of NEVER putting real Ether into testing accounts
7
const HARMONY_PRIVATE_KEY = "YOUR HARMONY PRIVATE KEY";
8
9
module.exports = {
10
solidity: "0.7.3",
11
networks: {
12
testnet: {
13
url: `https://api.s0.b.hmny.io`,
14
accounts: [`0x${HARMONY_PRIVATE_KEY}`]
15
},
16
mainnet: {
17
url: `https://api.harmony.one`,
18
accounts: [`0x${HARMONY_PRIVATE_KEY}`]
19
}
20
}
21
};
Copied!
Finally run:
1
npx hardhat run scripts/deploy.js --network testnet
Copied!
Last modified 4mo ago
Export as PDF
Copy link