-
Notifications
You must be signed in to change notification settings - Fork 13
BaerChain OfflineWalletUse
- 1.1 Generate address and private key process
- 1.2 base58 converts private key format 1 (for now only supports testnet)
- 1.3 base58 converts private key format 2 (for now only supports testnet)
1. Method for generating address and private key Back Dir
- Execute in the compilation directory, get cmdWallet execution file
cd cpp-lsac/build : Enter the directory
cmake .. : Execute instruction
make : Execute instruction
cd cpp-lsac/build/wallet/cmdWallet : 此目录下可找到刚才编译好的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 API calls the KeyPair :: create () interface, and then obtains a random number by calling std :: random_device, and generates a public and private key pair, which is only allowed for Linux before; under a specific version of a specific platform, the random number entropy obtained by std :: random_device If the value is insufficient, 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, and can be generated by yourself.
1.2 base58 convert private key formatOne Back Dir
- run
./cmdWallet --pri-tf wDnHJb3kRV7YnUojQ6sjYnfbe93vK1YVCHHPV71GAcA
- Return result
address : a49c22485d140e7c725a9d40ce801d19dbb88784
pri-base58 : wDnHJb3kRV7YnUojQ6sjYnfbe93vK1YVCHHPV71GAcA
pri-big int : 0de3d09c2ee9e4c34e47a68edea0ebec6386e9477e6b5c389ff5bfbe8dd34a53
public address : cd4846e7f5ab2d29e85e033f89cb7000a49bd223ca9fd5df5ef7c162740a7cb1336006807d5e2b8d1c6760922e7399e8ffd3261a16f4c33dd81a41a31822600f
From the returned results, we can see: pri-big int: 0de3d09c2ee9e4c34e47a68edea0ebec6386e9477e6b5c389ff5bfbe8dd34a53 is the private key conversion format we need to get
1.3 base58 convert private key formatTwo Back Dir
- Command
- Note: At this time, you need to add 0x, such as: 0x0de3d09c2ee9e4c34e47a68edea0ebec6386e9477e6b5c389ff5bfbe8dd34a53
./cmdWallet --pri-tf 0x0de3d09c2ee9e4c34e47a68edea0ebec6386e9477e6b5c389ff5bfbe8dd34a53
- Return result
address : a49c22485d140e7c725a9d40ce801d19dbb88784
pri-base58 : wDnHJb3kRV7YnUojQ6sjYnfbe93vK1YVCHHPV71GAcA
pri-big int : 0de3d09c2ee9e4c34e47a68edea0ebec6386e9477e6b5c389ff5bfbe8dd34a53
public address : cd4846e7f5ab2d29e85e033f89cb7000a49bd223ca9fd5df5ef7c162740a7cb1336006807d5e2b8d1c6760922e7399e8ffd3261a16f4c33dd81a41a31822600f
It can be seen from the returned result: pri-base58: wDnHJb3kRV7YnUojQ6sjYnfbe93vK1YVCHHPV71GAcA is the format after conversion of the private key we need
2. Use of offline wallet Back Dir
- Please refer to the voting transactions: Vote Transaction
- Please refer to the transfer transactions : Transfer Transcation
- Please refer to the pending order: PendingOrder Transcation
- Please refer to the cancel pending transaction: CancelPendingOrder Transcation
- Please refer to the receive income: Receive Income Transcation)