1

I am new to Ethereum and trying to setup a private network by using geth command. I have installed geth:

$ geth version
Geth
Version: 1.10.12-stable
Architecture: amd64
Go Version: go1.17.2
Operating System: darwin
GOPATH=
GOROOT=go

I have read some doc about how to launch a node in private network and many mentioned to use a command like geth --datadir=./chaindata/ --ipcpath $HOME/.ethereum/geth.ipc --rpc --rpcapi db,eth,net,web3,personal,miner.

However, I got this error flag provided but not defined: -rpcapi on above command. And I checked the geth doc https://geth.ethereum.org/docs/interface/command-line-options but it doesn't have any option for rpcapi. Is this flag deprecated? what is the alternative one I should use?

In the end, I end up using geth --datadir data/node1 --http --dev --http.corsdomain "*" --http.api web3,eth,debug,personal,net --mine command to launch the node. Is there anything different by using http than rpc?

One issue I have is after I attach to the console, geth attach http://localhost:8545, I can't find miner instance: ReferenceError: miner is not defined. How can I get the miner in order to mine more ether for my accounts?

1 Answer 1

1

Why doesn't geth have --rpcapi option?

Because the --rpc* flags were changed in favor of --http* (--rpc became --http and --rpcapi became --http.api), support for the legacy --rpc* flags was dropped on geth 1.10.9.

How can I get the miner in order to mine more ether for my accounts?

You need to enable the miner namespace too as you did in your first command:

geth --datadir data/node1 --http --dev --http.corsdomain "*" --http.api web3,eth,debug,personal,net,miner --mine
3
  • If you look at my command in the post, I already have --mine but still get the error miner is not defined Commented Nov 27, 2021 at 9:52
  • Look again in the flags following --http.api you did include miner in your first command using --rpcapi but not in the one using --http.api (second command). You are not activating the miner namespace on the http.api.
    – hroussille
    Commented Nov 27, 2021 at 9:55
  • yes, you are 100% correct Commented Nov 27, 2021 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.