8

I'm trying to verify pn Etherscan my contract, but getting this error. What could it be?

PS C:\Projects\HardHat TS2> npx hardhat verify --network rinkeby 0x9517F72c4b61A07fd0cF684eE7A74C18Eb36dad8
Nothing to compile
No need to generate any newer typings.
An unexpected error occurred:

[Error: ENOENT: no such file or directory, open 'C:\Projects\HardHat TS2\artifacts\build-info\bd5e1b48863d1c1801c0a0353cc35891.json'] {
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\Projects\\HardHat TS2\\artifacts\\build-info\\bd5e1b48863d1c1801c0a0353cc35891.json'
}

contract to verify

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract NFT is ERC721URIStorage {
    constructor() ERC721("NFTforMarket", "NFT") {}

    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    function mint(string memory tokenURI) public returns (uint256) {
        uint256 newItemId = _tokenIds.current();
        _mint(msg.sender, newItemId);
        _setTokenURI(newItemId, tokenURI);
        _tokenIds.increment();
        return newItemId;
    }
}
2
  • I think the first thing you should check is whether or not the .json file is in the expected path. C:\Projects\HardHat TS2\artifacts\build-info\bd5e1b48863d1c1801c0a0353cc35891.json
    – 0xCourtney
    Feb 9, 2022 at 3:48
  • I checked the pass and there is no file with that name. (( so what should I do next? How to use virual machine, is there any tutorials?
    – ra1n89
    Feb 9, 2022 at 13:09

4 Answers 4

26

I got this error too and this worked:

  1. Delete artifacts and cache folders
  2. run npx hardhat compile
  3. then verify
8

You will need to delete the files and recompile:

  1. run npx hardhat clean
  2. run npx hardhat compile
  3. try verify again.

npx hardhat clean deletes cache and artifacts :)

0

I just again used npm install --save-dev @nomiclabs/hardhat-etherscan

0

npx hardhat clean

fixed this problem for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.