I am trying to deploy a solidity contract with the source code to a Sepolia test net, using Brownie. The contract deploys successfully, but the source code does not. I keep getting this error.

  File "C:\Users\drew_\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\_cli\run.py", line 51, in main
    return_value, frame = run(
  File "C:\Users\drew_\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\scripts.py", line 110, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File ".\scripts\deploy.py", line 15, in main
  File ".\scripts\deploy.py", line 7, in deploy_fund_me
    fund_me = FundMe.deploy(
  File "C:\Users\drew_\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\contract.py", line 549, in __call__
    return tx["from"].deploy(
  File "C:\Users\drew_\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\account.py", line 557, in deploy
    contract.publish_source(deployed_contract, silent=silent)
  File "C:\Users\drew_\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\contract.py", line 338, in publish_source
    raise ValueError("Explorer API not set for this network")
ValueError: Explorer API not set for this network

I have set the export ETHERSCAN_TOKEN inside my .env file and I have added my .env to the brownie-config

Here is my brownie-config:

  - smartcontractkit/[email protected] 
  - OpenZeppelin/[email protected]
      - "@chainlink=smartcontractkit/[email protected]"
      - "@openzeppelin=OpenZeppelin/[email protected]"
dotenv: .env
    from_key: ${PRIVATE_KEY}
    explorer: https://api-sepolia.etherscan.io/
    verify: True

- name: Ethereum
  - name: sepolia
    chainid: 11155111
    id: sepolia
    host: https://mainnet.infura.io/v3/{myKey}
    explorer: https://api-sepolia.etherscan.io/

1 Answer 1


Not only you have to add the sepolia network to the brownie-config.yaml

Also you must add the sepolia network to the networks with the explorer included, i.e. via cmd line:

brownie networks add Ethereum sepolia host="https://sepolia.infura.io/v3/{your id}" chainid=11155111 explorer=https://api-sepolia.etherscan.io/api

Also, make sure you have the ETHERSCAN token correctly added on your .env file

hope it works. It worked on mine.

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.