excellent, will try it out without the plugins
is it possible to share the hardhat.config.js file?
I donât have it, I didnât do that particular tutorial
i was able to deploy it on hardhat network, are you guys sure moralis mumbai network is running?
Mumbai is working fine. It should work for you too provided youâre using the proper configuration.
would you be able to help out with it, i know where the issue is, its in the hardhat configuration file. I am using windows maybe that also has an effect on it. The error i keep getting Error HH100: Network mumbai doesnât exist
This is what i have:
module.exports = {
solidity: â0.8.7â,
networks: {
mumbai: {
url: process.env.POLYGON_MUMBAI,
accounts: [process.env.PRIVATE_KEY]
},
},
etherscan: {
apiKey: process.env.API_KEY,
}
And this is what worked for hardhat network
module.exports = {
defaultNetwork: âhardhatâ,
networks: {
localhost: {
url: âhttp://127.0.0.1:8545â,
},
hardhat: {
},
},
solidity: â0.8.7â
}
This should work for mumbai provided you have your your speedy nodes uri as POLYGON_MUMBAI
and also your wallet private key as PRIVATE_KEY
in your .env
file.
Calling mumbai on the second configuration while mumbai is not present may cause that.
Nonetheless, you can have your config together rather such like
module.exports = {
solidity: "0.8.7",
networks: {
localhost: {
url: "http://127.0.0.1:8545",
},
mumbai: {
url: process.env.POLYGON_MUMBAI,
accounts: [process.env.PRIVATE_KEY],
},
},
etherscan: {
apiKey: process.env.API_KEY,
},
};
I know im the one doing something wrong here, getting the same error on both options provided, i ran show stack traces got this:
Error: Cannot find module âC:\Users\tsaka\Desktop\DecanectDAO\smartcontracts\Hardhatâ
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: âMODULE_NOT_FOUNDâ,
requireStack: []
Maybe this can help answer what i have done wrong?
Seemed like hardhat is missing in your dependencies, you need to make sure itâs installed and itâs dependencies too
I ran these initially
mkdir smartcontracts
cd smartcontracts
npm i -D hardhat
npx hardhat
npm install --save-dev âhardhat@^2.9.9â â@nomiclabs/hardhat-waffle@^2.0.0â âethereum-waffle@^3.0.0â âchai@^4.2.0â â@nomiclabs/hardhat-ethers@^2.0.0â âethers@^5.0.0â
npm i -D dotenv
npm i -D @nomiclabs/hardhat-etherscan
I just ran them once more, done it from the start once again, and still the same thing. The options you provided me with do they show up as string for you? For me its showing as undefined, could the issue be there somewhere?
It compiles successfully, but for some reason in the video shows 1 contract being compiled for me it compiles 2
You should have dotenv
installed and import the package in your hardhat config using require("dotenv").config()
so you can read from environmental variables, this wonât make the process.env
values undefined.
In the video, the Greeter.sol file was changed , but probably you forgot to remove it
That makes perfect sense with dotenv, but i do have them installed and in config file
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-etherscan");
const dotenv = require(âdotenvâ)
dotenv.config();
And the solidity file as well, i have it changed to Dao.sol and the greeter contract was replaced by Moralis DAO
Could it be since im using windows hardhat is not reading the code right and need to add parentheses somewhere, commas âŚ
when i enter it like this, it shows all of them as string and removes undefined
- @type import(hardhat/config).âHardhatUserConfigâ
*/
module.exports = {
solidity: â0.8.7â,
network: {
mumbai: {
url: 'process.env.POLYGON_MUMBAI',
accounts: ['process.env.PRIVATE_KEY'],
},
},
etherscan: {
apiKey: 'process.env.API_KEY',
},
};
But still get the same error
It shouldnât be related to windows. Maybe you can try in a new terminal and make sure your files are saved. Maybe you can also share a shot of the error as it might be more helpful
of course, will do so now, thank you so much for taking the time and sorry if i came off rude, going back to my message it could have been interpreted wrong
You shouldnât have your 'process.env.POLYGON_MUBAI'
wrapped in string like this, rather it should should be like this process.env.POLYGON_MUBAI
, also the account too should be
process.env.PRIVATE_KEY, not wrapped in single or double quote. Also you haven't saved your files yet, so you need to save your files maybe by
CTRL + S` or any other means you wish to use before running the command
Your files are not saved. You should have them saved and make the fixes as mentioned above