Ethereum Goerli - ethereum

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

Related

How to reference LINK token on (forked) development network without "invalid opcode"?

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...

Rinkeby Etherscan Verification pending then fails

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!

How to connect to Livepeer to Rinkeby network?

I want to run livepeer and for that I need it to get connected to an Ethereum network. There are two options as mentioned here:
Hosted API services
Self hosted Ethereum node
If I want to opt for the latter, how would I mention rinkeby?
Because I only want to use for the test purposes.
The tutorial uses geth as example of the self-hosted Ethereum node.
In the geth manual, you can find the --rinkeby option to connect your node to the Rinkeby network.
Example:
geth --rinkeby --rpc --rpcapi "eth,net,web3"
It seems that the Livepeer doc only shows 1 hyphen (-) for the geth options, but it really should be 2 (--).
Don't forget to change the network option to -network rinkeby on Livepeer start as well.
Example:
livepeer -network rinkeby -ethUrl "http://localhost:8545"

Ethereum : Am I mining to my correct wallet address?

I'm trying to start Ethereum, so I created my wallet first using metamask and I added to geth using private key with this command.
geth account import private_key.txt
After that I run the mining command using geth --mine, so my question is : am I really mining to my correct wallet ?
OPTION 1:
You can set the account your Ethereum miner mines to by running the following in the geth console:
miner.setEtherbase('yourethaddress')
You can also set a local address to mine to using:
miner.setEtherbase(eth.accounts[2])
Replace '2' with the number of your account.
OPTION 2: When starting your geth node you can use the --etherbase flag.
geth --rpc --etherbase 0xC95767AC46EA2A9162F0734651d6cF17e5BfcF10
Using your ETH public address.
More information here: https://geth.ethereum.org/docs/interface/mining

Ethereum deployed contract not defined in Geth Javascript console

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.