Cookbook
The easiest way to get detailed help is to use the cli itself. For example below is the cookbook which gives an overview of various commands.
By default, cookbook will show the mainnet shard 0 (https://api.s0.t.hmny.io) RPC endpoint. Use the parameter --node="<RPC>" so the example would show the s0 in the targeted network, example ./hmy cookbook --node="https://api.s1.os.hmny.io" would show s0 in OSTN
1
./hmy cookbook --node="https://api.s0.t.hmny.io"
2
​
3
#Cookbook of Usage
4
​
5
#Note:
6
​
7
#1) Every subcommand recognizes a '--help' flag
8
#2) If a passphrase is used by a subcommand, one can enter their own passphrase interactively
9
# with the --passphrase option. Alternatively, one can pass their own passphrase via a file
10
# using the --passphrase-file option. If no passphrase option is selected, the default
11
# passphrase of '' is used.
12
#3) These examples use Shard 0 of Open Staking Network as argument for --node
13
​
14
#Examples:
15
​
16
#1. Check account balance on given chain
17
./hmy --node="https://api.s0.t.hmny.io" balances <SOME_ONE_ADDRESS>
18
​
19
#2. Check sent transaction
20
./hmy --node="https://api.s0.t.hmny.io" blockchain transaction-by-hash <SOME_TX_HASH>
21
​
22
#3. List local account keys
23
./hmy keys list
24
​
25
#4. Sending a transaction (waits 40 seconds for transaction confirmation)
26
./hmy --node="https://api.s0.t.hmny.io" transfer \
27
--from <SOME_ONE_ADDRESS> --to <SOME_ONE_ADDRESS> \
28
--from-shard 0 --to-shard 1 --amount 200 --passphrase
29
​
30
#5. Sending a batch of transactions as dictated from a file (the `--dry-run` options still apply)
31
./hmy --node="https://api.s0.t.hmny.io" transfer --file <PATH_TO_JSON_FILE>
32
#Check README for details on json file format.
33
​
34
#6. Check a completed transaction receipt
35
./hmy --node="https://api.s0.t.hmny.io" blockchain transaction-receipt <SOME_TX_HASH>
36
​
37
#7. Import an account using the mnemonic. Prompts the user to give the mnemonic.
38
./hmy keys recover-from-mnemonic <ACCOUNT_NAME>
39
​
40
#8. Import an existing keystore file
41
./hmy keys import-ks <PATH_TO_KEYSTORE_JSON>
42
​
43
#9. Import a keystore file using a secp256k1 private key
44
./hmy keys import-private-key <secp256k1_PRIVATE_KEY>
45
​
46
#10. Export a keystore file's secp256k1 private key
47
./hmy keys export-private-key <ACCOUNT_ADDRESS> --passphrase
48
​
49
#11. Generate a BLS key then encrypt and save the private key to the specified location.
50
./hmy keys generate-bls-key --bls-file-path <PATH_FOR_BLS_KEY_FILE>
51
​
52
#12. Create a new validator with a list of BLS keys
53
./hmy --node=https://api.s0.os.hmny.io staking create-validator --amount 10 --validator-addr <SOME_ONE_ADDRESS> \
54
--bls-pubkeys <BLS_KEY_1>,<BLS_KEY_2>,<BLS_KEY_3> \
55
--identity foo --details bar --name baz --max-change-rate 0.1 --max-rate 0.1 --max-total-delegation 10 \
56
--min-self-delegation 10 --rate 0.1 --security-contact Leo --website harmony.one --passphrase
57
​
58
#13. Edit an existing validator
59
./hmy --node="https://api.s0.t.hmny.io" staking edit-validator \
60
--validator-addr <SOME_ONE_ADDRESS> --identity foo --details bar \
61
--name baz --security-contact EK --website harmony.one \
62
--min-self-delegation 0 --max-total-delegation 10 --rate 0.1\
63
--add-bls-key <SOME_BLS_KEY> --remove-bls-key <OTHER_BLS_KEY> --passphrase
64
​
65
#14. Delegate an amount to a validator
66
./hmy --node="https://api.s0.t.hmny.io" staking delegate \
67
--delegator-addr <SOME_ONE_ADDRESS> --validator-addr <VALIDATOR_ONE_ADDRESS> \
68
--amount 10 --passphrase
69
​
70
#15. Undelegate to a validator
71
./hmy --node="https://api.s0.t.hmny.io" staking undelegate \
72
--delegator-addr <SOME_ONE_ADDRESS> --validator-addr <VALIDATOR_ONE_ADDRESS> \
73
--amount 10 --passphrase
74
​
75
#16. Collect block rewards as a delegator
76
./hmy --node="https://api.s0.t.hmny.io" staking collect-rewards \
77
--delegator-addr <SOME_ONE_ADDRESS> --passphrase
78
​
79
#17. Check elected validators
80
./hmy --node="https://api.s0.t.hmny.io" blockchain validator elected
81
​
82
#18. Get current staking utility metrics
83
./hmy --node="https://api.s0.t.hmny.io" blockchain utility-metrics
84
​
85
#19. Check in-memory record of failed staking transactions
86
./hmy --node="https://api.s0.t.hmny.io" failures staking
87
​
88
#20. Check which shard your BLS public key would be assigned to as a validator
89
./hmy --node="https://api.s0.t.hmny.io" utility shard-for-bls 2d61379e44a772e5757e27ee2b3874254f56073e6bd226eb8b160371cc3c18b8c4977bd3dcb71fd57dc62bf0e143fd08
Copied!
Last modified 1yr ago
Export as PDF
Copy link