hashlips-lab / nft-erc721-collection

MIT License
445 stars 396 forks source link

Contract verification Fails after deployment #83

Closed theo-raducanu closed 2 years ago

theo-raducanu commented 2 years ago

I followed the exact steps from the latest video https://youtu.be/Zhmj4PiJ-GA?t=4136 , I deployed successfully the contract to Rinkeby, but when it comes to the verification of the contract is taking quite a while and after that the verification fails.

Can this be a problem with Etherscan? Screenshot 2022-03-07 at 16 44 28

theo-raducanu commented 2 years ago

@liarco Thank you so much for everything that you are doing!

I am using the same node version as in the video 14.18.2 and the same version of hardhat-etherscan(3.0.3) as in the repo.

GoodGoldDev commented 2 years ago

Did you change anything (price/name/amount etc etc) after deploying and before verification? I had the same problem ;)

theo-raducanu commented 2 years ago

I did not change anything after the contract was deployed. I remade the process many times without success. Did you receive the same error?

firmol commented 2 years ago

Hello. I have the same error, I have implemented a couple of times in rinkeby, I don't change anything and the contract can't be verified. image

negaunee042 commented 2 years ago

Looks like one of the config files are pointing to a folder that isn't there. The top error also says typescript 2.1 is required, so unsure which is the issue. Untitled-1

liarco commented 2 years ago

Hi everyone!

@theo-raducanu and @firmol, the Rinkeby version of Etherscan is performing really bad these days. Contracts verification is failing very often. Unfortunately we just have to wait and try again later. I think they might be struggling under an higher amount of verification requests.

@negaunee042 files in node_modules can be ignored, they have nothing to do with those errors in this case! 😉

negaunee042 commented 2 years ago

Hi everyone!

@theo-raducanu and @firmol, the Rinkeby version of Etherscan is performing really bad these days. Contracts verification is failing very often. Unfortunately we just have to wait and try again later. I think they might be struggling under an higher amount of verification requests.

@negaunee042 files in node_modules can be ignored, they have nothing to do with those errors in this case! 😉

Thanks bro. I tried helping, I see you are probably insanely busy lol. How do we run the coinmarket cap gas price checker? I uploaded the api. Honestly I didn't even wanna ask cuz I know how busy you are.

theo-raducanu commented 2 years ago

Hi everyone!

@theo-raducanu and @firmol, the Rinkeby version of Etherscan is performing really bad these days. Contracts verification is failing very often. Unfortunately we just have to wait and try again later. I think they might be struggling under an higher amount of verification requests.

@negaunee042 files in node_modules can be ignored, they have nothing to do with those errors in this case! 😉

Thank you so much for your response. I guess I'll try again later. That was my suspicion, but I was not sure.

liarco commented 2 years ago

@negaunee042 thank for your help, I appreciate it. You can use yarn test-gas and it is gonna use the CoinMarketCap API to estimate gas costs in USD.

@theo-raducanu you are welcome, I totally understand that because it really seems that the issue is on the code side... that's really annoying. 😞

negaunee042 commented 2 years ago

Liarco and Theo 100% right. I deployed to Ropsten and verified almost instantly. Just add your moralis API key if you haven't already, then you may have to add this to the hardhat.config.ts file under api key for etherscan. ropsten: process.env.BLOCK_EXPLORER_API_KEY,

firmol commented 2 years ago

@liarco There is a way to verify the contract manually. Can I get the ABI from somewhere?

negaunee042 commented 2 years ago

@liarco There is a way to verify the contract manually. Can I get the ABI from somewhere?

Yes it is in the files. You will have to load each contract 1 by 1. Since the contracts import other contracts, you will have to upload 14 manually I think(if you used the give erc721).

peternjr commented 2 years ago

Liarco and Theo 100% right. I deployed to Ropsten and verified almost instantly. Just add your moralis API key if you haven't already, then you may have to add this to the hardhat.config.ts file under api key for etherscan. ropsten: process.env.BLOCK_EXPLORER_API_KEY,

Where do you add the moralis API key?

I added it in the .env file to BLOCK_EXPLORER_API_KEY= It deploys the contract, but I still get an error on verify.

granthughes1999 commented 2 years ago

just wanted to apologize for posting the same issue as seen here. I was unaware there were pinned issues on Github, and I have been on GitHub for over a year. So not only did you help build this amazing project, but you also taught me something about Github. I have also been attempting to upload to rinkeby, so thank you for answering the question that rinkeby is having issues. keep up the good work!

DoodledPunks-Ken commented 2 years ago

Liarco and Theo 100% right. I deployed to Ropsten and verified almost instantly. Just add your moralis API key if you haven't already, then you may have to add this to the hardhat.config.ts file under api key for etherscan. ropsten: process.env.BLOCK_EXPLORER_API_KEY,

I tried adding the line and verifying but I keep getting this: Error HH100: Network ropsten doesn't exist

or

Error in plugin @nomiclabs/hardhat-etherscan: The address 0x7fF95DeB217cF53BE0251FFa2d68a55a3C87Be9f has no bytecode. Is the contract deployed to this network? The selected network is truffle.

Is there anything else you had to configure? I got it deployed to ropsten successfully.

negaunee042 commented 2 years ago

Yeah you have to add ropsten API like I showed above. I'll go on my pc quick

On Mon, Mar 7, 2022, 10:36 PM DoodledPunks-Ken @.***> wrote:

Liarco and Theo 100% right. I deployed to Ropsten and verified almost instantly. Just add your moralis API key if you haven't already, then you may have to add this to the hardhat.config.ts file under api key for etherscan. ropsten: process.env.BLOCK_EXPLORER_API_KEY,

I tried adding the line and verifying but I keep getting this: Error HH100: Network ropsten doesn't exist

or

Error in plugin @nomiclabs/hardhat-etherscan: The address 0x7fF95DeB217cF53BE0251FFa2d68a55a3C87Be9f has no bytecode. Is the contract deployed to this network? The selected network is truffle.

Is there anything else you had to configure? I got it deployed to ropsten successfully.

— Reply to this email directly, view it on GitHub https://github.com/hashlips-lab/nft-erc721-collection/issues/83#issuecomment-1061372257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKTY32J3G5Q7SEYEFWRNWLU63DMXANCNFSM5QDZZX3A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

negaunee042 commented 2 years ago

Did you add it to the hardhat.config.ts file?
image

negaunee042 commented 2 years ago

Do you have your etherscan api also linked in the .env? you can just do NETWORK_TESTNET_URL="MORALIS_ROPSTEN_API_KEY like i did image

negaunee042 commented 2 years ago

then just do ......rify "contract" --network testnet

negaunee042 commented 2 years ago

Liarco and Theo 100% right. I deployed to Ropsten and verified almost instantly. Just add your moralis API key if you haven't already, then you may have to add this to the hardhat.config.ts file under api key for etherscan. ropsten: process.env.BLOCK_EXPLORER_API_KEY,

I tried adding the line and verifying but I keep getting this: Error HH100: Network ropsten doesn't exist

or

Error in plugin @nomiclabs/hardhat-etherscan: The address 0x7fF95DeB217cF53BE0251FFa2d68a55a3C87Be9f has no bytecode. Is the contract deployed to this network? The selected network is truffle.

Is there anything else you had to configure? I got it deployed to ropsten successfully.

I don't use truffle, but it looks like your second error code comes from deploying to the wrong network

theo-raducanu commented 2 years ago

I just verified the contract today on Rinkeby with no issues.

firmol commented 2 years ago

Yes, problem solved, it was the Rinkeby network, today the contract was verified without issues. Thanks. :-)

lbastian10 commented 2 years ago

Hi im been trying to verify my contract on ETH mainnet for always failed but the same contract worked fine and was verified on rinkeby

Error in plugin @nomiclabs/hardhat-etherscan: The contract verification failed. Reason: Fail - Unable to verify

For more info run Hardhat with --show-stack-traces error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

thanks

liarco commented 2 years ago

Hi @lbastian10, you might have changed something in your project after deployment, for example:

  1. you changed some values on CollectionConfig.ts after deployment (the contract address doesn't count here)
  2. you updated some dependencies or the whole project after deployment

Remember that you should verify your contract immediately after deployment and ensure you are using the same exact configuration. Whenever you change something before verifying it can be a nightmare to get back to the previous situation in order to verify correctly.

With same code, same configuration and a valid API key, everything should work fine.

hakufred commented 2 years ago

Hello. The command “Yarn Verify” does not appear to be a valid command to verify the contract. I’ve searched all over the internet and have tried installing various applications that can’t be found.

What is the correct command for contract verification?

granthughes1999 commented 2 years ago

@hakufred

are you sure you're in the smart-contract directory, try running this in the terminal

cd smart-contract

then run.

yarn verify ContractAddress --network truffle

hakufred commented 2 years ago

@hakufred

are you sure you're in the smart-contract directory, try running this in the terminal

cd smart-contract

then run.

yarn verify ContractAddress --network truffle

I was not in the directory actually. Ran it this time with your step but now I’m receiving a new error “ Error in plugin @nomiclabs/hardhat-etherscan: The selected network is hardhat. Please select a network supported by Etherscan.”

The network I am selecting Is truffle not hard hat

hakufred commented 2 years ago

I’m not sure if I’ve missed a dependency or I’m not defining the network somewhere. I keep getting an error that the network doesn’t exist

liarco commented 2 years ago

@hakufred please follow the instructions in my videos (at least from episode 3) and make sure you are not skipping any step: https://github.com/hashlips-lab/nft-erc721-collection#youtube-tutorials

hakufred commented 2 years ago

Hello there! I watched episode 3 but it seems to have been a breakdown of the folder structure. My issue I am having has to do with them set up of some of these plugins. Is there anyway I can manually verify this on BSC scan? What exactly are the 14 files needed to verify?

w-zhong commented 2 years ago
截屏2022-04-13 23 46 03

hey @liarco, I followed the steps from the video and got this error, I am using mbp m1 max, can you help me here? thanks in advance!