Ein Node ist ein Computer, der Teil des Ethereum-Netzwerkes ist. Dieser speichert entweder eine unvollständige (Light Client, (Downloads all block headers, block data, and verifies some randomly)) oder vollständige (Full Node ( Downloads all blocks (including headers, transactions, and receipts) and generates the state of the blockchain incrementally by executing every block)) Kopie der Blockchain und schreibt diese permanent fort.
Da ich noch einen alten Raspberry Pi 2 B+ liegen hatte, habe ich da mal einen Light Node drauf installiert. Das geht mit dem Proof-of-Work Client Geth der für alle (viele) Betriebssystem vorliegt. …
Vorbedingung
Es muss die aktuelle Raspberry Pi OS Lite (32-Bit) Version Bullseye vom 30.10.2021 installiert sein.
Es wird nur ein SSH Zugang benötigt, da wir ohne GUI arbeiten. Die SD-Karte muss auch nicht groß sein, und man braucht keine SSD bzw. Festplatte da der Light Node bisher nur ca. 400 MB benötigt. Eine 16 oder 32GB Karte reicht also. Hier das aktuelle Verzeichnis mit Größenangaben:
Geth installieren
Zuerst wollen wir Geth installieren. Dazu müssen wir uns auf der Downloadseite die für unseren Pi Passende Version raus suchen.
Da ich ein arm6 Raspberry Pi 2 B+ verwende, kann ich die Linux stable release Version Geth 1.10.13 verwenden.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# Temp. Verzeichnis anlegen und dahin wechseln mkdir geth cd geth # Version muss zum Pi passen, hier die arm6 Version wget https://gethstore.blob.core.windows.net/builds/geth-linux-arm6-1.10.13-7a0c19f8.tar.gz # (optional) dann die Signatur runterladen https://gethstore.blob.core.windows.net/builds/geth-linux-arm6-1.10.13-7a0c19f8.tar.gz.asc # (optional) die MD5 Checksumme muss 4b8408b0fe924568cc8f2476fbd7ab2a sein, also md5sum geth-linux-arm6-1.10.13-7a0c19f8.tar.gz # Ergebnis # 4b8408b0fe924568cc8f2476fbd7ab2a geth-linux-arm6-1.10.13-7a0c19f8.tar.gz # Also Signatur ok # auspacken des Programm Archives sudo tar -xf geth-linux-arm6-1.10.13-7a0c19f8.tar.gz # ins das ausgepackte Verzeichnis wechseln und nach /usr/local/bin verschieben cd geth-linux-arm6-1.10.13-7a0c19f8/ sudo mv geth /usr/local/bin/ # temp Geth Verzeichnis wieder löschen, Ordnung muss sein cd .. cd.. sudo rm -rf geth/ # Checken ob Geth läuft mit der Versionsausgabe geth version # Ausgabe: # Geth # Version: 1.10.13-stable # Git Commit: 7a0c19f813e285516f4b525305fd73b625d2dec8 # Git Commit Date: 20211124 # Architecture: arm # Go Version: go1.17.2 # Operating System: linux # GOPATH= # GOROOT=go # Also Geth läuft schon mal |
Blockchain anlegen
(Optional) Um eine private Blockchain zu erzeugen, muss erst eine Datei mit dem sog. Genesis-Block angelegt werden.
1 2 3 4 5 6 |
# ein leers neues Verzeichnis für die Blockchain anlegen mkdir blockchain cd blockchain/ # die Genesis Block Datei anlegen touch genesis.json |
Dann in der genesis.json Datei den folgenden Inhalt einfügen:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
{ "coinbase" : "0x0000000000000000000000000000000000000001", "difficulty" : "0x20000", "extraData" : "", "gasLimit" : "0x8000000000", "nonce" : "0x0000000000000042", "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp" : "0x00", "alloc": {}, "config": { "chainId": 1337, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0, "EIP150Block":0, "ByzantiumBlock":0 } } |
Optional evl. noch die chainId anpassen, wenn nicht die default Chain Id verwenden werden soll:
1 Ethereum mainnet
2 Morden (disused), Expanse mainnet
3 Ropsten
4 Rinkeby
5 Goerli
42 Kovan
1337 Geth private chains (default)
Init Blockchain
(Optional) Nun einmalig ein init der Blockchain mit der genesis.json aufrufen, wenn eine eigene private Blockchain verwendet werden soll.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
sudo geth --datadir blockchain init genesis.json # Ergebnis: INFO [12-20|16:18:11.310] Maximum peer count ETH=50 LES=0 total=50 INFO [12-20|16:18:11.321] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory" WARN [12-20|16:18:11.371] Sanitizing cache to Go's GC limits provided=1024 updated=143 INFO [12-20|16:18:11.392] Set global gas cap cap=50,000,000 INFO [12-20|16:18:11.402] Allocated cache and file handles database=/home/pi/blockchain/blockchain/geth/chaindata cache=16.00MiB handles=16 INFO [12-20|16:18:11.552] Writing custom genesis block INFO [12-20|16:18:11.576] Persisted trie from memory database nodes=0 size=0.00B time="97.999µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B INFO [12-20|16:18:11.593] Successfully wrote genesis state database=chaindata hash=0a92c2..fea866 INFO [12-20|16:18:11.596] Allocated cache and file handles database=/home/pi/blockchain/blockchain/geth/lightchaindata cache=16.00MiB handles=16 INFO [12-20|16:18:11.702] Writing custom genesis block INFO [12-20|16:18:11.716] Persisted trie from memory database nodes=0 size=0.00B time="74.999µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B INFO [12-20|16:18:11.746] Successfully wrote genesis state database=lightchaindata hash=0a92c2..fea866 |
Sync. bzw. starten der Blockchain
Nun kommen wir zum starten der Blockchain.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
geth --syncmode light --cache 64 --maxpeers 12 --http #Ergebnis: INFO [12-20|16:19:37.265] Starting Geth on Ethereum mainnet... INFO [12-20|16:19:37.478] Maximum peer count ETH=0 LES=10 total=12 INFO [12-20|16:19:37.486] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory" INFO [12-20|16:19:37.533] Set global gas cap cap=50,000,000 INFO [12-20|16:19:37.540] Allocated cache and file handles database=/home/pi/.ethereum/geth/lightchaindata cache=32.00MiB handles=524,288 INFO [12-20|16:19:37.662] Allocated cache and file handles database=/home/pi/.ethereum/geth/les.client cache=16.00MiB handles=16 INFO [12-20|16:19:37.784] Writing default main-net genesis block INFO [12-20|16:19:50.987] Persisted trie from memory database nodes=12356 size=1.78MiB time=2.264896332s gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B INFO [12-20|16:19:51.020] Initialised chain configuration config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: 7280000 Petersburg: 7280000 Istanbul: 9069000, Muir Glacier: 9200000, Berlin: 12244000, London: 12965000, Arrow Glacier: 13773000, Engine: ethash}" INFO [12-20|16:19:51.025] Disk storage enabled for ethash caches dir=/home/pi/.ethereum/geth/ethash count=3 INFO [12-20|16:19:51.030] Disk storage enabled for ethash DAGs dir=/home/pi/.ethash count=2 INFO [12-20|16:19:51.065] Added trusted checkpoint block=13,565,951 hash=8aa8e6..200083 INFO [12-20|16:19:51.070] Loaded most recent local header number=0 hash=d4e567..cb8fa3 td=17,179,869,184 age=52y8mo3w INFO [12-20|16:19:51.087] Configured checkpoint oracle address=0x9a90...a98A02a signers=5 threshold=2 INFO [12-20|16:19:51.091] Gasprice oracle is ignoring threshold set threshold=2 WARN [12-20|16:19:51.117] Error reading unclean shutdown markers error="leveldb: not found" INFO [12-20|16:19:51.122] Starting peer-to-peer node instance=Geth/v1.10.13-stable-7a0c19f8/linux-arm/go1.17.2 INFO [12-20|16:19:51.302] New local node record seq=1,640,017,191,208 id=6a2a408a5c716b15 ip=127.0.0.1 udp=30303 tcp=30303 INFO [12-20|16:19:51.333] Started P2P networking self=enode://298272ca03f84de2de...8f000a75@127.0.0.1:30303 INFO [12-20|16:19:51.415] IPC endpoint opened url=/home/pi/.ethereum/geth.ipc INFO [12-20|16:19:51.445] HTTP server started endpoint=127.0.0.1:8545 prefix= cors= vhosts=localhost WARN [12-20|16:19:51.448] Light client mode is an experimental feature INFO [12-20|16:19:54.686] New local node record seq=1,640,017,191,209 id=6a2a408a5c716b15 ip=0.0.0.0 udp=30303 tcp=30303 INFO [12-20|16:19:55.820] Updated latest header based on CHT number=13,565,951 hash=8aa8e6..200083 age=1mo1w6d INFO [12-20|16:19:55.836] Block synchronisation started # Stunden später .... INFO [12-20|16:20:06.143] Generating ethash verification cache epoch=452 percentage=0 elapsed=3.027s INFO [12-20|16:20:09.148] Generating ethash verification cache epoch=452 percentage=1 elapsed=6.032s INFO [12-20|16:20:12.154] Generating ethash verification cache epoch=452 percentage=1 elapsed=9.038s # Stunden später ... INFO [12-21|18:32:46.593] Imported new block headers count=1 elapsed=81.250ms number=13,850,153 hash=0a41de..d84dd5 INFO [12-21|18:32:50.414] Imported new block headers count=1 elapsed=70.416ms number=13,850,154 hash=f130bc..2a2415 INFO [12-21|18:32:51.563] Imported new block headers count=1 elapsed=80.005ms number=13,850,155 hash=80588e..3ca1a3 INFO [12-21|18:33:25.990] Imported new block headers count=1 elapsed=71.651ms number=13,850,156 hash=57d47b..8e9337 INFO [12-21|18:33:58.762] Imported new block headers count=1 elapsed=99.271ms number=13,850,157 hash=d5caca..41bf83 INFO [12-21|18:34:27.913] Imported new block headers count=1 elapsed=120.756ms number=13,850,158 hash=97766f..bbe4ee INFO [12-21|18:34:28.028] Imported new block headers count=1 elapsed=70.466ms number=13,850,158 hash=cce663..ed5d5a INFO [12-21|18:34:56.643] Imported new block headers count=1 elapsed=94.895ms number=13,850,159 hash=e293df..49c6e1 INFO [12-21|18:35:01.013] Imported new block headers count=1 elapsed=80.581ms number=13,850,160 hash=54037c..26a435 INFO [12-21|18:35:35.279] Imported new block headers count=1 elapsed=71.896ms number=13,850,161 hash=b06821..2d4991 ... # wenn solche Zeilen ... Imported new block headers ... kommen und ist alles Syncronisiert. Die Blocknummer ist dann die aktuelle.. |
Welcher Block gerade aktuell ist, kann auf diesem Eth. Block Explorer angezeigt werden. Bei mir ist es gerade die Blocknummer 13850173.
Leistungsverbrauch
Das war es schon, wir haben einen Eth. ligth Node am laufen, der wenn er syncronisiert ist, auch nicht viel Leistung braucht:
Während der init, wird aber schon die 100 % verbraucht, wie dieses HTOP Bild zeigt:
JavaScript Konsole
Während der Node läuft, kann eine andere Konsole geöffnet werden. Dort starten wir nun die JavaScript Konsole.
1 2 3 4 5 6 7 8 9 10 11 |
geth attach # Ergebnis Welcome to the Geth JavaScript console! instance: Geth/v1.10.13-stable-7a0c19f8/linux-arm/go1.17.2 at block: 13573247 (Mon Nov 08 2021 02:46:29 GMT+0000 (GMT)) datadir: /home/pi/.ethereum modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 les:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 vflux:1.0 web3:1.0 To exit, press ctrl-d or type exit |
1. Check
Erster Check, eingabe in der Konsole:
1 |
eth |
Das Ergebnis:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
Ergebnis: { accounts: [], blockNumber: 13573247, coinbase: undefined, compile: { lll: function(), serpent: function(), solidity: function() }, defaultAccount: undefined, defaultBlock: "latest", gasPrice: 135237891817, hashrate: 0, maxPriorityFeePerGas: 1500000000, mining: false, pendingTransactions: [], protocolVersion: undefined, syncing: { currentBlock: 13573247, highestBlock: 13843082, knownStates: 0, pulledStates: 0, startingBlock: 13565951 }, call: function(), chainId: function(), contract: function(abi), createAccessList: function(), estimateGas: function(), feeHistory: function(), fillTransaction: function(), filter: function(options, callback, filterCreationErrorCallback), getAccounts: function(callback), getBalance: function(), getBlock: function(), getBlockByHash: function(), getBlockByNumber: function(), getBlockNumber: function(callback), getBlockTransactionCount: function(), getBlockUncleCount: function(), getCode: function(), getCoinbase: function(callback), getCompilers: function(), getGasPrice: function(callback), getHashrate: function(callback), getHeaderByHash: function(), getHeaderByNumber: function(), getMaxPriorityFeePerGas: function(callback), getMining: function(callback), getPendingTransactions: function(callback), getProof: function(), getProtocolVersion: function(callback), getRawTransaction: function(), getRawTransactionFromBlock: function(), getStorageAt: function(), getSyncing: function(callback), getTransaction: function(), getTransactionCount: function(), getTransactionFromBlock: function(), getTransactionReceipt: function(), getUncle: function(), getWork: function(), iban: function(iban), icapNamereg: function(), isSyncing: function(callback), namereg: function(), resend: function(), sendIBANTransaction: function bound transfer(), sendRawTransaction: function(), sendTransaction: function(), sign: function(), signTransaction: function(), submitTransaction: function(), submitWork: function() } |
Blocknummer ausgeben
Oder nur die Block Nummer ausgeben
1 2 3 4 |
eth.blockNumber # Ergebnis: 13575295 |
Verbundene Peers anzeigen
Die Verbundene Peers können mit
1 |
admin.peers |
angezeigt werden. Z.b. hier gekürzt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
[{ caps: ["eth/66", "les/2", "les/3", "les/4", "snap/1"], enode: "enode://a3029e6127eea6...5d1e654d1e28a33edf378@147.135.70.51:30303", enr: "enr:-Km4QN2sYhX2sX3ak...UD6bzXXoWbcJLSV7S2xN4HRdmY7VpuIIEk3x6GAX3Hte6Cg2V0aMfGhCDDJ_yAgmlkgnY0gmlwhJOHRjODbGVzwQGJc2VjcDI1NmsxoQKjAp5hJ-6m1Fc3u0U0yphteEcSMJfrjFwjiN7ggmBr2YRzbmFwwIN0Y3CCdl-DdWRwgnZf", id: "1374cc9...d", name: "Geth/v1.10.13-stable-7a0c19f8/linux-amd64/go1.17.2", network: { inbound: false, localAddress: "x.x.x.x:yyyyy", remoteAddress: "x.x.x.x.x:yyyyy", static: false, trusted: false }, protocols: { les: { difficulty: 3.71107474645782e+22, head: "5e9af3c42c7...d61ed1c89440d", version: 4 } } }, { caps: ["eth/66", "les/2", "les/3", "les/4", "snap/1"], enode: "enode://476746a703baa...c30ca4d26c78f18ef234@93.75.22.22:30303", enr: "enr:-Km4QHQbM..,DxMlkACK23b44rJD9JamSiUnsv6V52waHPLLP9yGAXxzguEPg2V0aMfGhCDDJ_yAgmlkgnY0gmlwhF1LFhaDbGVzwQGJc2VjcDI1NmsxoQJHZ0anA7quYaKBIFy-IDaaDn2XK1JlPddf2N7FU4K0EYRzbmFwwIN0Y3CCdl-DdWRwgnZf", id: "d30e4b..a68d1", name: "Geth/v1.10.13-stable-7a0c19f8/linux-amd64/go1.17.2", network: { inbound: false, localAddress: "x.x.x.x:YYYYY", remoteAddress: "x.x.x.x.:30303", static: false, trusted: false }, protocols: { les: { difficulty: 3.71107474645782e+22, head: "5e9af3c42c732ca85a238051c4...61ed1c89440d", version: 4 } } }] |
Kontostand einer echten Eth. Adresse ausgeben
Nun wollen wir mal von einer echten Eth. Adresse (meine buy me a Coffee Adresse 0x829F9e57c29ab683E964c76160B7B0BaB2727dD2) den Kontostand abfragen. Wenn es eine Fehlermeldung gibt, ist evl. die Syncronisation noch nicht abgeschlossen.
1 2 3 4 |
eth.getBalance('0x829F9e57c29ab683E964c76160B7B0BaB2727dD2') # Ergebnis 4517710000000000 |
Wer will, kann auf diese Adresse auch etwas für Kaffee überweisen, und dann checken ob der Betrag sich verändert hat.
Kontostand per curl und RPC Call
Nun noch den Kontostand per RPC von einer anderen Konsole von meiner Kaffee Adresse: 0x829F9e57c29ab683E964c76160B7B0BaB2727dD2:
1 |
curl -X POST http://localhost:8545 -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"eth_getBalance", "params" : ["0x829F9e57c29ab683E964c76160B7B0BaB2727dD2","latest"], "id":1}' |
Das JSon Ergebnis:
1 |
{"jsonrpc":"2.0","id":1,"result":"0x100cd553bf8c00"} |
Das ist der Kontostand in Hexadecimal und WEI. Wenn man ETH braucht, muss es in Dezimal konvertiert werden und durch 10 hoch 18 geteilt werden.
Node im Hintergrund starten
Damit wir das Konsolenfenster nicht immer offenhalten müssen, starten wir den Node im Hintergrund mit
1 |
nohup geth --syncmode light --cache 64 --maxpeers 12 --http & |
Der Output landet dann in der nohup.out Datei und kann mit
1 |
tail -f nohup.out |
angeschaut werden.
Node autom. als systemctl starten
Optional kann auch ein System-Dienst eingerichtet werden, der dann automatisch beim rebooten startet.
Dazu einfach die Datei
1 |
sudo vi /etc/systemd/system/geth@.service |
mit diesen Inhalt anlegen:
1 2 3 4 5 6 7 8 9 10 11 12 |
[Unit] Description=Ethereum daemon Requires=network.target [Service] Type=simple User=%I ExecStart=/usr/local/bin/geth --syncmode light --cache 64 --maxpeers 12 --http Restart=on-failure [Install] WantedBy=multi-user.target |
Dann noch den Service anschalten mit:
1 2 |
sudo systemctl enable geth@pi.service sudo systemctl start geth@pi.service |
Den Status des Service kann mit
1 |
systemctl status geth@pi |
abgefragt werden. Z.b.:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
geth@pi.service - Ethereum daemon Loaded: loaded (/etc/systemd/system/geth@.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2021-12-21 21:12:30 GMT; 7min ago Main PID: 245 (geth) Tasks: 11 (limit: 415) CPU: 2min 18.844s CGroup: /system.slice/system-geth.slice/geth@pi.service └─245 /usr/local/bin/geth --syncmode light --cache 64 --maxpeers 12 --http Dec 21 21:18:41 pi-org geth[245]: INFO [12-21|21:18:41.177] Imported new block headers count=1 elapsed=95.419ms number=13,850,942 hash=8a0231..002174 Dec 21 21:18:49 pi-org geth[245]: INFO [12-21|21:18:49.132] Looking for peers peercount=2 tried=5 static=0 Dec 21 21:19:00 pi-org geth[245]: INFO [12-21|21:19:00.342] Looking for peers peercount=2 tried=3 static=0 Dec 21 21:19:09 pi-org geth[245]: INFO [12-21|21:19:09.918] Imported new block headers count=1 elapsed=71.264ms number=13,850,943 hash=1ca6d7..096f4d Dec 21 21:19:11 pi-org geth[245]: INFO [12-21|21:19:11.383] Looking for peers peercount=2 tried=8 static=0 Dec 21 21:19:18 pi-org geth[245]: INFO [12-21|21:19:18.202] Imported new block headers count=1 elapsed=76.494ms number=13,850,944 hash=aeebc7..842833 Dec 21 21:19:21 pi-org geth[245]: INFO [12-21|21:19:21.478] Looking for peers peercount=2 tried=9 static=0 Dec 21 21:19:31 pi-org geth[245]: INFO [12-21|21:19:31.525] Looking for peers peercount=2 tried=3 static=0 Dec 21 21:19:38 pi-org geth[245]: INFO [12-21|21:19:38.645] Imported new block headers count=1 elapsed=69.589ms number=13,850,945 hash=a101b3..de3f52 Dec 21 21:19:42 pi-org geth[245]: INFO [12-21|21:19:42.291] Looking for peers peercount=2 tried=4 static=0 |
Starten und Stoppen des Service geht dann als pi User so:
1 2 3 4 5 6 7 8 9 10 11 12 |
systemctl stop geth@pi ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === Authentication is required to stop 'geth@pi.service'. Authenticating as: ,,, (pi) Password: PI-Passwort # Und starten systemctl start geth@pi ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === Authentication is required to start 'geth@pi.service'. Authenticating as: ,,, (pi) Password:PI-Passwort |
Weitere Infos
Weitere Infos in engl. auf ethereum.org oder auch in bezug auf Geth und für die JavaScript web3js Konsole.
Oder auch alle Parameter über geth –help
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
NAME: geth - the go-ethereum command line interface Copyright 2013-2021 The go-ethereum Authors USAGE: geth [options] [command] [command options] [arguments...] VERSION: 1.10.13-stable-7a0c19f8 COMMANDS: account Manage accounts attach Start an interactive JavaScript environment (connect to node) console Start an interactive JavaScript environment db Low level database operations dump Dump a specific block from storage dumpconfig Show configuration values dumpgenesis Dumps genesis block JSON configuration to stdout export Export blockchain into file export-preimages Export the preimage database into an RLP stream import Import a blockchain file import-preimages Import the preimage database from an RLP stream init Bootstrap and initialize a new genesis block js Execute the specified JavaScript files license Display license information makecache Generate ethash verification cache (for testing) makedag Generate ethash mining DAG (for testing) removedb Remove blockchain and state databases show-deprecated-flags Show flags that have been deprecated snapshot A set of commands based on the snapshot version Print version numbers version-check Checks (online) whether the current version suffers from any known security vulnerabilities wallet Manage Ethereum presale wallets help, h Shows a list of commands or help for one command ETHEREUM OPTIONS: --config value TOML configuration file --datadir value Data directory for the databases and keystore (default: "/home/pi/.ethereum") --datadir.ancient value Data directory for ancient chain segments (default = inside chaindata) --datadir.minfreedisk value Minimum free disk space in MB, once reached triggers auto shut down (default = --cache.gc converted to MB, 0 = disabled) --keystore value Directory for the keystore (default = inside the datadir) --usb Enable monitoring and management of USB hardware wallets --pcscdpath value Path to the smartcard daemon (pcscd) socket file (default: "/run/pcscd/pcscd.comm") --networkid value Explicitly set network id (integer)(For testnets: use --ropsten, --rinkeby, --goerli instead) (default: 1) --mainnet Ethereum mainnet --goerli Görli network: pre-configured proof-of-authority test network --rinkeby Rinkeby network: pre-configured proof-of-authority test network --ropsten Ropsten network: pre-configured proof-of-work test network --sepolia Sepolia network: pre-configured proof-of-work test network --syncmode value Blockchain sync mode ("fast", "full", "snap" or "light") (default: snap) --exitwhensynced Exits after block synchronisation completes --gcmode value Blockchain garbage collection mode ("full", "archive") (default: "full") --txlookuplimit value Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (default: 2350000) --ethstats value Reporting URL of a ethstats service (nodename:secret@host:port) --identity value Custom node name --lightkdf Reduce key-derivation RAM & CPU usage at some expense of KDF strength --whitelist value Comma separated block number-to-hash mappings to enforce (<number>=<hash>) LIGHT CLIENT OPTIONS: --light.serve value Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100) (default: 0) --light.ingress value Incoming bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited) (default: 0) --light.egress value Outgoing bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited) (default: 0) --light.maxpeers value Maximum number of light clients to serve, or light servers to attach to (default: 100) --ulc.servers value List of trusted ultra-light servers --ulc.fraction value Minimum % of trusted ultra-light servers required to announce a new head (default: 75) --ulc.onlyannounce Ultra light server sends announcements only --light.nopruning Disable ancient light chain data pruning --light.nosyncserve Enables serving light clients before syncing DEVELOPER CHAIN OPTIONS: --dev Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled --dev.period value Block period to use in developer mode (0 = mine only if transaction pending) (default: 0) --dev.gaslimit value Initial block gas limit (default: 11500000) ETHASH OPTIONS: --ethash.cachedir value Directory to store the ethash verification caches (default = inside the datadir) --ethash.cachesinmem value Number of recent ethash caches to keep in memory (16MB each) (default: 2) --ethash.cachesondisk value Number of recent ethash caches to keep on disk (16MB each) (default: 3) --ethash.cacheslockmmap Lock memory maps of recent ethash caches --ethash.dagdir value Directory to store the ethash mining DAGs (default: "/home/pi/.ethash") --ethash.dagsinmem value Number of recent ethash mining DAGs to keep in memory (1+GB each) (default: 1) --ethash.dagsondisk value Number of recent ethash mining DAGs to keep on disk (1+GB each) (default: 2) --ethash.dagslockmmap Lock memory maps for recent ethash mining DAGs TRANSACTION POOL OPTIONS: --txpool.locals value Comma separated accounts to treat as locals (no flush, priority inclusion) --txpool.nolocals Disables price exemptions for locally submitted transactions --txpool.journal value Disk journal for local transaction to survive node restarts (default: "transactions.rlp") --txpool.rejournal value Time interval to regenerate the local transaction journal (default: 1h0m0s) --txpool.pricelimit value Minimum gas price limit to enforce for acceptance into the pool (default: 1) --txpool.pricebump value Price bump percentage to replace an already existing transaction (default: 10) --txpool.accountslots value Minimum number of executable transaction slots guaranteed per account (default: 16) --txpool.globalslots value Maximum number of executable transaction slots for all accounts (default: 5120) --txpool.accountqueue value Maximum number of non-executable transaction slots permitted per account (default: 64) --txpool.globalqueue value Maximum number of non-executable transaction slots for all accounts (default: 1024) --txpool.lifetime value Maximum amount of time non-executable transaction are queued (default: 3h0m0s) PERFORMANCE TUNING OPTIONS: --cache value Megabytes of memory allocated to internal caching (default = 4096 mainnet full node, 128 light mode) (default: 1024) --cache.database value Percentage of cache memory allowance to use for database io (default: 50) --cache.trie value Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode) (default: 15) --cache.trie.journal value Disk journal directory for trie cache to survive node restarts (default: "triecache") --cache.trie.rejournal value Time interval to regenerate the trie cache journal (default: 1h0m0s) --cache.gc value Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode) (default: 25) --cache.snapshot value Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode) (default: 10) --cache.noprefetch Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data) --cache.preimages Enable recording the SHA3/keccak preimages of trie keys ACCOUNT OPTIONS: --unlock value Comma separated list of accounts to unlock --password value Password file to use for non-interactive password input --signer value External signer (url or path to ipc file) --allow-insecure-unlock Allow insecure account unlocking when account-related RPCs are exposed by http API AND CONSOLE OPTIONS: --ipcdisable Disable the IPC-RPC server --ipcpath value Filename for IPC socket/pipe within the datadir (explicit paths escape it) --http Enable the HTTP-RPC server --http.addr value HTTP-RPC server listening interface (default: "localhost") --http.port value HTTP-RPC server listening port (default: 8545) --http.api value API's offered over the HTTP-RPC interface --http.rpcprefix value HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths. --http.corsdomain value Comma separated list of domains from which to accept cross origin requests (browser enforced) --http.vhosts value Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost") --ws Enable the WS-RPC server --ws.addr value WS-RPC server listening interface (default: "localhost") --ws.port value WS-RPC server listening port (default: 8546) --ws.api value API's offered over the WS-RPC interface --ws.rpcprefix value HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths. --ws.origins value Origins from which to accept websockets requests --graphql Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well. --graphql.corsdomain value Comma separated list of domains from which to accept cross origin requests (browser enforced) --graphql.vhosts value Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost") --rpc.gascap value Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite) (default: 50000000) --rpc.evmtimeout value Sets a timeout used for eth_call (0=infinite) (default: 5s) --rpc.txfeecap value Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 1) --rpc.allow-unprotected-txs Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC --jspath loadScript JavaScript root path for loadScript (default: ".") --exec value Execute JavaScript statement --preload value Comma separated list of JavaScript files to preload into the console NETWORKING OPTIONS: --bootnodes value Comma separated enode URLs for P2P discovery bootstrap --discovery.dns value Sets DNS discovery entry points (use "" to disable DNS) --port value Network listening port (default: 30303) --maxpeers value Maximum number of network peers (network disabled if set to 0) (default: 50) --maxpendpeers value Maximum number of pending connection attempts (defaults used if set to 0) (default: 0) --nat value NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: "any") --nodiscover Disables the peer discovery mechanism (manual peer addition) --v5disc Enables the experimental RLPx V5 (Topic Discovery) mechanism --netrestrict value Restricts network communication to the given IP networks (CIDR masks) --nodekey value P2P node key file --nodekeyhex value P2P node key as hex (for testing) MINER OPTIONS: --mine Enable mining --miner.threads value Number of CPU threads to use for mining (default: 0) --miner.notify value Comma separated HTTP URL list to notify of new work packages --miner.notify.full Notify with pending block headers instead of work packages --miner.gasprice value Minimum gas price for mining a transaction (default: 1000000000) --miner.gaslimit value Target gas ceiling for mined blocks (default: 8000000) --miner.etherbase value Public address for block mining rewards (default = first account) (default: "0") --miner.extradata value Block extra data set by the miner (default = client version) --miner.recommit value Time interval to recreate the block being mined (default: 3s) --miner.noverify Disable remote sealing verification GAS PRICE ORACLE OPTIONS: --gpo.blocks value Number of recent blocks to check for gas prices (default: 20) --gpo.percentile value Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 60) --gpo.maxprice value Maximum transaction priority fee (or gasprice before London fork) to be recommended by gpo (default: 500000000000) --gpo.ignoreprice value Gas price below which gpo will ignore transactions (default: 2) VIRTUAL MACHINE OPTIONS: --vmdebug Record information useful for VM and contract debugging LOGGING AND DEBUGGING OPTIONS: --fakepow Disables proof-of-work verification --nocompaction Disables db compaction after import --verbosity value Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default: 3) --vmodule value Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4) --log.json Format logs with JSON --log.backtrace value Request a stack trace at a specific logging statement (e.g. "block.go:271") --log.debug Prepends log messages with call-site location (file and line number) --pprof Enable the pprof HTTP server --pprof.addr value pprof HTTP server listening interface (default: "127.0.0.1") --pprof.port value pprof HTTP server listening port (default: 6060) --pprof.memprofilerate value Turn on memory profiling with the given rate (default: 524288) --pprof.blockprofilerate value Turn on block profiling with the given rate (default: 0) --pprof.cpuprofile value Write CPU profile to the given file --trace value Write execution trace to the given file METRICS AND STATS OPTIONS: --metrics Enable metrics collection and reporting --metrics.expensive Enable expensive metrics collection and reporting --metrics.addr value Enable stand-alone metrics HTTP server listening interface (default: "127.0.0.1") --metrics.port value Metrics HTTP server listening port (default: 6060) --metrics.influxdb Enable metrics export/push to an external InfluxDB database --metrics.influxdb.endpoint value InfluxDB API endpoint to report metrics to (default: "http://localhost:8086") --metrics.influxdb.database value InfluxDB database name to push reported metrics to (default: "geth") --metrics.influxdb.username value Username to authorize access to the database (default: "test") --metrics.influxdb.password value Password to authorize access to the database (default: "test") --metrics.influxdb.tags value Comma-separated InfluxDB tags (key/values) attached to all measurements (default: "host=localhost") --metrics.influxdbv2 Enable metrics export/push to an external InfluxDB v2 database --metrics.influxdb.token value Token to authorize access to the database (v2 only) (default: "test") --metrics.influxdb.bucket value InfluxDB bucket name to push reported metrics to (v2 only) (default: "geth") --metrics.influxdb.organization value InfluxDB organization name (v2 only) (default: "geth") ALIASED (deprecated) OPTIONS: --nousb Disables monitoring for and managing USB hardware wallets (deprecated) MISC OPTIONS: --snapshot Enables snapshot-database mode (default = enable) --bloomfilter.size value Megabytes of memory allocated to bloom-filter for pruning (default: 2048) --help, -h show help --catalyst Catalyst mode (eth2 integration testing) --override.arrowglacier value Manually specify Arrow Glacier fork-block, overriding the bundled setting (default: 0) COPYRIGHT: Copyright 2013-2021 The go-ethereum Authors |