Skip to content

BaerChain BuildTestNetwork

weidong edited this page Apr 9, 2020 · 2 revisions

BearChain Test network construction

1. File preparation

  • The connection to the test network requires "genesis.json", "config.json" and the execution file "brcd", as explained below:

1.1 genesis.json file description Back Dir

  • (1) genesis.json, the genesis file is mainly some configuration of the chain.The genesis file given below is the genesis file of the current testnet.You need to keep the genesis file consistent to network
{
  "sealEngine":"SHDpos",
  "params": {
    "accountStartNonce": "0x00",
    "networkID": "0x1",
    "chainID": "0x1",
    "maximumExtraDataSize": "0x20",
    "tieBreakingGas": false,
    "minGasLimit": "0x1388",
    "maxGasLimit": "7fffffffffffffffffffff",
    "minimumDifficulty":"0x14",
    "dposEpochInterval": 0,
    "dposVarlitorInterval":1000,
    "dposBlockInterval": 1000
  },
  "genesis":{
    "nonce": "0x0000000000000042",
    "difficulty": "0x200",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "author": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
    "gasLimit": "0x7ffffffffffffffffffff",
    "sign":"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
  },
  "accounts":{
    "000000000067656e657369735661726c69746f72":{
      "genesisVarlitor": [
        "4d51ba213bad0f7ed97d336b2c00dc76576aac98",
        "8870f2e94d485ae78e70269a730b34c30132d88d",
        "19472617f1b685dd89b05d4c9eadb742da966a3c",
        "687ec522068acf768a6d3d831c39fadb674b39da",
        "49d233b6815dc0970458036cd1b1f9b0aaeb1e4f",
        "239d5368178b761b4b2f167a908e9797620fb934",
        "adac92008f03107e11cec579b66a26b2b0f31686",
        "a105a2971e22df8678c1977e29ccc2b176acec9d",
        "bd0f16716a14a758b71386aee788aca8f5bbb263",
        "c815dc68af24de193269fef5901eaaf23919ccf1",
        "643dddd85490ab2027485db726f789b26ea15966",
        "b24219bfb32cc17cf85f0ee5cbead3d7907cd77d",
        "136383aeeaf7b061843c788d3b37b65ebb53fa6d",
        "35e90dff4f118e2bb724b046ce041fb0e1ccdd1e",
        "455081db530d645f6a9c8baffd1580e965216e81",
        "b7e8d387ea4783afa73fdbce7feb78636d827fe2",
        "a3e14e35079fe44267bdd94babbb50dc2a4fe448",
        "adc2ec205e626826ac2b3ccabf2c7595b1a2b941",
        "29ba89c1e7993542eb759a060749bf3269526ecd",
        "cd77a1540e2e93278a89e0ded3b027d7dd6935ef",
        "0c40635a7e0e12958d8ebd0e4e8dca846f48e293"
      ]
    },
    "0000000067656e6573697343616e646964617465":{
      "genesisVarlitor": [
        "42daa2ba4f1e521b0e36fc486aa67ff335071c11",
        "5be003232b41ae83e23801ef3794b30e5c19e27e",
        "910ab9bd72f1fc270e7793402936dcbd7aff604d",
        "cb2cb2608f63b123d8bd2ffe223ecaeff78d6ead",
        "783a36b30543ab1d372bc2e75785ddfaf0c6100e",
        "8f6b2ea48cdc75c7a242e3a9f28b6bd012e28d12",
        "ba1dde2d2ab18d671ac5978329306c64f1c9b9ce",
        "b55156b074f43358366cd35e37399518fc6e24ed",
        "f69db1cc9033f8b9aeae7475291f0aa38512109b",
        "5766268cde20efbb2e6749d098472c7a933cdc9e",
        "566c40c134f26c79e7237cdeac9e0b90a9b38f48",
        "a7f38b517edc7ad5fb0ead944c033d3862b48eea",
        "abd147e73176b1759a9e004f66ee24e46fc964f9",
        "a32d4138fe723c7107c2da315fd18c7f3d1ea20b",
        "997d7d94b715c37d599d6312dd5257fb652cd444",
        "b512b990a81d7d86131135688280e9a2a242a067",
        "db8afb72a65304e06862498f8b49650743965972",
        "9fd975135af939121e9a9261821e4a4cbd2565a1",
        "84bcca74c4bc1cb66cc57550fe2ee9d98f8da8c1",
        "1fe79dc07f1fb4be5e5c3a1cffd1cf3108ac0e35",
        "c36ebae8002b7ceeade7e20a17fffb8e062fe236",
        "c7c2b38460c41a89b885ac8d1a9dc4f4d9fddf2f",
        "913af8f6e9f60b2bce219c4719d9cc3320b9d564",
        "325914895aeacf420dc7774c9f29e2430f3e0c79",
        "ee3d85bc5dfc24968d845bbc7106b38029f53495",
        "1195b47186cd5da8423a32d802bdfd0a430dd7ff",
        "81e69e5f8a084d68c502a6cbb80441d546c1ed14",
        "e7733d4288baf97848b05ff5be7016fa5ec24c57",
        "97223efabcd242c1e720f749f3148bd0f9274d1c",
        "42f5407a82359fb15125cff542c0ec2f4baacb1f"
      ]
    },
    "000000000000000000000042616572436861696e":{
      "currency":{
        "cookies": "0",
        "fcookie": "2900000000000000"
      }
    },
    "e79fead329b69540142fabd881099c04424cc49f":{
      "currency":{
        "cookies": "2900000000000000",
        "brc": "2900000000000001"
      }
    },
    "db1874c67cf3628690c795f0553e0e2904b02ffd":{
      "currency":{
        "cookies": "2900000000000000",
        "brc": "2900000000000001"
      }
    },
    "c3eb4d16a99e0a04de3242729a759a45809d2628":{
      "currency":{
        "cookies": "2900000000000000",
        "brc": "2900000000000001"
      }
    }
  }
}
  • genesis.json file description Back Dir
"sealEngine"           : Consensus algorithm
"accountStartNonce"    : The initial nonce value of the account
"networkID"            : Network id
"chainID"              : Chain ID
"maximumExtraDataSize" : Maximum number of bytes of additional data
"tieBreakingGas"       : The default is false
"minGasLimit"          : Minimal consumption of transactions in the block
"maxGasLimit"          : Maximum transaction consumption in the block
"minimumDifficulty"    : Block minimum difficulty
"dposEpochInterval"    :Continuous event of block generation cycle 0: means permanent
"dposVarlitorInterval" :Block time of a block node
"dposBlockInterval"    :The longest time to a block
"genesis"              :Indicates the information in the genesis block
"nonce"                :Random number, corresponding to Nonce field of genesis block
"difficulty"           :Difficulty factor, corresponding to the Difficulty field of the genesis block. When building a private chain, you need to select the appropriate difficulty value according to the situation in order to adjust the block
"mixHash"              :A hash value corresponding to the MixDigest field of the genesis block. Together with the nonce value, it proves that enough calculations have been performed on the block
"author"               :The address of the creator of the genesis block
"timestamp"            :UTC timestamp, corresponding to the Time field of the genesis block
"parentHash"           :The hash of the parent node of the genesis block
"extraData"            :Extra data, corresponding to the Extra field of the genesis block
"gasLimit"             :Fuel cap, corresponding to the GasLimit field in the genesis block
"sign"                 :Signature, the creation block is 130-bit 0
"accounts"             000000000067656e657369735661726c69746f72 This genegeneVarlitor under this address stores the address of the block
                         0000000067656e6573697343616e646964617465 The genesisVarlitor under this address stores the address for the spare block
"currency"             : Currency to be configured(brc: Chain coin, cookies:Fuel Coin,fcookie:Number of fuel coins frozen)
  • Remarks
The genesis file has the highest priority, such as: even if the chainID is set in the code, the chainID configured in the genesis.json file will still prevail

1.2 config.json file Back Dir

{
  "private_key":[
  ],
  "peer_host":[
        {"node_id":"97c9cf9ba3686ef14346326b4dce5c969565eef142e1e9e8c00bb26338789e65ddaa4f486c344dcf31bedd56035a293ba734ca9cbd749957d852e41e53743cf6","host":"47.74.235.122:32002"},
        {"node_id":"825262b8253e80aae0f281f8d18ad3173a51fe55da6467e866c1ee44726acb5ad7d30b71ab9dfcef05955ab40f19935ceb0f0b4f9048735c3168619981902e44","host":"47.74.245.3:32002"},
        {"node_id":"c9e00ab3c635cf667e495e312b3799d262cba6e86a20710fe37e33b8e4dbb77c68930528f87da65dfc13194932f52e45e840cd38bd585e7de43627eee48ca87a","host":"8.208.12.53:32002"}
  ]
}
  • config.json file parameter description Back Dir
private_key : Default is empty
peer_host   : Linked node
			> node_id : Linked node id
			> host    : Server ip and port

1.3 brcd execution file description Back Dir

  • Obtain the testnet available code to compileTestnet code

  • please check BaerChain Compile Guide, get the "brcd" execution file we need

  • Now our execution file "brcd", genesis file "genesis.json", configuration file "config.json" are all ready to be completed and put it in the same directory), start linking test network

2. Start command Back Dir

  • ./brcd --private test1 --config ./genesis.json --accountJson ./config.json -d ./data --db-path ./db -v 2 --listen 36556 --http_port 8111

  • Parameter Description

--private     : Fixed to test1
--config      : This field means to read the genesis file, "./genesis.json" is the path of the genesis file and the genesis file
--accountJson : This field means to read the configuration file, "./config.json" is the path and configuration file of the configuration file
-d            : The path behind is where the chain information is saved
--db-path     : Where to save the chain data
-v            : Is the log level after startup
--listen      : It is a port for chain data transmission. If you build a multi-node connection, this port
--http_port   : The port used for the rpc interface, the command is sent to the node through this port

Clone this wiki locally