Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contract verification Fails after deployment #83

Closed
theo-raducanu opened this issue Mar 7, 2022 · 31 comments
Closed

Contract verification Fails after deployment #83

theo-raducanu opened this issue Mar 7, 2022 · 31 comments

Comments

@theo-raducanu
Copy link

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
Copy link
Author

@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
Copy link

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

@theo-raducanu
Copy link
Author

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
Copy link

firmol commented Mar 7, 2022

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
Copy link

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
Copy link
Member

liarco commented Mar 7, 2022

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! 😉

@liarco liarco closed this as completed Mar 7, 2022
@liarco liarco pinned this issue Mar 7, 2022
@negaunee042
Copy link

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
Copy link
Author

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
Copy link
Member

liarco commented Mar 7, 2022

@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
Copy link

negaunee042 commented Mar 7, 2022

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
Copy link

firmol commented Mar 7, 2022

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

@negaunee042
Copy link

@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
Copy link

peternjr commented Mar 8, 2022

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
Copy link

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
Copy link

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
Copy link

negaunee042 commented Mar 8, 2022 via email

@negaunee042
Copy link

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

@negaunee042
Copy link

negaunee042 commented Mar 8, 2022

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
Copy link

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

@negaunee042
Copy link

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
Copy link
Author

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

@firmol
Copy link

firmol commented Mar 8, 2022

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

@liarco liarco mentioned this issue Mar 9, 2022
@lbastian10
Copy link

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
Copy link
Member

liarco commented Apr 2, 2022

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
Copy link

hakufred commented Apr 5, 2022

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
Copy link

@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
Copy link

hakufred commented Apr 5, 2022

@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
Copy link

hakufred commented Apr 5, 2022

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
Copy link
Member

liarco commented Apr 6, 2022

@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
Copy link

hakufred commented Apr 6, 2022

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
Copy link

w-zhong commented Apr 13, 2022

截屏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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests