Post
Share your knowledge.
How to convert private key to new format via CLI
How can I convert my old private key to a new format and change from Hex to Bech32 using the Sui CLI?
- Sui
- Move
Answers
6Once you have installed the Sui CLI, use the command sui keytool convert to convert your private key to the latest format. Refer to the documentation provided here: https://docs.sui.io/references/cli/keytool for detailed instructions.
you might have a keypair file from ~/.sui/sui_config/sui.keystore. Use the following CLI command:
sui keytool convert-private-key --private-key <hex_key> --output-format bech32
This will output something like:
bech32 encoded private key: sui:ed25519:<base64_bech32>
Use the sui keytool convert command to convert your Hex-encoded private key to the new Bech32 format:
sui keytool convert <your_hex_private_key>
Replace <your_hex_private_key> with your actual Hex-encoded private key (without the 0x prefix).
For example:
sui keytool convert 1b87a727f58830d9ba2bfe6ecdc8fb49aa96fa2a2bbe175e128bfee13f6895ff
If you want to import the converted key into your local Sui Keystore:
sui keytool import --alias <your_alias> <bech32_private_key> <key_scheme>
This will add the key to your local keystore and associate it with the alias mykey.
To convert your old private key to the new format, you need to use the Sui CLI. First, download the Sui CLI, which can be done through a package manager like Chocolatey or by downloading the binary directly.
To convert your private key to a new format and change from Hex to Bech32 using the Sui CLI, follow these steps:
- sui keytool convert <hex_private_key> --current
- This command will output the private key in the Bech32 format, which can be used with the Sui network.
Some key points to keep in mind:
- Private Key Security: Ensure your private key is stored securely to prevent unauthorized access.
- Bech32 Format: The Bech32 format is used for Sui addresses and private keys, providing better readability and error detection.
By using the Sui CLI, you can easily convert your private key to the new format and take advantage of the Bech32 encoding scheme's benefits.
Currently, there is no alternative method to using the Sui CLI for this conversion process.
Do you know the answer?
Please log in and share it.
Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.
- How to Maximize Profit Holding SUI: Sui Staking vs Liquid Staking615
- Why does BCS require exact field order for deserialization when Move structs have named fields?65
- Multiple Source Verification Errors" in Sui Move Module Publications - Automated Error Resolution55
- Sui Move Error - Unable to process transaction No valid gas coins found for the transaction419
- Sui Transaction Failing: Objects Reserved for Another Transaction410