Lesson 6: Error: invalid bytecode (argument="bytecode", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.7.0) #5077
-
My hardhat.config.js filerequire("@nomicfoundation/hardhat-toolbox")
require("dotenv").config()
/** @type import('hardhat/config').HardhatUserConfig */
const GOERLI_RPC_URL = process.env.GOERLI_RPC_URL
const PRIVATE_KEY = process.env.PRIVATE_KEY
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat:{},
goerli: {
url: GOERLI_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 5,
},
},
solidity: "0.8.8",
} Error I'm gettingbaroon@Hacked:~/folder/hh-fcc/hardhat-simple-storage-fcc$ npx hardhat run scripts/deploy.js --network goerli
Error: invalid bytecode (argument="bytecode", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.7.0)
at Logger.makeError (/home/baroon/folder/hh-fcc/hardhat-simple-storage-fcc/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
at Logger.throwError (/home/baroon/folder/hh-fcc/hardhat-simple-storage-fcc/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
at Logger.throwArgumentError (/home/baroon/folder/hh-fcc/hardhat-simple-storage-fcc/node_modules/@ethersproject/logger/src.ts/index.ts:285:21)
at Proxy.ContractFactory (/home/baroon/folder/hh-fcc/hardhat-simple-storage-fcc/node_modules/@ethersproject/contracts/src.ts/index.ts:1172:20)
at main (/home/baroon/folder/hh-fcc/hardhat-simple-storage-fcc/scripts/deploy.js:5:45)
at Object.<anonymous> (/home/baroon/folder/hh-fcc/hardhat-simple-storage-fcc/scripts/deploy.js:16:1)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
reason: 'invalid bytecode',
code: 'INVALID_ARGUMENT',
argument: 'bytecode',
value: undefined
}
baroon@Hacked:~/folder/hh-fcc/hardhat-simple-storage-fcc$ my deploy.js fileconst {ethers} = require("hardhat")
async function main(){
const SimpleStorageFactory = await ethers.ContractFactory("SimpleStorage")
console.log
("Deploying contract ....")
const simpleStorage = await SimpleStorageFactory.deploy()
await simpleStorage.deploy()
}
main()
.then(() => process.exit(0))
.catch((error) =>{
console.error(error);
process.exit(1)
}); my .env fileGOERLI_RPC_URL = here i have given my rpc url
PRIVATE_KEY = i have pasted my private key here but i have not shown here my contract is getting compiled wituout any error. |
Beta Was this translation helpful? Give feedback.
Answered by
paulcoffee85
Mar 13, 2023
Replies: 1 comment 2 replies
-
in deploy file:
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
baroonjha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in deploy file:
Change to
await ethers.getContractFactory("SimpleStorage:)