Lesson 9: no API token found #1603
Answered
by
alymurtazamemon
paulcoffee85
asked this question in
Q&A
-
Not sure why but getting "NomicLabsHardhatPluginError" saying no API token found for this network, but it's setup just like the repo. Discussion #931 similar but unhelpful.
const { commify } = require("ethers/lib/utils")
require("@nomiclabs/hardhat-waffle")
require("@nomiclabs/hardhat-etherscan")
require("hardhat-deploy")
require("solidity-coverage")
require("hardhat-gas-reporter")
require("hardhat-contract-sizer")
require("dotenv").config()
const RINKEBY_RPC_URL = process.env.RINKEBY_RPC_URL
const PRIVATE_KEY = process.env.PRIVATE_KEY
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 31337,
blockConfirmations: 1,
},
localhost: {
chainId: 31337,
},
rinkeby: {
chainId: 4,
blockConfirmations: 6,
url: RINKEBY_RPC_URL,
accounts: [PRIVATE_KEY],
saveDeployments: true,
},
},
solidity: {
compilers: [
{
version: "0.8.7",
},
{
version: "0.4.24",
},
],
},
mocha: {
timeout: 500000,
},
namedAccounts: {
deployer: {
default: 0,
1: 0,
},
player: {
default: 1,
},
},
mocha: {
timout: 200000, //200 seconds max
},
gasReporter: {
enabled: false,
outputFile: "gas-report.txt",
noColors: true,
currency: "USD",
// coinmarketcap: process.env.COINMARKETCAP_API_KEY,
token: "ETH",
},
contractSizer: {
runOnCompile: false,
only: ["Raffle"],
},
} ERROR: Verifying contract...
NomicLabsHardhatPluginError: You are trying to verify a contract in 'rinkeby', but no API token was found for this network. Please provide one in your hardhat config. For example:
{
...
etherscan: {
apiKey: {
rinkeby: 'your API key'
}
}
}
|
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Aug 8, 2022
Replies: 1 comment 1 reply
-
@paulcoffee85 You are missing this etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
}, make sure to rename the env variable according to your variable name. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
paulcoffee85
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@paulcoffee85 You are missing this
make sure to rename the env variable according to your variable name.