(based on 1.6.1)
> geth [options] command [command options] [args....]
- Configuration (paths, etc.)
- API & Console (port for console, etc.)
- Misc. (help...)
- Account
- Gas price (don't mess with)
- Miner
- Performance tuning
- VM (Ethereum VM)
- Networking
- Logging, debugging (a lot geared towards developers)
- Expermental
- --help
- --netrestrict : restrict communication to given IP networks
- --verbosity : 0=silent 1=error. 6 max
- --identity "MyCustomIDName"
- --datadir : chain data & other house keeping files
- --keystore :
- --networkid : 1=live (default), 3=testnet (ropsten), private = user assigned
- --testnet (equals --networkid 3)
- --syncmode
- "fast"(download without verify?) "full" "light" (no download, depend on other full node)
- --dev : developer mode, private network, multiple debug flags
- --unlock "comma separated list of address/index" (otherwise all locked by default)
- --password "password file" (start from #0, one password a line)
- mining options
- --mine : enable mining
- -- minerthreads : default=8
- --etherbase : address of reward account, default = #0
- --gasprice "value" : minimal gas accepted (default 2E10)
- --extradata "somedata" : block extra data by miner, default = client miner
- --targetgaslimit "value" : (later...)
- File management (export/import)
- Database (remove, update...)
- Console interface (interact with running geth instance)
- Version, help, license
- Init - a new private chain
- Account - creating/managing aeccounts
List of some commands:
- version
- help
- license
- console (start JavaScript console)
- options
- --preload "files,.,."
- --jspath
- --exec "JS statement" ex: geth --exec "personal.listAccounts" console
- console commands
- admin : information, datadir
- attach
- IPC-RPC : attach "pipe address"
- JSON-RPC : attach "http://....:8545"
- WS-RPC: attach "ws://....:8546"
- account
- account new
- key file generated under key file dir
- UTC--datetime--address
- ok to copy keystore file (like import)
- account list
- account update (password)
- account import (or just copy key files)
- exit
- IPC-RPC
- enabled by default
- Used by local Dapp (not over network)
- API include: admin, web3, miner..... (many more)
- --ipcdisable
- --ipcvalue : enable/disable api (all enabled by default)
- --ipcpath : "geth.ipc"
- JSON-RPC / WS-RPC
- disabled by default
- API: exposed by default (only 3 for security reason) eth, web3, net
- JSON
- default: http, port 8545
- --rpc : enable JSON-RPC (maybe not good practice, user admin object instead)
- --rpcapi :default = eth,web3,net
- --rpcaddr, --rpcport
- --rpccorsdomain "domains,.," or "*" (any)
- WS-RPC (maybe not good practice, user admin object instead)
- default: tcp port 8546
- --ws : enable
- --wsapi
- --wsaddr, --wsport
- Can execute javascript code
- Invoke management API
- Support interactive / non-interactive mode
- for building Dapp
- function groups
- .eth : Ethereum blockchain related methods (shorthand: eth)
- .net : Node's network status (shorthand: net)
- net.listening (return true/false)
- .db : get/put for local LevelDB
- .shh : P2P messaging using Whisper
Transaction pools (txpool) and Account Nonce
- every transaction under an account has a unique nonce (nonce to prevent replay attack)
- normally not specified and start from 0 and counting
- personal.sendTransaction() can specify a nonce
- transaction goes to
- in sequence (=last_nonce+1) : go pending pool
- not in sequence: go Queued pool
- pending pool :
- transactions ready to be mined (but not yet have been),
- come from any account across the Ethereum network,
- once mined will be removed from the queue
- queued pool :
- transaction from local node
- held locally, not persisted (restart geth will lose it)
- been initiated but are not ready to be mined
- with a nonce larger than next sequence (say, 210 instead of 200)
- once some transactions have been sent so next nonce is the one in queued pool, it's moved to pending pool
- https://github.com/ethereum/go-ethereum/wiki/Management-APIs
- admin (object)
- node management, such as setting RPC parameters
- node information
- commands
- .nodeInfo (version, name, enode url: for add this as peer to other node)
- .datadir
- .peers
- addPeers(url) (may configure topology of a private peers network)
- .exportChain(file), .importChain(file) - avoid synchronizing a new node
- .startRPC("localhost",8545,"web3") - host, port, APIs
- .stopRPC
- .startWS(...) .stopWS()
- .setSolc('path to compiler')
- personal (object)
- account management
- commands
- .newAccount("pass")
- .listAccount
- (to delete account just remove key file)
- .importRawKey(keydata, password) - import raw private key
- .unlockAccount() / .lockAccount()
- .sendTransaction(txt_object{from:"xxx",to:"xxxx", value: wei_value, nonce : optional) : note NOT in ETH!!! in WEI!!! we3.toWei() converts from ETH to wei
- transaction object
- from : from account address
- to : to account address
- amount : amount
- nonce : optional, nonce
- data : optional data
- miner (object)
- .start(num_threads) .stop() = --mine, --minethreads
- .setEtherbase(addr) = --etherbase
- miner.setEtherbase(personal.listAccounts[1])
- .setGasPrice(num) = --gasprice "value"
- .setExtra() = --extradata
- txpool (object)
- transaction pool (list pending tx, etc.)
- .status - show counts in pending & queued pools
- .inspect - summaries of transactions - including (from) addresses of transactions
- .content - details of transactions
- debug (object) (non-stadard)
- information
- .verbosity(level) - set verbosity of the node (dump to node console)
- .dumpBlock(number) - not typical on console, output a lot of data
- .traceBlockByNumber(number) .traceBlockByHash(hash) : replay the block (validate)
- .traceTransaction(txHash...) " a lot of dump of opcode executed & storage state
- performance
- .gcStats() : garbage collection
- .memStats() : memory usage
- cpu profile methods, etc.
- go code level debug methods (not for typical dapp developers but for geth client developers)