smartcontractkit / full-blockchain-solidity-course-py

Ultimate Solidity, Blockchain, and Smart Contract - Beginner to Expert Full Course | Python Edition
MIT License
10.67k stars 2.89k forks source link

i tried verify contract on sepolia testnet but it show error #1861

Open Rhaegar0x00 opened 1 year ago

Rhaegar0x00 commented 1 year ago

I tried deploy and verify on goerli it work but on sepolia ( Add sepolia using infura api ) it shows :

Transaction sent: 0x574214495409706e1e0c946f2a8bc0030b73bac140d290c9b87c45ada398f8ca Gas price: 2.726061052 gwei Gas limit: 449772 Nonce: 53 FundMe.constructor confirmed Block: 3244279 Gas used: 408884 (90.91%) FundMe deployed at: 0x7C4dB3AaDfDD4E94f9E0DcC92716d1caf6be83e0

File "D:\python3_10\lib\site-packages\brownie_cli\run.py", line 51, in main return_value, frame = run( File "D:\python3_10\lib\site-packages\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_FundMe() File ".\scripts\deploy.py", line 7, in deploy_FundMe fund_me = FundMe.deploy({"from": account}, publish_source=True) File "D:\python3_10\lib\site-packages\brownie\network\contract.py", line 549, in call return tx["from"].deploy( File "D:\python3_10\lib\site-packages\brownie\network\account.py", line 557, in deploy contract.publish_source(deployed_contract, silent=silent) File "D:\python3_10\lib\site-packages\brownie\network\contract.py", line 408, in publish_source data = response.json() File "D:\python3_10\lib\site-packages\requests\models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) JSONDecodeError: Expecting value: line 2 column 1 (char 1) PS E:\solidity_learn\brownie_fund_me>

Contract deployed but seem like brownie have some error when verifying contract

Stefs-2142 commented 1 year ago

Got same error with sepolia

hbarrabasqui commented 1 year ago

I have a similar problem. The Rinkeby network is no longer working, I am using the Sepolia network. Up to now things have worked, but when I want to verify a contract problems come up. I have used the Keys API from etherscan.io . I add these API Keys to the .env file as explained in Vasiliy Gualoto's video time 6:27 (https://www.youtube.com/watch?v=yN3zpI3sNAE&t=23701s&ab_channel=Chainlink). I also updated the deploy.py file, but when executing the command in the terminal I get an error that I don't know how to solve. Here I show you the command and the result


(brownieProjects) horacio@DESKTOP-DJSHN39:~/demos/brownie_fund_me$ brownie run scripts/deploy.py --network sepolia Brownie v1.19.3 - Python development framework for Ethereum

BrownieFundMeProject is the active project.

Running 'scripts/deploy.py::main'... Transaction sent: 0x4c9bf09e62deb5618416c4211327450e04766cc03b1428ded9efb8d1307af823 Gas price: 1.00000001 gwei Gas limit: 396416 Nonce: 48 FundMe.constructor confirmed Block: 3465410 Gas used: 360379 (90.91%) FundMe deployed at: 0x11796C04C240b34b9B4963EC05D646dE66F62540

File "brownie/_cli/run.py", line 51, in main return_value, frame = run( File "brownie/project/scripts.py", line 110, in run return_value = f_locals[method_name](*args, **kwargs) File "./scripts/deploy.py", line 15, in main deploy_fund_me() File "./scripts/deploy.py", line 11, in deploy_fund_me fund_me = FundMe.deploy({"from":account}, publish_source=True) File "brownie/network/contract.py", line 549, in call return tx["from"].deploy( File "brownie/network/account.py", line 557, in deploy contract.publish_source(deployed_contract, silent=silent) File "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 (brownieProjects) horacio@DESKTOP-DJSHN39:~/demos/brownie_fund_me$


Somebody has the same problem? I do not know what is the meaning of "Explorer API not set for this network". Thank you!!

hbarrabasqui commented 1 year ago

I forgot to indicate that I added the sepolia network to Brownie and it is displayed like this:

The following networks are declared:

Ethereum ├─Mainnet (Infura): mainnet ├─Ropsten (Infura): ropsten ├─Rinkeby (Infura): rinkeby ├─Goerli (Infura): goerli ├─Kovan (Infura): kovan └─sepolia: sepolia

Ethereum Classic ├─Mainnet: etc └─Kotti: kotti . . . Is it correct to see it like this? Could there have been an error adding it? Thank you!!

mule-codex commented 1 year ago

what alternatives to rinkeby network can I use?

Rhaegar0x00 commented 1 year ago

I find the right way to add sepolia to brownie , just use it and everything will be fine : brownie networks add Ethereum sepolia2 host='https://sepolia.infura.io/v3/$WEB3_INFURA_PROJECT_ID' chainid=11155111 explorer=https://api-sepolia.etherscan.io/api I think we missed explorer for evm know where do you want to verify contract

hbarrabasqui commented 1 year ago

For my problem, after searching a lot, I found a solution and I was finally able to verify the smart contract in brownie. I went into .brownie\network-config and replaced the sepolia data with the following:


-chainid: 11155111 explorer: https://api-sepolia.etherscan.io/api host: https://sepolia.infura.io/v3/$WEB3_INFURA_PROJECT_ID id:sepolia multicall2: '0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696' name: Sepolia (Infura) provider: infura


I redisplayed the contract and brownie verified it. I could check it at https://sepolia.etherscan.io/

I found this information at: https://ethereum.stackexchange.com/questions/147238/infura-network-support-for-sepollia-in-brownie

marginalfriend commented 9 months ago

I have kinda similar error with @hbarrabasqui it says

ValueError: Explorer API not set for this network

And I figured out how to set the explorer API. You just have to modify the network through the terminal:

\brownie_fund_me> brownie networks modify sepolia explorer=https://api-sepolia.etherscan.io/api

If your sepolia network has the same name as mine, it is supposed to be working well