首页 > 解决方案 > 为了制作第一个区块,ethereumJ 将挖掘多少个 0-gas 的空交易?

问题描述

我的应用程序使用创世文件(见底部)和每次数据库重置的配置等待测试 ethereumj 网络的 onSyncDone() 事件。

在 onSyncDone() 中提交了一个合约。

ethereumj 正在开始挖矿,每笔交易都在不使用 gas 的情况下进行挖矿。每个人都会遇到一些困难。它挖掘和挖掘......我问自己第一个块何时“完成”(并且 onSyncDone() 将被触发/执行)。

我该怎么做才能避免所有这些(空的 0-gas-mining)?

======= 使用的创世文件:

{
"config": {
"chainId": 313,
"eip158Block": 10,
"byzantiumBlock": 1700000,

"headerValidators": [
  {"number": 10,     "hash": "0xb3074f936815a0425e674890d7db7b5e94f3a06dca5b22d291b55dcd02dde93e"},
  {"number": 585503, "hash": "0xe8d61ae10fd62e639c2e3c9da75f8b0bdb3fa5961dbd3aed1223f92e147595b9"}
]
},

"nonce": "0x0000000000000042",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x3535353535353535353535353535353535353535353535353535353535353535",
"gasLimit": "0xFFFFFFF",
"gasPrice": "0x0F",
"difficulty": "0x01",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",

"alloc": {

"0000000000000000000000000000000000000013": {
  "balance": "1000"
},
"0000000000000000000000000000000000000014": {
  "balance": "1000"
},
"0000000000000000000000000000000000000015": {
  "balance": "1000"
},
"0000000000000000000000000000000000000016": {
  "balance": "1000"
},
"0000000000000000000000000000000000000017": {
  "balance": "1000"
},
"0000000000000000000000000000000000000018": {
  "balance": "1000"
},
"0000000000000000000000000000000000000019": {
  "balance": "1000"
},
"000000000000000000000000000000000000001a": {
  "balance": "1000"
},
"000000000000000000000000000000000000001b": {
  "balance": "1000"
},
"000000000000000000000000000000000000001c": {
  "balance": "1000"
},
"000000000000000000000000000000000000001d": {
  "balance": "1000"
},
"000000000000000000000000000000000000001e": {
  "balance": "1000"
},
"000000000000000000000000000000000000001f": {
  "balance": "1000"
}
}
}

====== 使用的conf:

peer.discovery.enabled = false
peer.listen.port = 20202
peer.networkId = 888

cache.flush.memory = 0
cache.flush.blocks = 1
sync.enabled = false
mine.start = true

database.dir = sksDB
database.reset = true

#Key value data source values: [leveldb/redis/mapdb]
keyvalue.datasource=rocksdb

// a number of public peers for this network (not all of then may be functioning)
// need to get Seed/Miner node info and fill it in active peer section of all regular nodes like this:
peer.active =
[
{
ip= 10.0.1.120
port= 20202
nodeName = "sks1"
name = b3ea40366eae0206f7923a38c61ccfd1fcbd1185aa46596cfcba5eb762d484c15f998d6447162905507212742fbbda96507667d834192dd32bdc980e08e16ad3
}
]

// special genesis for this test network

genesis = eth_genesis_sksprivate.json
blockchain.config.name = "sks"
blockchain.config.class = "org.ethereum.config.blockchain.FrontierConfig"

==== 重复的“空?” 交易:

19:15:51.263 INFO [db]  Flush started
19:15:51.263 INFO [db]  Flush completed in 0 ms
19:15:53.889 INFO [net]  TCP: Speed in/out 0b / 0b(sec), packets in/out 0/0, total in/out: 0b / 0b
19:15:53.889 INFO [net]  UDP: Speed in/out 0b / 0b(sec), packets in/out 0/0, total in/out: 0b / 0b
19:15:53.891 INFO [sync]  Sync state: Off, last block #2258, best known #2258
19:15:54.361 INFO [mine]  Wow, block mined !!!: f90210f9020ba0bce27ba3b3f49e4aee35b456cbd0613889f30d1eabe34e5dd3439d88bbd11488a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a03916196ec987cfc44c5e046681ce1c7f5ad77dd28f28565a0375a82479040ef8a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008305fcd98208d3840fffffff80845b390c4891457468657265756d4a20706f7765726564a05f2cf27106233b7b2a90df459ad19fb6da3e79d2a220e5ef65759cc395e0d2b888844682ba8b355f9bc0c0
BlockData [   hash=d797ff12bebf61dcdff54dc90b71e5bf33b2af169a18a5ffc1ff4c9ad3875417
  parentHash=bce27ba3b3f49e4aee35b456cbd0613889f30d1eabe34e5dd3439d88bbd11488
  unclesHash=1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
  coinbase=0000000000000000000000000000000000000000
  stateRoot=3916196ec987cfc44c5e046681ce1c7f5ad77dd28f28565a0375a82479040ef8
  txTrieHash=56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
  receiptsTrieHash=56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
  difficulty=05fcd9
  number=2259
  gasLimit=0fffffff
  gasUsed=0
  timestamp=1530465352 (2018.07.01 19:15:52)
  extraData=457468657265756d4a20706f7765726564
  mixHash=5f2cf27106233b7b2a90df459ad19fb6da3e79d2a220e5ef65759cc395e0d2b8
  nonce=844682ba8b355f9b
Uncles []
Txs []
]
1

标签: javaethereum

解决方案


推荐阅读