Sui.

Post

Share your knowledge.

deriss.
Dec 19, 2024
Expert Q&A

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
4
6
Share
Comments
.

Answers

6
CarlkawIy.
Dec 19 2024, 21:11

Once 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.

2
Best Answer
Comments
.
harry phan.
Jul 14 2025, 03:41

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>
11
Comments
.
HaGiang.
Apr 30 2025, 14:24

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.

10
Comments
.
Xavier.eth.
Dec 19 2024, 19:23

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.

3
Comments
.
Vhekee.
Aug 27 2025, 00:16

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.

1
Comments
.
YJS.
YJS215
Dec 20 2024, 06:09

Currently, there is no alternative method to using the Sui CLI for this conversion process.

0
Comments
.

Do you know the answer?

Please log in and share it.