# Difficulty verifying with Hardhat on Windows PowerShell

**URL:** <https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033>\
**Category:** Smart Contracts\
**Created:** [October 2, 2021, 6:58pm UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033 "2021-10-02T18:58:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cainuriel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/cainuriel/32/5410_2.png) [@Cainuriel](https://forum.openzeppelin.com/u/Cainuriel)\
**Post date:** [October 2, 2021, 6:58pm UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/1 "2021-10-02T18:58:26Z")

</div>

Hi @Skyge, First of all, thank you for your infinite patience with everyone, and I hope it doesn't bother you too much.

Well, I have listened to you and I have tried to verify a contract through hardhat.  
I'm happy because this time at least it gives me another error.  
Something more clearer.

```auto
The constructor for contracts/FishervsPirate.sol:FishervsPirate has 3 parameters
but 1 arguments were provided instead.     

```

I have used the following instruction but it is not clear to me if at the end of it the number of arguments has to be specified or not. I have tried with your number and also without putting anything

```auto
npx hardhat verify --network testnet 0x11743D5D71E55A65c2c7760F5536DdE7339be543 

```

I have googled a bit and it is suggested to add in the abi bytecode of the contract arguments.  
I have gone to the next page[https://abi.hashex.org/](https://abi.hashex.org/) and I created the bytecode:

```auto
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000e46697368657276735069726174650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003467650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000096e6f426173655552490000000000000000000000000000000000000000000000

```

Now, it is not commented in which part of the abi it is necessary to place this.

It is true that this time I have not separated the Openzeppellin files and have thus compiled the contract

```auto
//SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";

import "@openzeppelin/contracts/access/Ownable.sol";

// File: contracts/FishervsPirate.sol

contract FishervsPirate is ERC721Enumerable, Ownable  

{   

    

    string public baseURI;

    mapping(uint256 => string) private _tokenURIs;

    mapping(address => bool) private _minters;

        

    bool public saleIsActive = false;

    uint256 public _tokenPrice = 100000000000000000; //0.1 BNB

    

      /**

   * Event for token purchase logging

   * @param purchaser who paid for the tokens

   * @param beneficiary who got the tokens

   * @param value weis paid for purchase

   * @param idToken NFT purchased

   */

  event TokenPurchase(

    address indexed purchaser,

    address indexed beneficiary,

    uint256 value,

    uint256 idToken

  );

  

   /**

   * Event for token purchase logging

   * @param minter who minted tokens

   * @param numberOfTokens number of tokens minted

   */

  event MultipleMint(

    address indexed minter,

    uint256 numberOfTokens,

    uint256 supply

  );

  

   /**

   * Event for token purchase logging

   * @param amount total sale balance

   * @param date collection date

   */

  event WithdrawTime(

    uint256 amount,

    uint256 date

  );

    

    constructor(string memory name, string memory symbol, string memory baseUri) 

    ERC721(name, symbol) 

    {

        setBaseURI(baseUri);

        _minters[msg.sender] = true;

    }

         /**

     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each

     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty

     * by default, can be overriden in child contracts.

     */

    function _baseURI() internal view virtual override returns (string memory) 

    {

        return baseURI;

    }

    function withdraw() public onlyOwner 

    {

        uint256 amount = address(this).balance;

        payable(msg.sender).transfer(amount);

        flipSaleState();

        emit WithdrawTime(amount, block.timestamp);

        

    }

    

    function saleMintToken(address buyer) public payable 

    {

    require(saleIsActive, "Salemint must be active to buy Tokens");

    require(msg.value >= _tokenPrice, "value sent needs to be atleast sale price");

    

        uint256 supply = totalSupply();

        _safeMint(buyer, supply + 1);

        emit TokenPurchase(owner(), buyer, msg.value, supply + 1);

     

    }

    

     function mintToken(uint256 tokensNumber) public  

     {

        require(_minters[msg.sender], "You don't are allowed for minting");

        uint256 supply = totalSupply();

        for (uint256 i = 0; i < tokensNumber; i++) {

            _safeMint(owner(), supply + 1);

            supply++;

        }

        

        emit MultipleMint(msg.sender, tokensNumber, supply);

    }

           /**

         * @dev approve an account for mint

         */

         function setMinterApproved(address minter) public onlyOwner 

    { require(!_minters[minter], "address minter allowed for minting");

        _minters[minter] = true;

    }

    

        /**

         * @dev disapprove an account for mint

         */

         function setMinterDisapproved(address minter) public onlyOwner 

    {

         require(_minters[minter], "address minter not allowed for minting");

        _minters[minter] = false;

    }

    

      /**

     * @dev show all the tokens of the owner.

     */

    function tokensOfOwner(address owner) public view returns (uint256[] memory)

    {

        uint256 ownerTokenCount = balanceOf(owner);

        uint256[] memory tokenIds = new uint256[](ownerTokenCount);

        for (uint256 i; i < ownerTokenCount; i++) {

            tokenIds[i] = tokenOfOwnerByIndex(owner, i);

        }

        return tokenIds;

    }

    function setBaseURI(string memory newBaseURI) public onlyOwner 

    {

        baseURI = newBaseURI;

    }

    

     function setTokenPrice(uint256 tokenPrice) public onlyOwner 

    {

        _tokenPrice = tokenPrice;

    }

    function getBalance() public view onlyOwner returns(uint256)  

    {

        return address(this).balance;

    }

    

    /**

     * @dev See {IERC721Metadata-tokenURI}.

     */

    function tokenURI(uint256 tokenId) public view override returns (string memory) 

    {

        require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");

        string memory _tokenURI = _tokenURIs[tokenId];

        string memory base = _baseURI();

        // If there is no base URI, return the token URI.

        if (bytes(base).length == 0) {

            return _tokenURI;

        }

        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).

        if (bytes(_tokenURI).length > 0) {

            return string(abi.encodePacked(base, _tokenURI));

        }

        return super.tokenURI(tokenId);

    }

    /**

     * @dev Sets `tokenURI` as the tokenURI of `tokenId`.

     *

     * Requirements:

     *

     * - `tokenId` must exist.

     */

    function _setTokenURI(uint256 _tokenId, string memory _tokenURI) public onlyOwner

    {

        require(_exists(_tokenId), "ERC721URIStorage: URI set of nonexistent token");

        _tokenURIs[_tokenId] = _tokenURI;

    }

    

      /*

    * Pause sale if active, make active if paused

    */

    function flipSaleState() public onlyOwner 

    {

        saleIsActive = !saleIsActive;

    }

    

}

```

deployed in testnet: 0x11743D5D71E55A65c2c7760F5536DdE7339be543

Where do I have to specify the contract arguments if that is the error?

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [October 3, 2021, 2:18am UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/2 "2021-10-03T02:18:27Z")

</div>

If you has three parameters, I think it can be

```auto
npx hardhat verify --network testnet 0x11743D5D71E55A65c2c7760F5536DdE7339be543 "parameters1" "parameters2" "parameters3"

```

---

<div class="post-metadata">

**Author:** ![Cainuriel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/cainuriel/32/5410_2.png) [@Cainuriel](https://forum.openzeppelin.com/u/Cainuriel)\
**Post date:** [October 3, 2021, 4:46pm UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/3 "2021-10-03T16:46:39Z")

</div>

> [@Skyge](#):
>
> If you has three parameters, I think it can be

Yes!! I new problem!! This is great!!

We have already learned to parameterize the arguments.

However, a new error is returned to me.

 ![para_mandar](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/3/3a16505de66e5199568d0b39b169d3e2d0bc9198.png)

I don't know if it will be a version problem. I think I have the last one installed.  
` "@nomiclabs/hardhat-etherscan": "^2.1.6"`  
Or should I try separate files?

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [October 4, 2021, 3:30am UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/4 "2021-10-04T03:30:41Z")

</div>

Emmm, maybe you can have a try to use the latest version.

And I just give an example for your case, you should change it for your contract. That is

```auto
npx hardhat verify --network testnet 0x11743D5D71E55A65c2c7760F5536DdE7339be543 "YOUR_CONTRACT_NAME" "YOUR_CONTRACT_SYMBOL" "YOUR_CONTRACT_URI"

```

**it should be your actual parameter value** rather than my example parameter value, so have I made myself clear?

---

<div class="post-metadata">

**Author:** ![Cainuriel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/cainuriel/32/5410_2.png) [@Cainuriel](https://forum.openzeppelin.com/u/Cainuriel)\
**Post date:** [October 4, 2021, 10:02am UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/5 "2021-10-04T10:02:17Z")

</div>

Yes, you speak very clearly. I try to follow his instructions to the letter.

The version I have is latest:

 ![para_mandar](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/e/e54af405327a5afec1b27c1569536114e8362a34.png)

It makes sense to place the values ​​of the parameters. Sorry. Still the same error is returned:

 ![para](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/6/6a129956b4929f083c1f65162ea1dcecdb7731dc.png)

As always thank you very much for your time.

---

<div class="post-metadata">

**Author:** ![Cainuriel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/cainuriel/32/5410_2.png) [@Cainuriel](https://forum.openzeppelin.com/u/Cainuriel)\
**Post date:** [October 14, 2021, 11:52am UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/6 "2021-10-14T11:52:57Z")

</div>

@Skyge  
I again .. sorry

I have detached the files to check if that was the verification error ... I cleaned artifacts folder.  
 ![para_mandar](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/2/26ba8f88c77e591bb1ac81b322e34c4565cc5e8d.png)

I have compiled and deployed perfectly ...

> **[Contract Address 0x9cf7A5eaED74c5dFff7D55e3cfC15ed825B4Bf1b | BscScan](https://testnet.bscscan.com/address/0x9cf7A5eaED74c5dFff7D55e3cfC15ed825B4Bf1b)**
>
> The Contract Address 0x9cf7A5eaED74c5dFff7D55e3cfC15ed825B4Bf1b page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...

And I have placed my arguments the same as in my deployed. Keep giving me error.

 ![para](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/a/aadd7131a4895fcb53e58f6ed27f2a60d4ca4160.png)

My deploy js:

```auto
  // We get the contract to deploy
  const FishervsPirate = await hre.ethers.getContractFactory("FishervsPirate");
  const fishervsPirate = await FishervsPirate.deploy("FishervsPirate", "FvP", "noBaseURI/"); 

```

---

<div class="post-metadata">

**Author:** ![frangio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/frangio/32/15251_2.png) [@frangio](https://forum.openzeppelin.com/u/frangio)\
**Post date:** [October 14, 2021, 6:54pm UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/7 "2021-10-14T18:54:59Z")

</div>

@Cainuriel There is something weird in your output:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/8/826b49d526e2c8ea51059a48a36a797fe1fd68ac.png)

Notice how the URI argument is written as `"noBaseURI\"`. Someone along the way may be switching your forward slash to a backward slash. I don't know if this is the shell itself, Node, npm, or Hardhat.

You can try verifying a deployment using no slashes in the argument. But then you will need ot figure out where the slash is being changed and how to get it to stay a forward slash.

This is clearly related to running the command on a Windows shell. Personally I would strongly recommend using a more Unix-like shell.

---

<div class="post-metadata">

**Author:** ![Cainuriel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/cainuriel/32/5410_2.png) [@Cainuriel](https://forum.openzeppelin.com/u/Cainuriel)\
**Post date:** [October 15, 2021, 12:04pm UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/8 "2021-10-15T12:04:19Z")

</div>

> [@frangio](#):
>
> @Cainuriel There is something weird in your output:
> 
> ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/8/826b49d526e2c8ea51059a48a36a797fe1fd68ac.png)
> 
> Notice how the URI argument is written as `"noBaseURI\"` . Someone along the way may be switching your forward slash to a backward slash. I don't know if this is the shell itself, Node, npm, or Hardhat.
> 
> You can try verifying a deployment using no slashes in the argument. But then you will need ot figure out where the slash is being changed and how to get it to stay a forward slash.
> 
> This is clearly related to running the command on a Windows shell. Personally I would strongly recommend using a more Unix-like shell.

Oh Thank you @frangio very much for your good eye. That was precisely the problem.

I have updated the main message to verify that I entered `/` instead of `\`. Something must be about the windows powershell.

Since the baseUri will be updated later, I have deployed it without using slash. And the verification has been a success !! Thank you.

 ![para_mandar](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/4/489474dfa7e01ccf519d3ca9dd3f0debbb61f8f6.png)

---

<div class="post-metadata">

**Author:** ![Cainuriel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/cainuriel/32/5410_2.png) [@Cainuriel](https://forum.openzeppelin.com/u/Cainuriel)\
**Post date:** [October 18, 2021, 2:49pm UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/9 "2021-10-18T14:49:34Z")

</div>

The problem persists using git bash on windows. I thought that being a linux structure it would work. But it has not been that way.

 ![para_mandar](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/1/111938d623421b9d04632aeefbbefa0b3ea72c05.png)

---

<div class="post-metadata">

**Author:** ![frangio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/frangio/32/15251_2.png) [@frangio](https://forum.openzeppelin.com/u/frangio)\
**Post date:** [October 18, 2021, 6:01pm UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/10 "2021-10-18T18:01:46Z")

</div>

You can define arguments in a JavaScript file as explained in the section [Complex arguments](https://hardhat.org/plugins/nomiclabs-hardhat-etherscan.html#complex-arguments) of the documentation for the plugin.

Alternatively, verify [using JavaScript entirely](https://hardhat.org/plugins/nomiclabs-hardhat-etherscan.html#using-programmatically).

I would expect either of these approaches to fix your problem.

---

<div class="post-metadata">

**Author:** ![Cainuriel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/cainuriel/32/5410_2.png) [@Cainuriel](https://forum.openzeppelin.com/u/Cainuriel)\
**Post date:** [October 18, 2021, 6:35pm UTC](https://forum.openzeppelin.com/t/difficulty-verifying-with-hardhat-on-windows-powershell/17033/11 "2021-10-18T18:35:46Z")

</div>

> [@frangio](#):
>
> You can define arguments in a JavaScript file as explained in the section [Complex arguments](https://hardhat.org/plugins/nomiclabs-hardhat-etherscan.html#complex-arguments) of the documentation for the plugin.

This is the solution. Thank you so much.
