miner.start(1) dispara pero no inicia la minería

Estoy creando mi propia cadena de bloques ethereum privada.

sudo geth --rpcapi eth,web3,personal --rpc --networkid=15

El comando anterior da los registros a continuación.

INFO [09-18|10:16:42.151] Maximum peer count                       ETH=25 LES=0 total=25
INFO [09-18|10:16:42.153] Starting peer-to-peer node               instance=Geth/v1.8.15-stable-89451f7c/linux-amd64/go1.10
INFO [09-18|10:16:42.153] Allocated cache and file handles         database=/home/blockchain/.ethereum/geth/chaindata cache=768 handles=512
INFO [09-18|10:16:42.171] Initialised chain configuration          config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: <nil> Engine: ethash}"
INFO [09-18|10:16:42.171] Disk storage enabled for ethash caches   dir=/home/blockchain/.ethereum/geth/ethash count=3
INFO [09-18|10:16:42.171] Disk storage enabled for ethash DAGs     dir=/home/blockchain/.ethash               count=2
INFO [09-18|10:16:42.171] Initialising Ethereum protocol           versions="[63 62]" network=15
INFO [09-18|10:16:42.173] Loaded most recent local header          number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [09-18|10:16:42.173] Loaded most recent local full block      number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [09-18|10:16:42.173] Loaded most recent local fast block      number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [09-18|10:16:42.174] Loaded local transaction journal         transactions=0 dropped=0
INFO [09-18|10:16:42.174] Regenerated local transaction journal    transactions=0 accounts=0
INFO [09-18|10:16:42.174] Starting P2P networking
INFO [09-18|10:16:46.891] UDP listener up                          self=enode://e919e98154dcddc4e6e6f847332795cbaf072607e410c2330702d3b66b4219eb98c4ebf39dc1ee2b21af74049926a5fb646542636f8835eb420157d825cc3102@[::]:30303
INFO [09-18|10:16:46.892] RLPx listener up                         self=enode://e919e98154dcddc4e6e6f847332795cbaf072607e410c2330702d3b66b4219eb98c4ebf39dc1ee2b21af74049926a5fb646542636f8835eb420157d825cc3102@[::]:30303
INFO [09-18|10:16:46.896] IPC endpoint opened                      url=/home/blockchain/.ethereum/geth.ipc
INFO [09-18|10:16:46.897] HTTP endpoint opened                     url=http://127.0.0.1:8545               cors= vhosts=localhost
INFO [09-18|10:16:59.561] Etherbase automatically configured       address=0xa76D511FCddEB3bCCa1Eb5B6bf4EC39a8d95668d

Luego activé miner.start(1)usando la consola geth sudo geth attach ../.ethereum/geth.ipcpara que agregue las siguientes líneas en los registros anteriores.

INFO [09-18|10:18:06.859] Updated mining threads                   threads=1
INFO [09-18|10:18:06.860] Transaction pool price threshold updated price=1000000000
INFO [09-18|10:18:06.860] Commit new mining work                   number=1 sealhash=d91037…57fc0d uncles=0 txs=0 gas=0 fees=0 elapsed=648.451µs

Y después de esto no pasa nada.

FYI, miner.start(1)regresa nullpero eso no es un problema, supongo.

¿Podría darme algunos consejos para que pueda hacer posibles soluciones para que comience la minería?

Aparentemente, su nodo está mal configurado. de hecho, si echa un vistazo a los registros, puede ver que usa la cadena principal (ChainID=1) y no el networkid que está especificando. ¿Ya creaste el DAG antes de minar? (Por lo general, requiere algo de tiempo).
Sí, @Briomkez, en realidad tomó mucho tiempo.

Respuestas (3)

puede intentar usar este comando (rm -rf $HOME/.ethash) antes de iniciar el geth. aquí está el detalle

ya probé eso.

Si está utilizando Windows con un directorio de datos personalizado como yo. Resulta que Ethash todavía vive aquí: C:\Windows\System32\config\systemprofile\AppData. Mi resolución fue eliminar el contenido de este directorio, en lugar de mi directorio de datos. Puede haber un equivalente en un entorno Linux. Haga referencia a los comentarios de inicio de su canal IPC:

[2019.02.19-11:16:04.464350]: INFO [02-19|11:16:02] Starting peer-to-peer node instance=Geth/v1.7.3-stable-4bb3c89d/windows-amd64/go1.9. [2019.02.19-11:16:04.474094]: INFO [02-19|11:16:02] Allocated cache and file handles database=C:\\DTS\\Ledgers\\1111\\Ledger\\geth\\chaindata cache=128 handles=1024. [2019.02.19-11:16:04.485756]: INFO [02-19|11:16:02] Initialised chain configuration config="{ChainID: 1111 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: 0 EIP158: 0 Byzantium: <nil> Engine: unknown}". [2019.02.19-11:16:04.491861]: INFO [02-19|11:16:02] Disk storage enabled for ethash caches dir=C:\\DTS\\Ledgers\\1111\\Ledger\\geth\\ethash count=3. [2019.02.19-11:16:04.497462]: INFO [02-19|11:16:02] Disk storage enabled for ethash DAGs dir=C:\\WINDOWS\\system32\\config\\systemprofile\\AppData\\Ethash count=2. [2019.02.19-11:16:04.503220]: INFO [02-19|11:16:02] Initialising Ethereum protocol versions="[63 62]" network=1111. [2019.02.19-11:16:04.508075]: INFO [02-19|11:16:02] Loaded most recent local header number=0 hash=95ae19…a63ec2 td=0. [2019.02.19-11:16:04.512925]: INFO [02-19|11:16:02] Loaded most recent local full block number=0 hash=95ae19…a63ec2 td=0. [2019.02.19-11:16:04.518492]: INFO [02-19|11:16:02] Loaded most recent local fast block number=0 hash=95ae19…a63ec2 td=0. [2019.02.19-11:16:04.523792]: INFO [02-19|11:16:02] Loaded local transaction journal transactions=1 dropped=0. [2019.02.19-11:16:04.528894]: INFO [02-19|11:16:02] Regenerated local transaction journal transactions=1 accounts=1.

Aviso específico: C:\WINDOWS\system32\config\systemprofile\AppData\Ethash

El comentario de @Briomkez es un comienzo correcto: cuando ejecuta el comando geth, muestra que se ha conectado, ChainID: 1lo cual no es correcto, no es su red privada.

Para iniciar una red privada, cree su archivo de génesis (me gusta usar marionetas).

Una vez que haya creado su archivo de génesis, ejecute geth init, lo más importante aquí: defina un datadir

geth --datadir test init ./testpow.json

Esto "creará una base de datos que usa este bloque de génesis, ejecute el siguiente comando. Esto importará y configurará el bloque de génesis canónico para su cadena" - https://github.com/ethereum/go-ethereum/wiki/Private-network

Ahora ejecute el mismo comando que incluyó anteriormente, pero nuevamente incluya el datadir aquí ->

geth --datadir test --rpcapi eth,web3,personal --rpc --networkid=15

cuando ejecuta este comando, le mostrará el archivo ipc que se está utilizando frente a la línea de pedido:

ipc abierto

Asegúrese de usar este IPC cuando ejecutegeth attach

Una vez en la consola, suponiendo que tiene una cuenta creada y desbloqueada, puede ejecutar; miner.start(1)de lo contrario, es posible que deba ejecutar personal.newAccountpara crear una cuenta para minar antesrunning miner.start(1)

También puede usar estas banderas para comenzar a minar desde su comando geth-unlock '0xaddress' --password ./password.txt --mine