Harmony Network Staking Guide Via hmy
hmy is the official Harmony CLI (Command Line Interface) tool that is used to interact with the Harmony blockchain. With the hmy tool, you can create a wallet, check your balance, delegate tokens to a validator and do other things.
Note: Considering the fact that Open Staking hasn’t been launched yet on the Harmony Mainnet, you can only delegate to our validator on the Testnet
Download Harmony CLI tool
First of all, you need to download the Harmony CLI tool. The hmy CLI is completely open-source so you can compile a binary from source, but the easiest way to do that is to enter the following command into your terminal:
- For Linux
$ curl -LO https://harmony.one/hmycli && mv hmycli hmy && chmod +x hmy
- For macOS
$ curl -O https://raw.githubusercontent.com/harmony-one/go-sdk/master/scripts/hmy.sh
$ chmod u+x hmy.sh
$ ./hmy.sh -d
Now you can use the binary ./hmy (or ./hmy.sh for macOS) to run the CLI. Enter ./hmy help into your terminal and get the full list of commands.
Create a Wallet
To create a new wallet, you need to provide a local account alias name and passphrase that will be used to encrypt the keystore. So if you enable the passphrase protection, you are asked for a passphrase every time you send a transaction to the Harmony blockchain.
Use the following command to create your wallet:
$ ./hmy keys add YOUR_LOCAL_ACCOUNT_NAME — passphrase
Be careful, if you don’t provide the — passphrase flag, the default is an empty string “”.
💡Make sure you keep the seed phrase in a safe place!
To find out where is your wallet keystore directory, simply run:
$ ./hmy keys location
Check the list of your local accounts:
$ ./hmy keys list
Now you can see your YOUR_LOCAL_ACCOUNT_NAME and address which starts with one1**** in this list.
Getting ONE Tokens
To get ONE tokens from Faucet smart contract, use the following command:
- On the Open Staking Testnet
$ curl https://faucet.os.hmny.io/fund?address=YOUR_ONE_ADDRESS
or go to https://faucet.os.hmny.io/
To check the balance, run:
$ ./hmy — node=https://api.s0.os.hmny.io balances YOUR_ONE_ADDRESS
- On the Partner Testnet
$ curl -X GET https://faucet.ps.hmny.io/fund?address=YOUR_ONE_ADDRESS
To check the balance, run:
$ ./hmy — node=https://api.s0.ps.hmny.io balances YOUR_ONE_ADDRESS
The faucet funds 11,000 ONE tokens per account, per hour.
Delegating To A Validator
To delegate to a validator you need to replace YOUR_ONE_ADDRESS, VALIDATOR_ONE_ADDRESS, and NUMBER_OF_ONE_TOKENS, that you want to delegate in the following way:
- On the Open Staking Testnet
Everstake VALIDATOR_ONE_ADDRESS is one1eapc4kmmtj3uscrlyz9lyd3tgkdemg7un5rup0
$ ./hmy — node=https://api.s0.os.hmny.io staking delegate — delegator-addr YOUR_ONE_ADDRESS — validator-addr VALIDATOR_ONE_ADDRESS — amount NUMBER_OF_ONE_TOKENS — passphrase
- On the Partner Testnet
Everstake VALIDATOR_ONE_ADDRESS is one10yy4daleuljh02q57rf5lf8vzxr93nnrvqv7gk
$ ./hmy — node=https://api.s0.ps.hmny.io staking delegate — delegator-addr YOUR_ONE_ADDRESS — validator-addr VALIDATOR_ONE_ADDRESS — amount NUMBER_OF_ONE_TOKENS — passphrase
💡You need to enter the passphrase for the delegator-addr keystore file after this command.
Undelegating From A Validator
- On the Open Staking Testnet
$ ./hmy — node=https://api.s0.os.hmny.io staking undelegate — delegator-addr YOUR_ONE_ADDRESS — validator-addr VALIDATOR_ONE_ADDRESS — amount NUMBER_OF_ONE_TOKENS — passphrase
- On the Partner Testnet
$ ./hmy — node=https://api.s0.ps.hmny.io staking undelegate — delegator-addr YOUR_ONE_ADDRESS — validator-addr VALIDATOR_ONE_ADDRESS — amount NUMBER_OF_ONE_TOKENS — passphrase
💡You need to enter the passphrase for the delegator-addr keystore file after this command.
Collecting Rewards
After some time, you can collect your rewards using the following command
- On the Open Staking Testnet
$ ./hmy — node=https://api.s0.os.hmny.io staking collect-rewards — delegator-addr YOUR_ONE_ADDRESS — passphrase
- On the Partner Testnet
$ ./hmy — node=https://api.s0.ps.hmny.io staking collect-rewards — delegator-addr YOUR_ONE_ADDRESS — passphrase
💡You need to enter the passphrase for the delegator-addr keystore file after this command.
After launching the Open Staking on the Harmony Mainnet, you can use the same tool and commands. You will only need to replace URL in the — node flag with the public Mainnet node.
Now you know how to delegate to a validator on the Harmony blockchain via hmy.
Follow news and updates from Everstake by subscribing to the newsletter on our website and join the discussion on our social channels through the links below.
Website: everstake.one
Twitter: @Everstake_pool
Telegram: @Everstake_chat
Facebook: fb.me/everstake.one
Reddit: /r/Everstake/