上QQ阅读APP看书,第一时间看更新
Connecting to the mainnet network
Nodes in the Ethereum network, by default, communicate using 30303 port. But nodes are also free to listen on some other port numbers.
To connect to the mainnet network, you just need to run the geth command. Here is an example of how to specify the network ID explicitly and specify a custom directory where geth will store the downloaded blockchain:
geth --datadir "/users/packt/ethereum" --networkid 1
The --datadir option is used to specify where to store the blockchain. If it's not provided, the default path is $HOME/.ethereum.
--networkid is used to specify the network ID. 1 is the ID of the mainnet network. If it's not provided, the default value is 1. The network ID of testnet is 2.