admin管理员组文章数量:1355522
I started my first blockchain tuto which is:
- ;t=696s
- Repo:
I am trying to deploy a NFT in the Rinkeby testnet with hardhat. Here are the steps I have done to config my environment:
Installed Hardhat
add the following env variable in my .zshrc (RINKEBY_RPC_URL, PRIVATE_KEY, MAINNET_RPC_URL)
Created a account with infuria to get my RINKEBY_RPC_URL:''
Add my PRIVATE_KEY from my Metamask
Create an account on / to get my MAINNET_RPC_URL: ''
I used / to get Ether on my metamask (Rinkeby testnet). Same thing with LINK
Then when I want to deploy my first NFT using hardhat -> hh deploy --network rinkeby
I have this error:
deploying "SVGNFT"An unexpected error occurred:
Error: ERROR processing /Users/macbook/Desktop/all-on-chain-generated-nft/deploy/01_Deploy_SVGNFT.js:
Error: insufficient funds for intrinsic transaction cost (error={"name":"ProviderError","code":-32000,"_isProviderError":true}, method="sendTransaction", transaction=undefined, code=INSUFFICIENT_FUNDS, version=providers/5.4.5)
at Logger.makeError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.throwError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at checkError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:53:16)
at /Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:215:24
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at DeploymentsManager.executeDeployScripts (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1014:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at DeploymentsManager.runDeploy (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/DeploymentsManager.ts:849:5)
at Environment._runTaskDefinition (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at SimpleTaskDefinition.action (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/index.ts:446:32)
at Environment._runTaskDefinition (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at SimpleTaskDefinition.action (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/index.ts:521:5)
at Environment._runTaskDefinition (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
Error message says:
insufficient funds for intrinsic transaction cost
Which is weird as I have added few Eth and link on the Rinkeby testnet. Did I missed something?
EDIT (19/07/21)
I have unmented MNEMONIC part and add the gas / gasPrice variable as set in the example:
rinkeby: {
url: RINKEBY_RPC_URL,
accounts: [PRIVATE_KEY],
//accounts: {
//mnemonic: MNEMONIC,
gas: 2100000,
gasPrice: 8000000000,
saveDeployments: true,
},
It gets me further as you can see:
Nothing to pile
----------------------------------------------------
reusing "SVGNFT" at 0x7e8d04a7c18f165E9684e887a7978c43f0019a3A
You have deployed an NFT contract to 0x7e8d04a7c18f165E9684e887a7978c43f0019a3A
Verify with:
npx hardhat verify --network rinkeby 0x7e8d04a7c18f165E9684e887a7978c43f0019a3A
Let's create an NFT now!
We will use ./img/small_enough.svg as our SVG, and this will turn into a tokenURI.
You've made your first NFT!
You can view the tokenURI here data:application/json;base64,eyJuYW1lIjoiU1ZHIE5GVCIsICJkZXNjcmlwdGlvbiI6IkFuIE5GVCBiYXNlZCBvbiBTVkchIiwgImF0dHJpYnV0ZXMiOiIiLCAiaW1hZ2UiOiJkYXRhOmltYWdlL3N2Zyt4bWw7YmFzZTY0LFBITjJaeUI0Yld4dWN6MGlhSFIwY0RvdkwzZDNkeTUzTXk1dmNtY3ZNakF3TUM5emRtY2lJR2hsYVdkb2REMGlOVEF3SWlCM2FXUjBhRDBpTlRBd0lqNEtJQ0E4WTJseVkyeGxJR040UFNJeU5UQWlJR041UFNJeU5UQWlJSEk5SWpJd01DSWdjM1J5YjJ0bFBTSmliR0ZqYXlJZ2MzUnliMnRsTFhkcFpIUm9QU0l6SWlCbWFXeHNQU0ppYkhWbElpQXZQaUFLUEM5emRtYytJQT09In0=
----------------------------------------------------
reusing "RandomSVG" at 0xc71197a95e9cd7e271F1CD08E049720486F62174
You have deployed an NFT contract to 0xc71197a95e9cd7e271F1CD08E049720486F62174
Verify with:
npx hardhat verify --network rinkeby 0xc71197a95e9cd7e271F1CD08E049720486F62174 0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B 0x01be23585060835e02b77ef475b0cc51aa1e0709 0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311 100000000000000000
Duplicate definition of Transfer (Transfer(address,address,uint256,bytes), Transfer(address,address,uint256))
Let's create an NFT now!
You've made your NFT! This is number 0x0000000000000000000000000000000000000000000000000000000000000002
Let's wait for the Chainlink VRF node to respond...
Now let's finsih the mint...
Then when the Chainlink VRF node is called I've got a new error:
Error: ERROR processing /Users/macbook/Desktop/all-on-chain-generated-nft/deploy/02_Deploy_RandomSVG.js:
Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"name":"ProviderError","code":3,"_isProviderError":true,"data":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003145524337323155524953746f726167653a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e000000000000000000000000000000"}, method="call", transaction={"from":"0x76834D0CbE40eDedb2844Afd98896c10DbA6CE92","gasLimit":{"type":"BigNumber","hex":"0x111c78"},"to":"0xc71197a95e9cd7e271F1CD08E049720486F62174","data":"0xc87b56dd0000000000000000000000000000000000000000000000000000000000000000","accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.4.5)
at Logger.makeError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.throwError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at checkError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:80:16)
at EthersProviderWrapper.<anonymous> (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:555:20)
at step (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
at Object.throw (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
at rejected (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at DeploymentsManager.executeDeployScripts (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1014:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at DeploymentsManager.runDeploy (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/DeploymentsManager.ts:849:5)
at Environment._runTaskDefinition (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
Is there something wrong with the value assigned to gas and gasPrice?
I started my first blockchain tuto which is:
- https://www.youtube./watch?v=9oERTH9Bkw0&t=696s
- Repo: https://github./PatrickAlphaC/all-on-chain-generated-nft#about-svgs
I am trying to deploy a NFT in the Rinkeby testnet with hardhat. Here are the steps I have done to config my environment:
Installed Hardhat
add the following env variable in my .zshrc (RINKEBY_RPC_URL, PRIVATE_KEY, MAINNET_RPC_URL)
Created a account with infuria to get my RINKEBY_RPC_URL:'https://rinkeby.infura.io/v3/My_Project_Id'
Add my PRIVATE_KEY from my Metamask
Create an account on https://www.alchemy./ to get my MAINNET_RPC_URL: 'https://eth-mainnet.alchemyapi.io/v2/My_Project_Id'
I used https://faucet.rinkeby.io/ to get Ether on my metamask (Rinkeby testnet). Same thing with LINK
Then when I want to deploy my first NFT using hardhat -> hh deploy --network rinkeby
I have this error:
deploying "SVGNFT"An unexpected error occurred:
Error: ERROR processing /Users/macbook/Desktop/all-on-chain-generated-nft/deploy/01_Deploy_SVGNFT.js:
Error: insufficient funds for intrinsic transaction cost (error={"name":"ProviderError","code":-32000,"_isProviderError":true}, method="sendTransaction", transaction=undefined, code=INSUFFICIENT_FUNDS, version=providers/5.4.5)
at Logger.makeError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.throwError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at checkError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:53:16)
at /Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:215:24
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at DeploymentsManager.executeDeployScripts (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1014:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at DeploymentsManager.runDeploy (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/DeploymentsManager.ts:849:5)
at Environment._runTaskDefinition (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at SimpleTaskDefinition.action (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/index.ts:446:32)
at Environment._runTaskDefinition (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at SimpleTaskDefinition.action (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/index.ts:521:5)
at Environment._runTaskDefinition (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
Error message says:
insufficient funds for intrinsic transaction cost
Which is weird as I have added few Eth and link on the Rinkeby testnet. Did I missed something?
EDIT (19/07/21)
I have unmented MNEMONIC part and add the gas / gasPrice variable as set in the example:
rinkeby: {
url: RINKEBY_RPC_URL,
accounts: [PRIVATE_KEY],
//accounts: {
//mnemonic: MNEMONIC,
gas: 2100000,
gasPrice: 8000000000,
saveDeployments: true,
},
It gets me further as you can see:
Nothing to pile
----------------------------------------------------
reusing "SVGNFT" at 0x7e8d04a7c18f165E9684e887a7978c43f0019a3A
You have deployed an NFT contract to 0x7e8d04a7c18f165E9684e887a7978c43f0019a3A
Verify with:
npx hardhat verify --network rinkeby 0x7e8d04a7c18f165E9684e887a7978c43f0019a3A
Let's create an NFT now!
We will use ./img/small_enough.svg as our SVG, and this will turn into a tokenURI.
You've made your first NFT!
You can view the tokenURI here data:application/json;base64,eyJuYW1lIjoiU1ZHIE5GVCIsICJkZXNjcmlwdGlvbiI6IkFuIE5GVCBiYXNlZCBvbiBTVkchIiwgImF0dHJpYnV0ZXMiOiIiLCAiaW1hZ2UiOiJkYXRhOmltYWdlL3N2Zyt4bWw7YmFzZTY0LFBITjJaeUI0Yld4dWN6MGlhSFIwY0RvdkwzZDNkeTUzTXk1dmNtY3ZNakF3TUM5emRtY2lJR2hsYVdkb2REMGlOVEF3SWlCM2FXUjBhRDBpTlRBd0lqNEtJQ0E4WTJseVkyeGxJR040UFNJeU5UQWlJR041UFNJeU5UQWlJSEk5SWpJd01DSWdjM1J5YjJ0bFBTSmliR0ZqYXlJZ2MzUnliMnRsTFhkcFpIUm9QU0l6SWlCbWFXeHNQU0ppYkhWbElpQXZQaUFLUEM5emRtYytJQT09In0=
----------------------------------------------------
reusing "RandomSVG" at 0xc71197a95e9cd7e271F1CD08E049720486F62174
You have deployed an NFT contract to 0xc71197a95e9cd7e271F1CD08E049720486F62174
Verify with:
npx hardhat verify --network rinkeby 0xc71197a95e9cd7e271F1CD08E049720486F62174 0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B 0x01be23585060835e02b77ef475b0cc51aa1e0709 0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311 100000000000000000
Duplicate definition of Transfer (Transfer(address,address,uint256,bytes), Transfer(address,address,uint256))
Let's create an NFT now!
You've made your NFT! This is number 0x0000000000000000000000000000000000000000000000000000000000000002
Let's wait for the Chainlink VRF node to respond...
Now let's finsih the mint...
Then when the Chainlink VRF node is called I've got a new error:
Error: ERROR processing /Users/macbook/Desktop/all-on-chain-generated-nft/deploy/02_Deploy_RandomSVG.js:
Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"name":"ProviderError","code":3,"_isProviderError":true,"data":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003145524337323155524953746f726167653a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e000000000000000000000000000000"}, method="call", transaction={"from":"0x76834D0CbE40eDedb2844Afd98896c10DbA6CE92","gasLimit":{"type":"BigNumber","hex":"0x111c78"},"to":"0xc71197a95e9cd7e271F1CD08E049720486F62174","data":"0xc87b56dd0000000000000000000000000000000000000000000000000000000000000000","accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.4.5)
at Logger.makeError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.throwError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at checkError (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:80:16)
at EthersProviderWrapper.<anonymous> (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:555:20)
at step (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
at Object.throw (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
at rejected (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at DeploymentsManager.executeDeployScripts (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1014:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at DeploymentsManager.runDeploy (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat-deploy/src/DeploymentsManager.ts:849:5)
at Environment._runTaskDefinition (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/Users/macbook/Desktop/all-on-chain-generated-nft/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
Is there something wrong with the value assigned to gas and gasPrice?
Share Improve this question edited Sep 19, 2021 at 11:13 Remzzer asked Sep 11, 2021 at 18:30 RemzzerRemzzer 833 silver badges10 bronze badges 4- How much ETH and LINK? Maybe you need more – Patrick Collins Commented Sep 11, 2021 at 21:01
- 1 Hi @PatrickCollins. 18,75ETH and 200 LINK so i do not think that it's the problem... Thanks for you content by the way ! Here is my address: > rinkeby.etherscan.io/address/… – Remzzer Commented Sep 11, 2021 at 22:36
- hmm... I've never seen this error before. If no one else responds here, I'll bounty the question to see if we can get a few more eyes on it. – Patrick Collins Commented Sep 12, 2021 at 20:07
- I faced this issue too, due to the usage of an empty account private key. just make sure you are using the private key of account that has some balance – Hammad Tariq Commented Aug 18, 2022 at 12:03
4 Answers
Reset to default 4I mented the mnemonic as suggested in the other answer code modified, and it partially fixed the problem.
Additionally changing this part of the hardhat.config.js file worked for me:
rinkeby: {
url: RINKEBY_RPC_URL,
accounts: [PRIVATE_KEY],
//accounts: {
//mnemonic: MNEMONIC,
gas: 2100000,
gasPrice: 8000000000,
saveDeployments: true,
},
In your hardhat.config.js file, ensure the 'rinkeby' section is correctly filled out to use your PRIVATE_KEY env var, and not the mnenomic one. ie accounts: [PRIVATE_KEY] should be unmented, and the MNEMONIC one should be mented
Check for a missing ma after the end of one of the previously defined networks in hardhat.config.js
.
For example, I was trying to deploy to mainnet
, and right above it was this definition:
ganache: {
url: 'http://localhost:8545',
accounts: [PRIVATE_KEY] // <<<< ma was missing here
// accounts: {
// mnemonic: MNEMONIC,
// }
},
mainnet: {
url: MAINNET_RPC_URL,
Adding the ma, i.e.: [PRIVATE_KEY],
fixed the issue for me.
For me, the error came up because I had an insufficient wallet balance.
My wallet balance was 0.9 ETH and I was trying to deploy the contract with 1ETH :
var contract = await contractFactory.deploy({value: hre.ethers.utils.parseEther("1")});
changing the value to 0.07 solved it:
var contract = await contractFactory.deploy({value: hre.ethers.utils.parseEther("0.07")});
本文标签: javascripthardhatIssues while deploying a NFT to rinkeby networkStack Overflow
版权声明:本文标题:javascript - hardhat : Issues while deploying a NFT to rinkeby network - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743991555a2572235.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论