-
Getting the Error
While deploying using Alchemy + Rinkeby deploy.js looks like this const ethers = require("ethers");
const fs = require("fs-extra");
require("dotenv").config();
async function main() {
let provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL);
let wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./SimpleStorage_sol_SimpleStorage.bin",
"utf8"
);
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying, please wait...");
const contract = await contractFactory.deploy();
const deploymentReceipt = await contract.deployTransaction.wait(1);
console.log(`Contract Address: ${contract.address}`);
// Get the number
let currentFavoriteNumber = await contract.retrieve();
console.log(`Current Favourite Number: ${currentFavoriteNumber.toString()}`);
let transactionResponse = await contract.store(7);
let transactionReceipt = await transactionResponse.wait(1);
currentFavoriteNumber = await contract.retrieve();
console.log(`Updated favourite number is: ${currentFavoriteNumber}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
}); I tried setting the gas limit manually, with something like this const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying, please wait...");
const contract = await contractFactory.deploy({gasLimit: 6721975});
const deploymentReceipt = await contract.deployTransaction.wait(1);
console.log(`Contract Address: ${contract.address}`); and got the following error
Please help! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
This is the error after setting the gas limit manually.
|
Beta Was this translation helpful? Give feedback.
-
With Moralis, using it's Dapp URL in .env file and Private Key of my metamask wallet (it has Rinkeby test ETH)
Did not make any changes in deploy.js, do I have to make any extra changes? This code is working fine on Ganache. UPDATE: Dapp Details > Chains > Eth Rinkeby Settings > Nodes > Rinkeby Url And it worked. Thank You @PatrickAlphaC |
Beta Was this translation helpful? Give feedback.
-
@0xronin and @PatrickAlphaC I'm having the same error you originally had. For the life of me, I can't figure out why it's not deploying. Here's what I tried so far:
Here's the Code:
I tried deploying to the Alchemy PRC_URL and I get this error:
I tried what you did @0xronin and created an account on Moralis. The Dapp_URL didn't work ... so I found the Rinkeby Nodes URL and tried that as well. This is the error I get when I try to deploy on Moralis
Do I need more ETH than what I indicated I have in my Metamask? |
Beta Was this translation helpful? Give feedback.
With Moralis, using it's Dapp URL in .env file and Private Key of my metamask wallet (it has Rinkeby test ETH)
I am getting the no network error
Did not make any changes in deploy.js, do I have to make any extra changes?
This code is working fine on Ganache.
UPDATE:
It worked using the Moralis Node Provider!
Earlier I was using the Dapp URL but then found Node URL from
Dapp Details > Chains > Eth Rinkeby Settings > Nodes > Rinkeby Url
And it worked.
Thank You @PatrickAlphaC