Syncing a public node - cogeorg/teaching GitHub Wiki
Obviously, you can also use geth
to connect to a public network by running a node, either on a test network or the Mainnet.
Running a Ropsten Node
Ropsten is a public proof-of-work Ethereum test network.
Create a folder that will contain the database and the accounts for your Ropsten node
$ mkdir -p Ethereum/ropsten
$ cd Ethereum/ropsten
Now run
$ geth --testnet --datadir "." --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal,admin --rpcport 8545
It will sync the data within the ropsten directory.
You may want to choose another syncmode
, depending on you trust needs:
--syncmode light
: Synchronizes block headers for a light client with the Ethereum network using the Light Ethereum Subprotocol (LES) starting at a trusted checkpoint inserted by the developers--syncmode fast
: Synchronizes a full node doing a fast synchronization by downloading the entire state database, requesting the headers first, and filling in block bodies and receipts afterward.--syncmode full
: Synchronizes a full node starting at genesis verifying all blocks and executing all transactions. This mode is a bit slower than the fast sync mode but comes with increased security.
Running a Rinkeby Node
Rinkeby is a public proof-of-authority Ethereum test network.
Create a folder that will contain the database and the accounts for your Rinkeby node
$ mkdir -p Ethereum/rinkeby
$ cd Ethereum/rinkeby
Now run
$ geth --rinkeby --datadir "." --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal,admin --rpcport 8545
It will sync the data within the rinkeby directory.
Running a Mainnet Node
The main network uses the proof-of-work consensus algorithm.
Create a folder that will contain the database and the accounts for your Mainnet node
$ mkdir -p Ethereum/mainnet
$ cd Ethereum/mainnet
Now run
$ geth --datadir "." --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal,admin --rpcport 8545
Check geth --help
to find out more about how to mine.
If you want to be able to run geth attach
, also specify --ipcpath "~/.ethereum/geth.ipc"
(Linux) or --ipcpath "~/Library/Ethereum/geth.ipc"
(MacOS). However, keep in mind that it takes some time (and space!) to sync the nodes and only when that is finished, you can attach to them.