Search code examples
geth

Flag provided but not defined: -rpc


Am starting off in blockchain development using the book Mastering Blockchain - A deep dive into distributed ledgers, consensus protocols, smart contracts, DApps, cryptocurrencies, Ethereum,

Am using WSL with geth version 1.10.9.

$geth version
Geth
Version: 1.10.9-stable
Git Commit: eae3b1946a276ac099e0018fc792d9e8c3bfda6d
Architecture: amd64
Go Version: go1.17
Operating System: linux
GOPATH=
GOROOT=go

Am trying to start geth, but am getting the error that the --rpc flag is not defined.

This is the command I am trying to run:

geth --datadir ~/etherprivate/ --networkid 786 --rpc --rpcapi 'web3,eth,net,debug,personal' --rpccorsdomain '*'

Any help on how I can solve it?


Solution

  • The latest versions of Geth (after 1.10.8-stable) do not support --rpc but fortunately, as you can see in the Command-line Options, it has been replaced by the --http option. So your command should look like this:

    geth --datadir ~/etherprivate/ --networkid 786 --http --http.api 'web3,eth,net,debug,personal' --http.corsdomain '*'
    

    With all rpc options replaced by their http equivalent:

    • --rpc => --http
    • --rpcapi => --http.api
    • --rpccorsdomain => --http.corsdomain