Create or Import Wallet
When we mention the binary, we are referencing the ./hmy
binary from the setup procedure.
When we mention the shell scripts, we are referencing the ./hmy.sh
shell script from the setup procedure.
New Wallet
Creation of a new account is done as a function of a generated bip39
mnemonic with 256 bits of entropy. You must provide an account alias name.
Using the Binary:
Using the Shell Wrapper:
Example:
Write/store this seed phrase in a safe place. it is the only way to recover your account if you ever forget your password.
This creates a keystore at the following directory:(hmy keys location)/account-name1/UTC--2019-09-16T21-25-35.297331000Z--678e7ea3dcb5f4e9724c0e761843572f10c49b73
When creating keys this way, hmy
will ask you to provide a passphrase. Make sure you keep track of this passphrase for future use because the passphrase is used to decrypt the keystore when signing transactions. Also make sure you save the seed phrase, also called a mnemonic.
If you don't provide a passphrase using the --passphrase
flag, the default passphrase is an empty string ""
. The passphrase is used to decrypt the keystore when signing transactions.
To know where your wallet file has been created, run the following command:
Using the Binary:
Using the Shell Wrapper:
You can check the list of wallets (local accounts) with the following command:
Using the Binary:
Using the Shell Wrapper:
Import Wallet
Importing a Keystore
You might have an existing keystore made by Harmony's old wallet.sh
program that ends with ".key" in the file name (example):
one16qsd5ant9v94jrs89mruzx62h7ekcfxmduh2rx.key
Or that starts with "UTC" in the file name (example):
UTC--2020-01-15T01-02-06.606670000Z--9689a0711642bf08ea92ed98d552f0c1b8c8cefb
Both these files can be imported into hmy
using the command import-ks
as shown below.
Note that the --passphrase flag only enables a password prompt after the command is entered, there are no other arguments necessary here (if you dont put --passphrase flag in the command it will assume no password needed and will not prompt you for one, which basically means that your wallet keyfile will not be password protected!).
Using the Binary:
Using the Shell Script:
Examples:
Keep in mind that you should know the passphrase associated with the imported keystore and pass it as a parameter as shown in the commands above. For keystores created by Harmony's wallet.sh
, the default passphrase is an empty string; this matters for signing transactions.
Importing a Private Key
Sometimes you might have a secp256k1 private key, such as the one generated from the following command:
You can import the key with an optional name and passphrase
Using the Binary:
Using the Shell Script:
Example:
If no account name is provided, a random word concatenated with -imported
will be used. If no passphrase is provided, the default passphrase will be used (which is blank). Note that the CLI currently only supports importing secp256k1 private keys.
Importing a Mnemonic Phrase
You can recover lost wallet keys by entering the mnemonic words you received (and hopefully saved) when creating it:
Using the Binary:
Using the Shell Script:
Example:
Last updated