github.com/bigzoro/my_simplechain@v0.0.0-20240315012955-8ad0a2a29bb9/cmd/dummytx/README.md (about)

     1  ##### 1s POA genesis.json
     2  
     3  - init count= 0xffd79941b7085805f48ded97298694c6bb950e2c
     4  ```json
     5  {
     6    "config": {
     7      "chainId": 110,
     8      "homesteadBlock": 1,
     9      "eip150Block": 2,
    10      "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    11      "eip155Block": 3,
    12      "eip158Block": 3,
    13      "byzantiumBlock": 4,
    14      "constantinopleBlock": 5,
    15      "clique": {
    16        "period":1, 
    17        "epoch": 30000
    18      }
    19    },
    20    "nonce": "0x0",
    21    "timestamp": "0x5d8993f8",
    22    "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000ffd79941b7085805f48ded97298694c6bb950e2c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    23    "gasLimit": "0x7a1200",
    24    "difficulty": "0x1",
    25    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    26    "coinbase": "0x0000000000000000000000000000000000000000",
    27    "alloc": {
    28      "ffd79941b7085805f48ded97298694c6bb950e2c": {
    29        "balance": "0x200000000000000000000000000000000000000000000000000000000000000"
    30      }
    31    },
    32    "number": "0x0",
    33    "gasUsed": "0x0",
    34    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
    35  }
    36  
    37  ```
    38  
    39  ##### 导入0xffd79941b7085805f48ded97298694c6bb950e2c私钥
    40  
    41  ```bash
    42  mkdir data
    43  echo 04c070620a899a470a669fdbe0c6e1b663fd5bc953d9411eb36faa382005b3ad > privkey
    44  echo 111111 > password
    45  ./bin/sipe account import ./privkey --password ./password --datadir ./data
    46  
    47  ```
    48  ##### sipe
    49  
    50  - 初始化genesis block
    51  ```bash
    52  sipe init ./poa.json --datadir data/
    53  ```
    54  
    55  - 启动sipe
    56  ```bash
    57  sipe --cache 1024 --datadir ./data --nodekey \
    58  ./nodekey --rpc --rpcvhosts "*"  --rpcaddr 0.0.0.0 \
    59  --rpcport 8545 --rpccorsdomain "*" --rpcapi "db,eth,net,web3,personal,debug" \
    60  --ws --wsorigins "*" --wsaddr 0.0.0.0 --wsport 8546 --wsapi "db,eth,net,web3,personal,debug" \
    61  --unlock 0xffd79941b7085805f48ded97298694c6bb950e2c --password <(echo 111111)  \
    62  --txpool.globalslots=51200 --verbosity 2  --gasprice 0 --miner.recommit=200000s  \
    63  --miner.gaslimit=540000000
    64  ```
    65  
    66  - 设置gc,开始挖矿
    67  ```bash
    68  sipe attach data/sipe.ipc
    69  
    70  > debug.setGCPercent(200)
    71  100
    72  > miner.start()
    73  ```
    74  
    75  
    76  ##### dummytx
    77  带有20字节address+64字节随机值(模拟hash值)的转账交易, 
    78  有7个向0xffd79941b7085805f48ded97298694c6bb950e2c转账的账户可选,
    79  如果账户没足够的sipc, 会从0xffd79941b7085805f48ded97298694c6bb950e2c转出10000sipc给该账户
    80  
    81  ```bash
    82  $ ./bin/dummytx -h
    83    Usage of ./bin/dummytx:
    84      -accounts int
    85        	the number of sender (default 4)
    86      -monitor
    87        	enable monitor txs in block
    88      -url string
    89        	websocket url (default "ws://127.0.0.1:8546")
    90  
    91  ```
    92  
    93  
    94  ```bash
    95  $ ./bin/dummytx -accounts=3 --monitor
    96    2020/01/15 11:48:33 main.go:20: select 3 accounts
    97    2020/01/15 11:48:33 dummytx.go:74: sender:0 0xE60D800A6204cC85F90D18b278Bf1C6b74bbe0a8
    98    2020/01/15 11:48:33 dummytx.go:74: sender:1 0xCb385dCeA24c7Ce409378711430315E5530256bb
    99    2020/01/15 11:48:33 dummytx.go:74: sender:2 0x739603cA329A679C376FB185d20e7EbBd165EeA9
   100    2020/01/15 11:48:33 dummytx.go:133: waiting 5 seconds for claim funds txs finalize to block...
   101    2020/01/15 11:48:38 main.go:29: start monitor txs in blockChain
   102    2020/01/15 11:48:39 dummytx.go:250: block Number: 872, txCount: 0
   103    2020/01/15 11:48:40 dummytx.go:250: block Number: 873, txCount: 16280
   104    2020/01/15 11:48:41 dummytx.go:250: block Number: 874, txCount: 12601
   105    2020/01/15 11:48:42 dummytx.go:250: block Number: 875, txCount: 14500
   106    2020/01/15 11:48:43 dummytx.go:250: block Number: 876, txCount: 15170
   107    2020/01/15 11:48:44 dummytx.go:250: block Number: 877, txCount: 14764
   108    2020/01/15 11:48:45 dummytx.go:250: block Number: 878, txCount: 14473
   109    2020/01/15 11:48:46 dummytx.go:250: block Number: 879, txCount: 9659
   110    ^C2020/01/15 11:48:46 dummytx.go:198: warn: send tx: context canceled
   111    2020/01/15 11:48:46 dummytx.go:219: total finalize 97447 txs in 8.278950703 seconds, 11770.452983213036 txs/s
   112    2020/01/15 11:48:46 dummytx.go:156: sourceKey[1] return (total 38426 in 8.273616507 s, 4644.401872807277 txs/s)
   113    2020/01/15 11:48:46 dummytx.go:198: warn: send tx: context canceled
   114    2020/01/15 11:48:46 dummytx.go:156: sourceKey[0] return (total 38416 in 8.273467004 s, 4643.277114833103 txs/s)
   115    2020/01/15 11:48:46 dummytx.go:198: warn: send tx: context canceled
   116    2020/01/15 11:48:46 dummytx.go:156: sourceKey[2] return (total 38371 in 8.273688055 s, 4637.714130013814 txs/s)
   117    2020/01/15 11:48:47 main.go:42: txsCount=115213
   118    2020/01/15 11:48:47 main.go:43: dummy transaction exit
   119  ```