为什么远程挖矿速度远远慢于在geth命令行启动挖矿

我在使用以太坊进行开发和测试时遇到了以下问题:当我通过Geth命令行直接向节点执行挖矿命令时,即使没有发生任何交易,挖矿速度也非常快,大约每2秒就挖出一个区块。然而,当我尝试使用 HTTP 客户端(如 APIPost)通过 Java 程序发送 JSON-RPC 挖掘请求(miner_start 和 miner_stop)时,挖掘速度明显减慢,大约需要 40 秒才能挖掘一个块。这种情况发生在挖矿命令成功发出后,与请求的解析速度无关。我想知道是什么原因导致这种速度差异以及如何解决这个问题。 这是远程挖矿日志:

INFO [02-22|15:16:27.158] "馃敤 mined potential block"                number=24 hash=28d15d..d94fe3
INFO [02-22|15:16:27.158] Commit new sealing work                  number=25 sealhash=111cbd..0820a9 uncles=0 txs=0 gas
=0 fees=0 elapsed=0s
INFO [02-22|15:16:27.158] Commit new sealing work                  number=25 sealhash=111cbd..0820a9 uncles=0 txs=0 gas
=0 fees=0 elapsed=0s
INFO [02-22|15:16:49.064] Successfully sealed new block            number=25 sealhash=111cbd..0820a9 hash=c43a23..2ec81
9 elapsed=21.906s
INFO [02-22|15:16:49.064] "馃敤 mined potential block"                number=25 hash=c43a23..2ec819
INFO [02-22|15:16:49.067] Commit new sealing work                  number=26 sealhash=a4c7c0..52cb5a uncles=0 txs=0 gas
=0 fees=0 elapsed=2.913ms
INFO [02-22|15:16:49.067] Commit new sealing work                  number=26 sealhash=a4c7c0..52cb5a uncles=0 txs=0 gas
=0 fees=0 elapsed=2.913ms
INFO [02-22|15:17:57.185] Successfully sealed new block            number=26 sealhash=a4c7c0..52cb5a hash=c42fea..846e7
a elapsed=1m8.117s
INFO [02-22|15:17:57.186] "馃敤 mined potential block"                number=26 hash=c42fea..846e7a
INFO [02-22|15:17:57.186] Commit new sealing work                  number=27 sealhash=38fa7d..f3ea2a uncles=0 txs=0 gas
=0 fees=0 elapsed=0s
INFO [02-22|15:17:57.186] Commit new sealing work                  number=27 sealhash=38fa7d..f3ea2a uncles=0 txs=0 gas
=0 fees=0 elapsed=0s
INFO [02-22|15:17:57.468] Successfully sealed new block            number=27 sealhash=38fa7d..f3ea2a hash=92163f..59934
9 elapsed=282.694ms

这是命令行挖掘日志:

INFO [02-22|15:19:38.184] "馃敆 block reached canonical chain"        number=26 hash=c42fea..846e7a
INFO [02-22|15:19:38.184] Commit new sealing work                  number=34 sealhash=42cc7b..36cfbc uncles=0 txs=0 gas
=0 fees=0 elapsed="589.9碌s"
INFO [02-22|15:19:38.184] Commit new sealing work                  number=34 sealhash=42cc7b..36cfbc uncles=0 txs=0 gas
=0 fees=0 elapsed="986.5碌s"
INFO [02-22|15:19:38.184] "馃敤 mined potential block"                number=33 hash=3b2402..979c1c
INFO [02-22|15:19:39.815] Successfully sealed new block            number=34 sealhash=42cc7b..36cfbc hash=5f779c..3da00
8 elapsed=1.631s
INFO [02-22|15:19:39.815] "馃敆 block reached canonical chain"        number=27 hash=92163f..599349
INFO [02-22|15:19:39.815] "馃敤 mined potential block"                number=34 hash=5f779c..3da008
INFO [02-22|15:19:39.815] Commit new sealing work                  number=35 sealhash=389cae..163f19 uncles=0 txs=0 gas
=0 fees=0 elapsed=0s
INFO [02-22|15:19:39.815] Commit new sealing work                  number=35 sealhash=389cae..163f19 uncles=0 txs=0 gas
=0 fees=0 elapsed=0s
INFO [02-22|15:19:40.125] Successfully sealed new block            number=35 sealhash=389cae..163f19 hash=c93201..653fd
7 elapsed=309.476ms
INFO [02-22|15:19:40.125] "馃敆 block reached canonical chain"        number=28 hash=bfb248..08fefd
INFO [02-22|15:19:40.125] "馃敤 mined potential block"                number=35 hash=c93201..653fd7
INFO [02-22|15:19:40.125] Commit new sealing work                  number=36 sealhash=cfae6e..f2d359 uncles=0 txs=0 gas
=0 fees=0 elapsed="83.5碌s"
INFO [02-22|15:19:40.125] Commit new sealing work                  number=36 sealhash=cfae6e..f2d359 uncles=0 txs=0 gas
=0 fees=0 elapsed="83.5碌s"
INFO [02-22|15:19:41.113] Successfully sealed new block            number=36 sealhash=cfae6e..f2d359 hash=e2d4df..57e31
6 elapsed=988.595ms
请先 登录 后评论

1 个回答

Tiny熊 - 布道者
  擅长:智能合约,以太坊
请先 登录 后评论
  • 1 关注
  • 0 收藏,624 浏览
  • Sakura 提出于 2024-02-22 15:49