I'm encountering an issue while attempting to deploy a contract using Brownie and publish its source code to Etherscan. The deployment itself is successful, but I'm unable to publish the contract source code due to a ConnectionError with status code 403.
Here's the relevant portion of the error message:
Brownie v1.19.5 - Python development framework for Ethereum BrownieFundMeProject is the active project. Running 'scripts/deploy.py::main'... Transaction sent: 0x50046333f9033506759526a0b24e9bab8e7d9ca21ec925b9b4362d3d90162136 Max fee: 0.001642324 gwei Priority fee: 0.000477748 gwei Gas limit: 400846 Nonce: 11 FundMe.constructor confirmed Block: 5643342 Gas used: 360379 (89.90%) Gas price: 0.000999976 gwei FundMe deployed at: 0xAbC91d45877CF82E34bc982F5737DD16bA34F3bB 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 10, in main deploy_fund_me() File "./scripts/deploy.py", line 6, in deploy_fund_me fund_me = FundMe.deploy({"from": account}, publish_source=True) File "brownie/network/contract.py", line 553, in __call__ return tx["from"].deploy( File "brownie/network/account.py", line 573, in deploy contract.publish_source(deployed_contract, silent=silent) File "brownie/network/contract.py", line 410, in publish_source raise ConnectionError( ConnectionError: Status 403 when querying https://api-sepolia.etherscan.io/: I've already checked my API key and verified that it's correctly configured in my Brownie project settings. Additionally, I've ensured that the API key has the necessary permissions for publishing contract source code. Api Testing: https://api-sepolia.etherscan.io/api?module=account&action=balance&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&tag=latest&apikey=V3SMDEYQ6ZDC311P341NQB8UMI67RKZU6N
I've attempted to retry the deployment script multiple times, but the issue persists. I've also confirmed that there are no ongoing service disruptions or maintenance activities on Etherscan's end.
Here's the deployment script I'm using:
from brownie import accounts, config, FundMe from scripts.helpful_scripts import get_account def deploy_fund_me(): account = get_account() fund_me = FundMe.deploy({"from": account}, publish_source=True) print(f"Contract deployed to {fund_me.address}") def main(): deploy_fund_me() And here is .env file
export PRIVATE_KEY = XXXX export WEB3_INFURA_PROJECT_ID = XXXX export ETHERSCAN_TOKEN = V3SMDEYQ6ZDC311P341NQB8UMI67RKZU6N Could anyone provide insights into what might be causing this ConnectionError with status code 403? Are there any additional troubleshooting steps I can take to resolve this issue?
Any help would be greatly appreciated. Thank you!