How do you configure geth to use coinbase?

  • I'm a novice. I'm looking for instructions on how to configure geth so it sends my mined eth to coinbase.

    In my head, I think the process is:

    1. Sync the blockchain geth --datadir /data/ethData --autodag --verbosity 1
    2. wait for it to finish. Get an ETH address from https://www.coinbase.com/addresses geth --etherbase '0xa4d8e9cae4d04b093aac82e6cd355b6b963fb7ff' --mine
    3. Profit!

    Is that correct?

  • here's what I do on my private Ethereum Testnets (you don't need to create your own network though):

    1. Starting the geth node and entering the JS Console

      geth --networkid XXXX console
      
    2. Creating an account. You'll be asked to provide a passphrase.

      personal.newAccount()
      
    3. Defining your initial/primary account as coinbase:

      miner.setEtherbase(eth.accounts[0])
      
    4. Verify coinbase:

      eth.coinbase
      

    After that's done you can either exit the JS Console or start the mining process by:

    miner.start()
    

    In case DAG wasn't created, it should automatically be created.

    I hope this helps and answers your question!

    Cheers

    Looks like you always create a new account on each worker. Is that correct? If so, that means you move the eth generated from each account/worker to coinbase at a later time. Is that also a correct assumption?

  • Is that correct?

    Yes, that's correct. But...

    ...I think you're conflating two ideas here.

    coinbase.com is a trading/exchange site, which relatively recently added ETH to the currencies it sells.

    A coinbase account - which Ethereum also calls the etherbase - is by default the primary local account. This can, however, be set to any address you wish - it doesn't have to be an account you created on your local machine.

    References:

    Right, totally forgot to take a coinbase.com account into my answer. Thanks for pointing this out here!

    Should you always have a local account for each worker?

    If there isn't a local etherbase account already set up, or if you haven't specified an account (local or otherwise) in the command you use to start the miner, it won't start. Have a look at the instructions at https://github.com/ethereum/go-ethereum/wiki/Mining

    In case it's not clear: Yes, you can create a local etherbase (coinbase) account before you start mining, or you can specify an account/address which you haven't created on your machine, like you specified in your question.

  • If you want a constant coinbase among all nodes, you can simply set the etherbase manually as follows:

    miner.setEtherbase('0xa4d8e9cae4d04b093aac82e6cd355b6b963fb7ff');
    

    AFAIK, you don't even need to have a keystore file, i.e. the specified account does not need to be in eth.accounts, but I'm not sure about this.

  • Yes, that's correct. Etherbase is the "target" account for where to put the reward from mining.

    It's a miner setting:

    MINER OPTIONS:
      --mine                    Enable mining
      --minerthreads value      Number of CPU threads to use for mining (default: 8)
      --etherbase value         Public address for block mining rewards (default = first account created) (default: "0")
      --targetgaslimit value    Target gas limit sets the artificial target gas floor for the blocks to mine (default: 4712388)
      --gasprice "18000000000"  Minimal gas price to accept for mining a transactions
      --extradata value         Block extra data set by the miner (default = client version)
    

    You can specify it when running Geth like this:

    geth --mine --etherbase 0xa4d8e9cae4d04b093aac82e6cd355b6b963fb7ff --gasprice "1000000000"

    gasprice is the minimum price for executing transactions. It's a function of the load on the network.

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM

Tags used