-
Notifications
You must be signed in to change notification settings - Fork 13
BaerChain address and nodeID generation process
weidong edited this page Jun 23, 2020
·
4 revisions
- Compile brcd
- Configure genesis.json genesis file
- execute program
./brcd --config ./gensis.json -d ./data --db-path ./db
- Wait for the program to execute, there will be log output, as follows:
Node ID: enode://fa9ac6d54f551fe390b457cf123f97fcaa179d78265f035af8e73dcdbd6f1860f78b52b87281411e4cdaba140591a5b11956faf7d2cf7341528069374f8a4e41@0.0.0.0:0 listenPort:30041
- among them
fa9ac6d54f551fe390b457cf123f97fcaa179d78265f035af8e73dcdbd6f1860f78b52b87281411e4cdaba140591a5b11956faf7d2cf7341528069374f8a4e41 为NodeID
2. Address generation process Back Dir
- Execute in the compilation directory
make cmdWallet
- run
./wallet/cmdWallet/cmdWallet -g 1
- The program will randomly generate a private key and address
private-key: wDnHJb3kRV7YnUojQ6sjYnfbe93vK1YVCHHPV71GAcA
address : a49c22485d140e7c725a9d40ce801d19dbb88784
public-key : cd4846e7f5ab2d29e85e033f89cb7000a49bd223ca9fd5df5ef7c162740a7cb1336006807d5e2b8d1c6760922e7399e8ffd3261a16f4c33dd81a41a31822600f
-
Remarks: The address generation method will call std::random_device to obtain a random number. This method is only allowed to be used in Linux; under specific platforms and specific versions, the entropy value of the random number obtained by std::random_device is insufficient, and the private key is in danger of being predicted.
-
The method of generating the address and private key in the above process is for reference only, you can generate it yourself, please make sure that the private key is not leaked
3. Specify nodeID process Back Dir
- Obtain a new private key and corresponding public key during the address generation process
private-key: CbnNDpHaahsG6MTGVu4vud5paNsQF58jHGqoxP2f8gEy
public-key : 764af6627ec80bcf136cc7ee60167623f980ddbaa92e484345d88443b58319c1d1f6861e190eb048cdb575eabd1520e8328f69c758dcf1c076b67f540f0ccd24
- Add the following command in the startup program
--node-key 4tAUjwA4guRhYArjiJ9JVf7QTmNLjinc3UfChccJF6tC
- This command specifies the program nodeID as public-key. If you do not write the node-key command: the program will use the nodeID that was last started, and if there is no nodeID last time, it will randomly generate a nodeID.