I've seen similar questions but none with a working answer unfortunately. I'm following along with the Brownie FundMe tutorial from freecodecamp youtube and my etherscan verification won't work.
Here is the output from 'brownie run scripts/deploy.py --network rinkeby':
Brownie v1.18.1 - Python development framework for Ethereum
BrownieFundMeProject is the active project.
Running 'scripts\deploy.py::main'...
Transaction sent: 0x925b177f8eca7584fd66d7b52ddb477634625abaa39679f80998769519fd4a4f
Gas price: 1.000000011 gwei Gas limit: 513271 Nonce: 22
FundMe.constructor confirmed Block: 10289582 Gas used: 466610 (90.91%)
FundMe deployed at: 0xf50aA945B5fd2e6336631B71a5929A09a21a741E
Waiting for https://api-rinkeby.etherscan.io/api to process contract...
Verification submitted successfully. Waiting for result...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification pending...
Verification complete. Result: Fail - Unable to verify
Contract deployed to 0xf50aA945B5fd2e6336631B71a5929A09a21a741E
And here is my script (the wait statement was suggested in another thread but didn't work):
from brownie import FundMe
from .helpful_scripts import get_account
def deploy_fund_me():
account = get_account()
fund_me = FundMe.deploy({"from": account}, publish_source=True)
# fund_me.wait(1)
print(f"Contract deployed to {fund_me.address}")
def main():
deploy_fund_me()
Finally, the config file:
dependencies:
# - <organization/repo>#<version>
# https://github.com/smartcontractkit/chainlink-brownie-contracts
- smartcontractkit/chainlink-brownie-contracts#0.4.0
compiler:
solc:
remappings:
- '#chainlink=smartcontractkit/chainlink-brownie-contracts#0.4.0'
dotenv: .env
wallets:
from_key: ${PRIVATE_KEY}
What am I doing wrong that's causing this to fail? The contract clearly deploys but the etherscan verification is failing.
Any advice would be greatly appreciated.
Brownie v1.18.1
Python v3.9.7
Solidity >=0.8.0
I went through his course also, so I see where you're stuck, I would check to make sure the API key was imported correctly from Etherscan as this is a verification issue. Take a look at your .env file, let me know if you're still dealing with an issue!
Related
I've run the Ethereum Goerli Network with the following command:
geth --goerli --datadir="/mnt/sdc1/ethereum/goerli/" --port="30304" --cache 4096 --http --http.addr="0.0.0.0" --http.port="8546" --http.vhosts="*" --http.corsdomain="*" --http.api="admin, debug, web3, eth, txpool, personal, clique, miner, net" --authrpc.jwtsecret=/tmp/jwtsecret --authrpc.vhosts="*" --authrpc.port=8553 --allow-insecure-unlock --mine --miner.threads=4 --miner.etherbase '0x...'
with enabled miner and etherbase, but mining is not started.
I've seen the next in logs:
INFO [07-07|19:01:18.501] Commit new sealing work number=7,186,017 sealhash=3033a3..979541 uncles=2 txs=22 gas=29,479,757 fees=0.04464585701 elapsed=108.735ms
WARN [07-07|19:01:18.501] Block sealing failed err="unauthorized signer"
What's wrong?
How can I enable mining in Ethereum Goerly Network?
Thank's
As of August 11th, 2022, the Goerli network "merged" to be proof-of-stake network secured by validators who stake testnet ETH tokens rather than by miners.
There is a guide on how to become a Goerli validator here, if interested: https://coinmarketcap.com/alexandria/article/how-to-set-up-an-eth-2-0-validator-on-goerli-testnet
I like to run a number of local tests. Everything works well on rinkeby and other test chains. However, the local development chain disagrees with my configuration.
When I run a forked development network:
brownie console --network mainnet-fork
The ganache-cli initiates as expected:
Brownie v1.18.1 - Python development framework for Ethereum
BlockchainProject is the active project.
Launching 'ganache-cli --accounts 10 --hardfork istanbul --fork https://mainnet.infura.io/v3/6a633a4ecae8449abbc69974cdd3a9b9 --gasLimit 12000000 --mnemonic brownie --port 8545 --chainId 1'...
Brownie environment is ready.
However, even the most simple contract interaction fails:
>>> link_token = Contract.from_explorer("0x514910771AF9Ca656af840dff83E8264EcF986CA")
Fetching source of 0x514910771AF9Ca656af840dff83E8264EcF986CA from api.etherscan.io...
>>> accounts[0].balance()
100000000000000000000
>>> accounts[1].balance()
100000000000000000000
>>> link_token.transfer(accounts[0].address, 100, {'from': accounts[0].address})
Transaction sent: 0x1542b679e4d09b2f4523427c7f5048ed01ee0d194c34cd27b82bbd177e1b3f23
Gas price: 0.0 gwei Gas limit: 12000000 Nonce: 2
LinkToken.transfer confirmed (invalid opcode) Block: 14604608 Gas used: 12000000 (100.00%)
<Transaction '0x1542b679e4d09b2f4523427c7f5048ed01ee0d194c34cd27b82bbd177e1b3f23'>
Since the Link token is compiled with an unsupported compiler I do not get any further information on why this results in LinkToken.transfer confirmed (invalid opcode).
How do I (correctly) run chainlink code against a forked development network using brownie - am I missing a step such as funding??
My networks: configuration in brownie-config.yaml:
networks:
mainnet-fork:
vrf_coordinator: '0xf0d54349aDdcf704F77AE15b96510dEA15cb7952'
link_token: '0x514910771AF9Ca656af840dff83E8264EcF986CA'
keyhash: '0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445'
I did try to rm -rf build but that does not change anything.
System environment:
Brownie v1.18.1
Node 8.5.5
Ganache v7.0.4
21.3.0 Darwin Kernel Version (macOS 12.2.1)
Python 3.9.7
In this instance, the account used for Link token funding does not have any Link. For some reason, the transaction does not get reverted but the unlock: option of brownie provides assistance.
First adjusting the networks:settings to include an arbitrary account with a large Link balance:
mainnet-fork:
cmd_settings:
unlock:
- 0xf37c348b7d19b17b29cd5cfa64cfa48e2d6eb8db
vrf_coordinator: '0xf0d54349aDdcf704F77AE15b96510dEA15cb7952'
link_token: '0x514910771AF9Ca656af840dff83E8264EcF986CA'
keyhash: '0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445'
Second, run a mainnet-fork as before:
brownie console --network mainnet-fork
Third, confirm that the unlocked account is available and funded:
>>> accounts[10]
<Account '0xF37C348B7d19b17B29CD5CfA64cfA48E2d6eb8Db'>
>>> accounts[10].balance()
426496436000000000
Fourth, instantiate the contract of the token, Link in this instance:
link_token = Contract.from_explorer("0x514910771AF9Ca656af840dff83E8264EcF986CA")
Finally, transfer Link from the unlocked account to some other account (or contract):
link_token.transfer(accounts[0], 20, {"from": accounts[10]})
Alternatively, funding the mainnet address with Link, or even unlocking the Link owner and minting new Link would work too...
I have created and compiled a smart contract and created my deploy token file as well. When I run ganache-cli on one terminal it gives me '''eth_getTransactionByHash''' and while the brownie run scripts is running on the other terminal it says '''awaiting transaction from mempool'''
I logged into my MetaMask account as well and created a new Account with the RPC and chain ID provided.
Please help.
I had the same issue when running ganache-cli. I fixed it by passing some parameters
ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie
We're using web3 to connect to the rinkeby test ethereum network. When doing so through geth, via localhost, with the below web3 command:
var web3 = new Web3('http://localhost:8545');
We don't get any errors. We use this command to start geth:
geth --rinkeby --rpc --rpcapi="personal,eth,network,web3,net" --ipcpath "~/Library/Ethereum/geth.ipc"
However when we try using the rinkeby test network directly:
var web3 = new Web3('https://rinkeby.infura.io/');
We get this error:
Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (errors.js:42)
at XMLHttpRequest.request.onreadystatechange (index.js:73)
at XMLHttpRequest.dispatchEvent (event-target.js:172)
at XMLHttpRequest.setReadyState (XMLHttpRequest.js:546)
at XMLHttpRequest.__didCompleteResponse (XMLHttpRequest.js:387)
at XMLHttpRequest.js:493
at RCTDeviceEventEmitter.emit (EventEmitter.js:181)
at MessageQueue.__callFunction (MessageQueue.js:353)
at MessageQueue.js:118
at MessageQueue.__guardSafe (MessageQueue.js:316)
Most of the operations work on both networks, but .send() calls fail when connecting to the rinkeby network directly.
We think it's an issue with authentication, since other commands succeed that don't perform transactions. However, we tried using the HDWalletProvider and none of our accounts created via geth have mnemonics.
Any advice or troubleshooting steps would be appreciated. Thanks
Transactions have to be signed. When you send a transaction via your local geth node, it knows the private key corresponding to the address you're sending from, so it can sign the transaction for you (once you unlock the account).
A public node like Infura (fortunately!) doesn't know your private key, so it can't sign transactions for you. You'll need to sign them locally and then send them using sendSignedTransaction.
I cannot access a deployed and mined Ethereum contract on a private network from the Geth Javascript console. Not sure where the issue is, any help is appreciated.
Thank you in advance for your time.
Scenario
I launched my Geth as below
geth --datadir ~/.ethereum/myProject --networkid 1234 --rpc --rpcport 8546 --rpcapi "eth,net,web3" --unlock 0 console
I've deployed and mined an Ethereum contract (to simplify things, I've used the default MetaCoin contract provided by Truffle), and I got the trx and contract address back.
I can access it from the Truffle console but if I try from the Geth Javascript console I get an error.
Please refer to the pictures below:
Truffle console
Geth javascript console
Software used
Geth (v1.7.3-stable)
NodeJS (v6.12.3)
TestRPC (v6.0.3 (ganache-core:2.0.2))
Truffle (v4.0.5)
Geth does not know about MetaCoin. In Geth console, you need to do:
var MetaCoin = web3.eth.Contract(metaCoinJsonAbi, itsAddress);
// or web3.eth.contract depending on the version of Web3
Then you can use it. Refer to this.