This is a simple quick start tool to understand the apis via gRPC that Hedera platform provides.
To get started, you must either have a mainnet
or a testnet
account.
You can register at portal.hedera.com to get an account, or get another user who already has an account to create one for you.
A Hedera account is represented in a numeric format, delimited by 2 dots. For example 0.0.1234
. The first number in this example "0" represents the shard number. The second number "0" represents the realm number and the last number "1234" is the account number.
Hedera currently has 3 services.
- Crypto service
- File service
- Smart contract service
and an upcoming 4th service - Hedera consensus service.
To read what Hedera has to offer, you can check out
Hedera CLI works with Java versions 10/11/12.
There are 2 ways to start Hedera CLI.
The first, download hedera cli via brew tap
or curl
.
# macOS
brew tap hashgraph/tap
brew install hedera-cli
# unix / linux
curl -s https://raw.githubusercontent.com/hashgraph/hedera-cli/master/install.sh | sudo bash
To run the hedera shell,
hedera
Once that is running, you should see this
There is the concept of an operator account where the operator can pay for the transaction costs, ie network and node fees.
Cli will prompt setup
on first run to save default operator key into ~/.hedera
.
Setting up an operator can be done with either passphrase or private key
- 24 recovery words, where words are separated by spaces.
- Private key either in hexadecimal or ASN1 encoded format.
AccountGetInfo is called during setup to confirm the account exists on Hedera. This will cost some tinybars.
The default operator can be changed anytime by using account use 0.0.xxxx
.
# Sets the default operator
setup
# To see the list of available networks
network ls
# To change network
network use mainnet
network use testnet
# Lists all accounts associated with current network
account ls
# Checks current version
version
# Switch to use any account that has been recovered and exists in `account ls`
account use 0.0.xxxx
The account must have been recovered and exists in account ls
# Sets the account as default operator.
account default 0.0.xxxx
Recovering an Hedera account using either
- 24 recovery words, where words are separated by spaces.
- Private key either in hexadecimal or ASN1 encoded format.
# Recovering an Hedera account
account recovery 0.0.xxxx
Account creation can be done in multiple ways.
Simple Key
- Creating an account using new recovery words and keypair.
- Creating an account using operator's keypair.
- Creating an account using any public key (not yet supported).
MultiSig account creation (not yet supported)
# Creates a new Hedera account using NEW recovery words and keypair. This is default.
account create -b 100000000
# Creates a new Hedera account using Operator's public key
account create -b 100000000 -k
Cli will prompt for key of account(-o) that is set for deletion. Only the account for deletion can sign the transaction.
# Deletes an account from Hedera, and transfers the remaining funds from the deleted account to the new account
account delete -o 0.0.1001 -n 0.0.1002
account delete --oldAccount 0.0.1001 --newAccount 0.0.1002
Account balance calls are free.
# Gets the balance of an account
account balance 0.0.xxxx
Gets the information of an account, such as the public keys, and stateproofs (upcoming)
# Gets the information of an account
account info 0.0.xxxx
Cli will prompt for original key as well as the new key that said account will be updated with.
# Updated the keypair of account
account update 0.0.xxxx
# shows all the available commands
help
Cryptotransfer in tinybars(-tb) or hbars(-hb). Tinybars are integers while hbars can be down to 8 decimals. Recipients(-r) are separated by commas
Valid commands
## hedera [testnet][0.0.112533] :>
## Sender is not operator
transfer -s 0.0.119312 -r 0.0.116681,0.0.121290 -tb -500,300,200
transfer -s 0.0.119312 -r 0.0.116681,0.0.121290 -hb -5,3,2
transfer -s 0.0.119312 -r 0.0.116681,0.0.121290 -hb -0.005,0.003,0.002
## Sender is operator
transfer -s 0.0.112533 -r 0.0.116681,0.0.121290 -hb -0.005,0.003,0.002
transfer -s 0.0.112533 -r 0.0.116681,0.0.121290 -hb -5,3,2
transfer -s 0.0.112533 -r 0.0.116681,0.0.121290 -tb 3000000,2000000
transfer -s 0.0.112533 -r 0.0.116681,0.0.121290 -tb -5000000,3000000,2000000
transfer -s 0.0.112533 -r 0.0.116681,0.0.121290 -tb 3000000,2000000
transfer -r 0.0.116681,0.0.121290 -tb 3000000,2000000
transfer -r 0.0.116681,0.0.121290 -tb -5000000,3000000,2000000
transfer -r 0.0.116681,0.0.121290 -hb -0.5,0.3,0.2
transfer -r 0.0.116681,0.0.121290 -hb 0.3,0.2