-
I'm having trouble deploying the Simple Storage to Sepolia network using Alchemy. I'm at the end of lesson 5. where we start to use Alchemy and metamask wallet. I keep getting this error: If I do set a gasLimit: My metamask account has 0.2E which i think is sufficient. I can't seem to figure out what is going on. any help would be appreciated :)) const { ethers } = require("ethers")
const fs = require("fs-extra")
require("dotenv").config()
async function main() {
// initialise rpc and wallet
const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL)
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
console.log(process.env.RPC_URL);
console.log(process.env.PRIVATE_KEY);
// get abi and bytecode
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8")
const bin = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.bin", "utf8")
// create contract
const contract = new ethers.ContractFactory(abi, bin, wallet)
console.log("deploying please wait...")
// deploy contract
const mycontract = await contract.deploy({gasLimit : 1000000})
console.log(`contract address : ${mycontract.address}` )
const deploymentReceipt = await mycontract.deployTransaction.wait(1)
console.log(`Contract deployed to ${contract.address}`)
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.log(error)
process.exit(1)
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
FIX: Double Check the RPC URL, I Accidentally used the Mainnet rpc url instead of sepolia. |
Beta Was this translation helpful? Give feedback.
FIX: Double Check the RPC URL, I Accidentally used the Mainnet rpc url instead of sepolia.