- Construct a client
- Generate a key
- Generate a key (with mnemonic)
- Get address book
- Get exchange rates
- Logger
- Sign a scheduled transfer transaction
- Sign a scheduled transfer transaction (with comments)
- Schedule identical transaction
- Schedule multisig transaction
- Schedule multisig transaction (with threshold)
- Create an account
- Create an account (threshold key)
- Create an account (with alias)
- Create an account (with alias and receiver signature required)
- Account creation ways
- Create an account with Hts
- Auto create an account with transfer transaction
- Account alias
- Account allowance
- Get account info
- Get account balance
- Update an account
- Delete an account
- Staking
- Staking (with update)
- Multisig
- Account hooks
- Lambda SStore
- Create a topic
- Topic management
- Consensus Pub Sub
- Consensus Pub Sub (chunked)
- Consensus Pub Sub (with submit key)
- Transfer Hbar
- Transfer Hbar (multi app)
- Transfer tokens
- Transfer using EVM address
- Custom fees
- Custom fees (exempt)
- NFT Allowances
- Zero token operations
- Change Or Remove Existing Keys From A Token (HIP-540)
- Reject A Token (HIP-904)
- Create a contract
- Create a stateful contract
- Contract nonce (HIP-729)
- Interaction with a contract
- Contract hooks
Running the examples requires .env file to exist in the examples folder if running with Gradle:
cp .env.sample .envAnd in the root project folder if running with Intellij IDEA:
cp .env.sample ../.envThe OPERATOR_ID and OPERATOR_KEY variables should be set in a .env file.
Optionally, you can set the HEDERA_NETWORK and SDK_LOG_LEVEL variables:
- You can set the
HEDERA_NETWORKtolocalhost,testnet,previewnetormainnetfor configuring the network. If theHEDERA_NETWORKis not set, it will default totestnet. - You can set the
SDK_LOG_LEVELtoTRACE,DEBUG,INFO,WARN,ERRORorSILENTfor configuring the logging. If theSDK_LOG_LEVELis not set, it will default toSILENT. Important pre-requisite to see logs: set simple logger log level to same level as theSDK_LOG_LEVEL, for example via VM options:-Dorg.slf4j.simpleLogger.log.org.hiero=trace.
For hook-related examples (like AddHooksToAccountExample), you also need to set the HOOK_CONTRACT_ID variable:
- In our examples we use a bytecote from a specific smart contract which can be found in
/contracts/HieroHookContract.sol. - Note: Hook functionality may not be available on all networks. The example will demonstrate the configuration even if hooks are not supported.
Therefore, the format of the configuration file should be as follows:
OPERATOR_ID=0.0.102...
OPERATOR_KEY=0xeae...
# Optionally set HEDERA_NETWORK and SDK_LOG_LEVEL
HEDERA_NETWORK=previewnet
SDK_LOG_LEVEL=WARNNote that the below
./gradlewcommands should be run from the root of the project.
Template:
./gradlew -q :examples:run<NameOfExample>Concrete example:
./gradlew -q :examples:runGenerateKeySimply execute the main function of the desired example.