1

I'm at the point of a solidity course where I need to get the API key token from etherscan.io.

I followed all the steps, but my code breaks when I use Brownies deploy function with "publish_source".

fund_me = FundMe.deploy({"from": account}, publish_source=True)

and this is the error I get:

Transaction sent: 0xebb78b3dadcaac375f552f1352a32ec435f90ef75a02b10e6ced88133d53bf16
  Gas price: 1.447e-06 gwei   Gas limit: 397829   Nonce: 13
  FundMe.constructor confirmed   Block: 3881378   Gas used: 361663 (90.91%)
  FundMe deployed at: 0xAed87E48d5482b1de09AD0f54D18600BB216c640

  File "eth_brownie-1.19.3-py3.9.egg/brownie/_cli/run.py", line 51, in main
    return_value, frame = run(
  File "eth_brownie-1.19.3-py3.9.egg/brownie/project/scripts.py", line 110, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/deploy.py", line 12, in main
    deploy_fund_me()
  File "./scripts/deploy.py", line 7, in deploy_fund_me
    fund_me = FundMe.deploy({"from": account}, publish_source=True)
  File "eth_brownie-1.19.3-py3.9.egg/brownie/network/contract.py", line 552, in __call__
    return tx["from"].deploy(
  File "eth_brownie-1.19.3-py3.9.egg/brownie/network/account.py", line 557, in deploy
    contract.publish_source(deployed_contract, silent=silent)
  File "eth_brownie-1.19.3-py3.9.egg/brownie/network/contract.py", line 411, in publish_source
    data = response.json()
  File "requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: Expecting value: line 2 column 1 (char 1)

I saw somewhere online that they said perhaps because I'm passing an empty variable, I've got the api key token in my .env file. I tried with wrap it in single quotes, double quotes and no quotes, still nothing. I tried to F12 to go to source but it said "no definition found for publish_source"

Here is the full deploy code:

enter image description here

And I'm running in command line:

brownie run scripts/deploy.py --network sepolia

I tried googling for a solution but I couldn't find anything helpful.

If anyone has any advice or suggestions, I'd be super grateful! Thank you in advance!

4 Answers 4

0

Try checking if you are using the correct explorer URL for Sepolia.

brownie networks add Ethereum sepolia host=https://sepolia.infura.io/v3/$WEB3_INFURA_PROJECT_ID chainid=11155111 explorer=https://sepolia.etherscan.io/
0

A few things to double check to make sure its working correctly:

  1. Run brownie compile to ensure most recent contract is compiled
  2. Ensure environment variable in .env file is named ETHERSCAN_TOKEN
  3. Make sure brownie is updated. Run pip install eth-brownie -U

When you've set this up correctly and run brownie run deploy.py, you'll see this message in the terminal.

Waiting for https://api-sepolia.etherscan.io/api to process contract...
Verification submitted successfully. Waiting for result...
0

Este es un error de actualizacion de brownie referente a los endpoints. Debes verificar que el atributo explorer de la red este correctamente seteado La url actual es https://api-sepolia.etherscan.io/api.

├─Sepolia (Infura)
  │ ├─id: sepolia
  │ ├─chainid: 11155111
  │ ├─explorer: https://api-sepolia.etherscan.io/
  │ ├─host: https://sepolia.infura.io/v3/$WEB3_INFURA_PROJECT_ID
  │ └─provider: infura

Usa el comando brownie networks modify sepolia explorer=https://api-sepolia.etherscan.io/api

SUCCESS: Network 'Sepolia (Infura)' has been modified
  └─Sepolia (Infura)
    ├─id: sepolia
    ├─chainid: 11155111
    ├─explorer: https://api-sepolia.etherscan.io/api
    ├─host: https://sepolia.infura.io/v3/$WEB3_INFURA_PROJECT_ID
    └─provider: infura
1
  • 1
    This is an English only forum. Please, avoid using other languages.
    – Ismael
    Commented Mar 1 at 5:21
0

In my case using this commmand worked

brownie networks modify sepolia explorer=https://api-sepolia.etherscan.io/api
New contributor
Arpit Raj is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

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.