Linux command
geth 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start Ethereum node
geth
Sync mainnet
geth --syncmode [snap]
Start with console
geth console
Attach to running
geth attach
Create new account
geth account new
说明
geth (go-ethereum) is the official Go implementation of the Ethereum protocol. It runs a full Ethereum node, enabling blockchain synchronization, transaction validation, mining operations, and smart contract deployment. The client provides multiple sync modes: "snap" for fast syncing with state snapshots and "full" for complete blockchain validation. Light sync mode is deprecated and non-functional since the Merge to proof-of-stake. It exposes JSON-RPC APIs over HTTP, WebSocket, and IPC for application integration. geth includes an interactive JavaScript console for direct blockchain interaction, account management for creating and managing Ethereum wallets, and support for both mainnet and test networks. It's the most widely used Ethereum client for running production nodes and development environments.
参数
- --syncmode _MODE_
- Sync mode: full, snap (light mode is deprecated post-Merge).
- --datadir _PATH_
- Data directory.
- --http
- Enable HTTP RPC.
- --ws
- Enable WebSocket RPC.
- console
- Interactive JavaScript console.
- attach
- Attach to running node.
- account _CMD_
- Account management.
- --port _PORT_
- Network listening port (default: 30303).
- --maxpeers _N_
- Maximum number of network peers.
- --networkid _ID_
- Network identifier (1=mainnet, 5=goerli).
- --goerli
- Connect to Goerli test network.
- --sepolia
- Connect to Sepolia test network.
- --help
- Display help information.
FAQ
What is the geth command used for?
geth (go-ethereum) is the official Go implementation of the Ethereum protocol. It runs a full Ethereum node, enabling blockchain synchronization, transaction validation, mining operations, and smart contract deployment. The client provides multiple sync modes: "snap" for fast syncing with state snapshots and "full" for complete blockchain validation. Light sync mode is deprecated and non-functional since the Merge to proof-of-stake. It exposes JSON-RPC APIs over HTTP, WebSocket, and IPC for application integration. geth includes an interactive JavaScript console for direct blockchain interaction, account management for creating and managing Ethereum wallets, and support for both mainnet and test networks. It's the most widely used Ethereum client for running production nodes and development environments.
How do I run a basic geth example?
Run `geth` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --syncmode _MODE_ do in geth?
Sync mode: full, snap (light mode is deprecated post-Merge).