erigon-pulse/docs/mining.md
ddl edcd7fcd63
update outdated information (#8906)
1. When running locally, found that these **TODO** json-rpc have been
implemented. Updating these outdated information can make the document
clearer.
```
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_newBlockFilter","params":[],"id":1}' http://loca
lhost:8545
{"jsonrpc":"2.0","id":1,"result":"0x02000000000000009c49b60f431cabc7"}
```
2. [but it's easy to accomplish] Points to an obsolete message
(9b8cdc0f22/eth/downloader/downloader.go (L673))
2023-12-06 09:23:43 +07:00

1.2 KiB

Mining

Support only remote-miners.

  • To enable, add --mine --miner.etherbase=... or --mine --miner.sigfile=... flags.
  • Other supported options: --miner.extradata, --miner.notify, --miner.gaslimit, --miner.gasprice , --miner.gastarget
  • RPCDaemon supports methods: eth_coinbase , eth_hashrate, eth_mining, eth_getWork, eth_submitWork, eth_submitHashrate
  • RPCDaemon supports websocket methods: newPendingTransaction

Implementation details

  • mining implemented as independent 🔬Staged Sync
  • stages are declared in eth/stagedsync/stagebuilder.go:MiningStages
  • mining work done inside 1 db transaction which RollingBack after block prepared and --miner.notify notifications sent

Testing

Integration tool - supports mining of existing blocks. It moves Erigon to block X, does mine block X+1, then compare mined block with real block X+1 in db. To enable - just add --mine --miner.etherbase=<etherbase> flag to integration state_stages command:

./build/bin/integration state_stages --datadir=<datadir> --unwind=1 --unwind.every=2 --integrity.fast=false --integrity.slow=false --mine --miner.etherbase=<etherbase>