"],
"customFees": [
{
"type": "fixed",
"amount": 100,
"unitType": "HBAR",
"collectorId": "0.0.1234",
"exempt": false
}
]
}
```
### NFT definition file quickstart
NFT JSON files use a different schema than FT files. There is no `decimals` or `initialSupply`. You must provide at least one **`adminKey`** and one **`supplyKey`** (each can be a single string or an array of key strings). For **`supplyType`** `finite`, set **`maxSupply`**. For **`infinite`**, do not include `maxSupply`.
Example `token-nft.json`:
```json theme={null}
{
"name": "nft-keys-example",
"symbol": "NKE",
"supplyType": "infinite",
"treasuryKey": "alice-account",
"adminKey": "alice-account",
"supplyKey": "alice-account",
"memo": "Example NFT collection from file"
}
```
Create the collection on the selected network:
```sh theme={null}
hcli token create-nft-from-file --file ./token-nft.json
```
Optional fields include the same families of keys and thresholds as in code (`wipeKey`, `freezeKey`, `pauseKey`, `feeScheduleKey`, `associations`, and their threshold fields). For exact validation rules, rely on the CLI error output or the schema in the Hiero CLI repository (`NonFungibleTokenFileSchema`).
# Topic Plugin
Source: https://docs.hedera.com/hedera/open-source-solutions/hiero-cli/plugins/topic-plugin
## Most Used Commands
**Create a new topic with admin and submit key set**
```sh theme={null}
hcli topic create \
--name marketing-updates \
--memo "Weekly digest" \
--admin-key alice \
--submit-key bob
```
**Submit a message**
```sh theme={null}
hcli topic submit-message \
--topic 0.0.7473019 \
--message '{"event":"mint","amount":10}'
```
**Find messages between a range of 1 and 3**
```sh theme={null}
hcli topic find-message \
--topic marketing-updates \
--sequence-gt 1 \
--sequence-lt 3
```
## Full Command Reference
Create a new Hedera Consensus Service topic with optional memo and keys.
Define the name for this topic.
The memo for a topic.
Admin key(s) of the topic. Pass multiple times for multiple keys. Format: `{accountId}:{privateKey}`, private key in `{ed25519|ecdsa}:private:{key}` format, key reference, or account alias.
Submit key(s) of the topic. Pass multiple times for multiple keys. Format: `{accountId}:{privateKey}`, public/private key in `{ed25519|ecdsa}:public|private:{key}` format, key reference, or account alias.
Number of admin keys required to sign (M-of-N). Default: all keys must sign. Only applies when multiple `--admin-key` values are provided.
Number of submit keys required to sign (M-of-N). Default: all keys must sign. Only applies when multiple `--submit-key` values are provided.
Key manager to use: local or local\_encrypted (defaults to config setting)
Import an existing topic into state. Provide the topic ID (for example `0.0.123456`).
Topic ID to import (e.g., 0.0.123456)
Name or alias for the topic
List all topics stored in the state.
Submit a message to a Hedera Consensus Service topic
The topic ID or topic name.
Submit a message to the topic.
Key(s) to sign the message with. Pass multiple times for threshold topics. Can be `{accountId}:{privateKey}` pair, account private key in `{ed25519|ecdsa}:private:{private-key}` format, key reference, or account alias.
Key manager to use: local or local\_encrypted (defaults to config setting)
Update a Hedera Consensus Service topic. Requires admin key for most updates. Pass `null` to clear memo, submit key, or auto-renew account.
Topic ID or alias to update
New memo for the topic. Pass `null` to clear.
New admin key(s). Pass multiple times for multiple keys. Cannot be cleared, only replaced.
New submit key(s). Pass `null` to clear (makes the topic public).
Number of admin keys required to sign (M-of-N). Only applies when multiple `--admin-key` values are provided.
Number of submit keys required to sign (M-of-N). Only applies when multiple `--submit-key` values are provided.
Key manager to use: local or local\_encrypted (defaults to config setting)
Auto-renew account ID or alias. Pass `null` to clear.
Auto-renew period in seconds (min 2592000 / 30 days, max 8000000 / \~92 days)
Expiration time as ISO datetime string
Delete a Hedera topic on the network and remove it from local state, or remove from local state only with `--state-only`.
Topic name or topic ID
Remove only from local CLI state (no TopicDeleteTransaction on Hedera)
Admin credential(s) for signing TopicDeleteTransaction on Hedera. Required for network delete unless `--state-only` is used.
Key manager when resolving `--admin-key` (defaults to config)
Find messages in a topic by sequence number or filters
The topic ID or topic name to filter for.
Filter by sequence number greater than.
Filter by sequence number greater than or equal to.
Filter by sequence number less than.
Filter by sequence number less than or equal to.
Filter by sequence number equal to.
# Quickstart
Source: https://docs.hedera.com/hedera/open-source-solutions/hiero-cli/scripting/quickstart
## Scripting with Hiero CLI
Hiero CLI scripts let you run repeatable, end-to-end workflows for Hedera: creating accounts, transferring HBAR, creating tokens, submitting topic messages, and more. These scripts are designed to be non-interactive (safe for CI).
Example scripts live in the [Hiero CLI repository](https://github.com/hiero-ledger/hiero-cli/tree/main/examples/scripts):
* [`create-account-demo.sh`](https://github.com/hiero-ledger/hiero-cli/blob/main/examples/scripts/create-account-demo.sh) — operator setup, create account, view account
* [`transfer-hbar-demo.sh`](https://github.com/hiero-ledger/hiero-cli/blob/main/examples/scripts/transfer-hbar-demo.sh) — two accounts and an HBAR transfer
* [`token-topic-operations-demo.sh`](https://github.com/hiero-ledger/hiero-cli/blob/main/examples/scripts/token-topic-operations-demo.sh) — token and topic operations
Shared helpers: [`examples/scripts/common/`](https://github.com/hiero-ledger/hiero-cli/tree/main/examples/scripts/common) (`helpers.sh`, `setup.sh`). See the folder’s [README](https://github.com/hiero-ledger/hiero-cli/blob/main/examples/scripts/README.md) for how to run the demos.
## Prerequisites
* Node.js installation: 18.0.0 or higher
* Local mode (default): clone [hiero-cli](https://github.com/hiero-ledger/hiero-cli), then in the project root run `npm install` and `npm run build` so `dist/hiero-cli.js` exists
* Global mode (optional): install the CLI with `npm install -g @hiero-ledger/hiero-cli` and set `HIERO_SCRIPT_CLI_MODE=global` when running a script (see below)
* Operator credentials: `HEDERA_OPERATOR_ACCOUNT_ID` and `HEDERA_OPERATOR_KEY`. Copy [`examples/scripts/.env.sample`](https://github.com/hiero-ledger/hiero-cli/blob/main/examples/scripts/.env.sample) to `examples/scripts/.env` and fill in your values, or export both variables in your shell
These are required for scripts that submit transactions to Hedera (e.g., create account, transfer, token operations).
## Script structure (recommended pattern)
All example scripts follow the same layout:
### Step 1: Strict bash mode
```bash theme={null}
#!/usr/bin/env bash
set -euo pipefail
```
* `-e` exit immediately on error
* `-u` error on undefined variables
* `-o` pipefail fail if any command in a pipe fails
### Step 2: Paths, helpers, and setup
Resolve the script directory and repository root, then source `common/helpers.sh` and `common/setup.sh`:
* **`helpers.sh`** — defines `run_hcli` (local vs global CLI), `print_step`, `print_info`, `print_warn`, `sleep_loop`, and `pick_random_name`
* **`setup.sh`** — loads optional `examples/scripts/.env`, runs dependency/build checks in local mode, and validates required operator env vars
### Step 3: `run_hcli` (where automation begins)
From `helpers.sh`, commands go through `run_hcli` instead of calling `hcli` or `node dist/hiero-cli.js` directly:
```sh theme={null}
export HIERO_SCRIPT_CLI_MODE="${HIERO_SCRIPT_CLI_MODE:-local}"
run_hcli() {
if [[ "${HIERO_SCRIPT_CLI_MODE}" == "global" ]]; then
hcli --format json "$@"
else
(cd "${PROJECT_DIR}" && node dist/hiero-cli.js --format json "$@")
fi
}
```
Why this matters:
* Ensures every invocation uses `--format json` so scripts parse output reliably
* Local: runs the built CLI from `PROJECT_DIR`
* Global: runs the `hcli` on your `PATH` (after `npm install -g @hiero-ledger/hiero-cli`)
Set `HIERO_SCRIPT_CLI_MODE=global` when invoking a script if you do not want to build from source. The default is `local`.
## Quickstart: create an account and view it
The canonical example is `create-account-demo.sh`. From the `hiero-cli` repository root (with `HEDERA_OPERATOR_*` set or `.env` configured):
```sh theme={null}
./examples/scripts/create-account-demo.sh
```
With a globally installed CLI:
```sh theme={null}
HIERO_SCRIPT_CLI_MODE=global ./examples/scripts/create-account-demo.sh
```
The script configures testnet, sets the operator, creates one account with `1.0` HBAR, waits briefly for mirror indexing, then runs `account view`.
#### `network use` in the example scripts
When `HIERO_SCRIPT_CLI_MODE=global`, the demos call `network use --network testnet`. When using the default local build, they call `network use --global testnet`. Keep the same branch as the script you are running. If a command fails or the help text differs, use `hcli network use --help` for the CLI you actually execute.
Below is the same sequence as in `create-account-demo.sh` (paths, `run_hcli`, operator setup, create + view). For a maintained, executable copy, use that file in the repo; this block is for reading the pattern:
```sh theme={null}
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(cd "${SCRIPT_DIR}/../.." && pwd)"
source "$SCRIPT_DIR/common/helpers.sh"
source "$SCRIPT_DIR/common/setup.sh"
print_step "Selecting Hedera testnet as the active network"
if [[ "${HIERO_SCRIPT_CLI_MODE}" == "global" ]]; then
run_hcli network use --network testnet
else
run_hcli network use --global testnet
fi
print_step "Configuring CLI operator for testnet"
run_hcli network set-operator \
--operator "${HEDERA_OPERATOR_ACCOUNT_ID}:${HEDERA_OPERATOR_KEY}" \
--network testnet
ACCOUNT_NAME="$(pick_random_name)"
print_step "Creating demo account: ${ACCOUNT_NAME} (1 HBAR)"
run_hcli account create --name "${ACCOUNT_NAME}" --balance 1.0
print_info "Waiting for mirror node (sleep_loop 5)..."
sleep_loop 5
print_step "Viewing account ${ACCOUNT_NAME}"
run_hcli account view --account "${ACCOUNT_NAME}"
print_step "Done."
```
Explore the other demos and `examples/scripts/README.md` in the [Hiero CLI repository](https://github.com/hiero-ledger/hiero-cli/tree/main/examples/scripts).
# Interoperability and Bridging
Source: https://docs.hedera.com/hedera/open-source-solutions/interoperability-and-bridging
Interoperability and bridging on Hedera enable seamless communication and asset transfers between Hedera and other blockchain networks. This will allow developers to create dApps across multiple blockchain platforms, furthering the functionality and versatility of applications. Projects like **LayerZero**, **Chainlink**, and **Hashport** are among the leading providers of these integrations. Learn more about these integrations below.
🖥️ GETTING STARTED
🧱 DOCUMENTATION
🖥️ GETTING STARTED
🧱 DOCUMENTATION
🖥️ GETTING STARTED
🧱 DOCUMENTATION
# Chainlink
Source: https://docs.hedera.com/hedera/open-source-solutions/interoperability-and-bridging/chainlink
Learn how Chainlink’s Cross-Chain Interoperability Protocol (CCIP) integrates with Hedera to enable secure cross-chain messaging and token transfers.
## Chainlink CCIP on Hedera
The **Chainlink Cross-Chain Interoperability Protocol (CCIP)** is a standard for blockchain interoperability that enables developers to build **secure cross-chain applications** capable of transferring tokens, sending messages, and executing actions across multiple blockchains.
Through the **Cross-Chain Token (CCT)** standard, CCIP allows token developers to integrate new or existing tokens in a **self-serve** way—without vendor lock-in or restrictive dependencies.
**CCTs support:**
* Self-serve deployments with full control and ownership
* Zero-slippage transfers across supported chains
* Enhanced programmability via configurable rate limits
* Smart Execution for reliable cross-chain delivery
CCIP is powered by **Chainlink Decentralized Oracle Networks (DONs)**—infrastructure that has secured **tens of billions of dollars** and enabled **over \$21 trillion** in on-chain transaction value.
***
## Overview of CCIP and HTS Compatibility
On Hedera, CCIP extends interoperability between **Hedera’s Hashgraph network** and **EVM-compatible blockchains** such as Ethereum.\
It integrates seamlessly with both the **Hedera Token Service (HTS)** and standard **EVM tokens (ERC-20 and ERC-721)**, enabling developers to bridge tokens, data, and logic across ecosystems.
With CCIP, developers can:
* Send and receive arbitrary messages between chains
* Execute programmable cross-chain logic via Chainlink’s oracle network
* Use **LINK**, **Wrapped HBAR (WHBAR)**, or **ETH** as fee tokens
* Prepare for **Cross-Chain Token (CCT)** transfers once fully enabled on Hedera
**Note:** Cross-Chain Token (CCT) transfers on Hedera are currently in
progress on testnet. Current demos focus on message passing between **Hedera
Testnet** and **Ethereum Sepolia**.
***
## Getting Started with CCIP on Hedera
To explore CCIP functionality, start with the [**Hedera CCIP Demo Repository**](https://github.com/mgarbs/hedera-ccip-demos), which showcases **bi-directional cross-chain messaging** between the **Hedera Testnet** and **Ethereum Sepolia** using the Chainlink CCIP JavaScript SDK.
Explore Chainlink CCIP cross-chain message passing between Hedera and Ethereum Sepolia.
Learn how to integrate CCIP in your JavaScript dApps.
Deploy and manage Cross-Chain Tokens (CCTs) with a no-code interface.
***
### Setup
1. **Install dependencies**
```bash theme={null}
pnpm install
```
2. **Configure your environment**
```bash theme={null}
cp .env.example .env
```
Add your Hedera Testnet private key:
```
PRIVATE_KEY=0x...
```
3. **Run a demo**
```bash theme={null}
pnpm run demo:hedera-sepolia-link
```
***
## Available Demos
| Direction | Payment | Command | Description |
| ---------------- | ------- | ------------------------------------ | ------------------------------------------------------ |
| Read-only | — | `pnpm run demo:readonly` | Query CCIP configuration without sending transactions. |
| Hedera → Sepolia | LINK | `pnpm run demo:hedera-sepolia-link` | Send a message using LINK for fees. |
| Hedera → Sepolia | WHBAR | `pnpm run demo:hedera-sepolia-whbar` | Send a message using Wrapped HBAR for fees. |
| Sepolia → Hedera | ETH | `pnpm run demo:sepolia-hedera` | Send a message using ETH for fees. |
💡 **Tip:** Wrap HBAR before running WHBAR examples: `bash pnpm run
wrap-hbar ` All demos operate on **testnet** and are for educational
purposes only. They are **not audited** and should not be used in production.
***
## Network Configuration
### Hedera Testnet
| Parameter | Value |
| ------------------ | -------------------------------------------- |
| **Network Name** | Hedera Testnet |
| **RPC Endpoint** | `https://testnet.hashio.io/api` |
| **Chain ID** | `296` |
| **CCIP Router** | `0x802C5F84eAD128Ff36fD6a3f8a418e339f467Ce4` |
| **Chain Selector** | `222782988166878823` |
[**Add Hedera Testnet**](https://chainlist.org/chain/296)
***
### Ethereum Sepolia
| Parameter | Value |
| ------------------ | -------------------------------------------- |
| **Network Name** | Ethereum Sepolia |
| **Chain ID** | `11155111` |
| **CCIP Router** | `0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59` |
| **Chain Selector** | `16015286601757825753` |
[**Add Ethereum Sepolia**](https://chainlist.org/chain/11155111)
***
## Token Addresses
| Network | Token | Address |
| -------------------- | ----- | -------------------------------------------- |
| **Hedera Testnet** | LINK | `0x90a386d59b9A6a4795a011e8f032Fc21ED6FEFb6` |
| **Hedera Testnet** | WHBAR | `0xb1F616b8134F602c3Bb465fB5b5e6565cCAd37Ed` |
| **Ethereum Sepolia** | LINK | `0x779877A7B0D9E8603169DdbD7836e478b4624789` |
⚠️ **Note:** WHBAR uses **8 decimals**, while most EVM tokens use **18
decimals**.
***
## Developer Considerations
### Decimal Precision
HBAR’s smallest unit is the **tinybar (8 decimals)**.
Since CCIP on EVM networks operates with **18-decimal precision**, conversions between tinybars and wei-based values may be required.
See [Understanding Hedera’s EVM Differences and Compatibility](../../core-concepts/smart-contracts/understanding-hederas-evm-differences-and-compatibility).
### Cross-Chain Fees
Ensure your wallet holds sufficient **LINK**, **WHBAR**, or **ETH** to cover CCIP transaction fees.
### Message Timing
Cross-chain message delivery on testnet may take several minutes while the Chainlink oracle network finalizes execution.
***
## Test Tokens and Faucets
| Network | Token | Faucet |
| ------- | ----- | -------------------------------------------------------------------- |
| Hedera | HBAR | [Hedera Faucet](https://portal.hedera.com/faucet) |
| Hedera | LINK | [Chainlink Hedera Faucet](https://faucets.chain.link/hedera-testnet) |
| Sepolia | ETH | [Chainlink Sepolia Faucet](https://faucets.chain.link/sepolia) |
***
## Additional Resources
* [**CCIP Documentation**](https://docs.chain.link/ccip)
* [**CCIP Token Manager**](https://tokenmanager.chain.link/)
* [**CCIP SDK (JavaScript)**](https://docs.chain.link/ccip/ccip-javascript-sdk)
* [**Hedera CCIP Demo Repository**](https://github.com/mgarbs/hedera-ccip-demos)
* [**HashScan Explorer**](https://hashscan.io/testnet)
* [**Chainlink Faucets**](https://faucets.chain.link/)
***
## Summary
**Chainlink CCIP** establishes a universal standard for **secure, decentralized cross-chain interoperability**.
It connects Hedera to a broader multi-chain ecosystem—enabling assets, logic, and state to move across blockchains through a unified protocol.
On Hedera, CCIP provides a **modular, future-ready foundation** for interoperability, supporting **HTS and EVM token compatibility** under the **CCT standard**.
This complements other interoperability solutions such as [**LayerZero**](/hedera/open-source-solutions/interoperability-and-bridging/layerzero) and **Hashport**, positioning Hedera as a key network in the interoperable web3 ecosystem.
# LayerZero
Source: https://docs.hedera.com/hedera/open-source-solutions/interoperability-and-bridging/layerzero
## What is LayerZero?
LayerZero is an omnichannel interoperability protocol designed to facilitate cross-chain communication. By enabling secure and efficient message passing across chains, LayerZero allows developers to build [decentralized applications (dApps)](/hedera/support-and-community/glossary#decentralized-application-dapp) that operate cohesively over multiple blockchains. This capability enhances the functionality and user experience of dApps by leveraging the unique features of various ecosystems.
***
## Overview of LayerZero and HTS Compatibility
LayerZero integrates seamlessly with the Hedera Token Service (HTS) and EVM-compatible tokens (ERC-20 and ERC-721). This integration enables efficient cross-chain communication for various token types, making it easier to bridge assets such as $USDC or $Sauce between Hedera and other networks.
***
## Getting Started with LayerZero on Hedera
To get started quickly, you can begin with the Gitpod demo, which requires no environment setup. Alternatively, you can go directly into the [LayerZero Quickstart series](https://docs.layerzero.network/v2/developers/evm/getting-started). These guides provide an overview of deploying an Omnichain Application (OApp) on Hedera and other EVM-compatible networks, covering essentials like setting up your LayerZero environment and deploying contracts for cross-chain messaging.
A no-setup-required demo to experience LayerZero
A step-by-step guide for deploying an omnichain application.
Explore examples for bridging tokens with LayerZero.
***
## LayerZero Examples and Key Components
All examples in the demo repo are exploratory code and have NOT been audited. Please use it at your own risk!
### Omnichain Fungible Token (OFT) / Omnichain Non-Fungible Token (ONFT)
The OFT and ONFT token standards allow the transfer of fungible (ERC-20s) and non-fungible tokens (ERC-721s) across chains using LayerZero's messaging infrastructure. If you're bridging an existing fungible ERC token on Hedera to another EVM chain, you can deploy the [**OFT**](https://github.com/hashgraph/hedera-smart-contracts/tree/main/lib/layer-zero#oft) standard contract and the [**ONFT**](https://github.com/hashgraph/hedera-smart-contracts/tree/main/lib/layer-zero#onft) standard contract for NFTs.
#### **Use Case**
Allows fungible and non-fungible tokens to be transferred across chains.
**Example Contracts**
```solidity theme={null}
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {OFT} from "@layerzerolabs/lz-evm-oapp-v2/contracts/oft/OFT.sol";
contract ExampleOFT is OFT {
uint8 decimalsArg = 8;
constructor(
string memory _name,
string memory _symbol,
address _lzEndpoint,
address _delegate,
uint256 _initialMint,
uint8 _decimals
) OFT(_name, _symbol, _lzEndpoint, _delegate) Ownable(_delegate) {
_mint(msg.sender, _initialMint);
decimalsArg = _decimals;
}
function decimals() public view override returns (uint8) {
return decimalsArg;
}
}
```
```solidity theme={null}
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ONFT721} from "@layerzerolabs/onft-evm/contracts/onft721/ONFT721.sol";
contract ExampleONFT is ONFT721 {
constructor(
string memory _name,
string memory _symbol,
address _lzEndpoint,
address _delegate,
uint256 tokenId
) ONFT721(_name, _symbol, _lzEndpoint, _delegate) {
_mint(msg.sender, tokenId);
}
}
```
**Considerations**
* HTS tokens can function as ERC-compatible assets through an OFT adapter, requiring no modifications.
* OFT standard token contracts must be deployed on the destination chain.
### OFT Adapter / ONFT Adapter
The OFT Adapter acts as an intermediary contract that handles sending and receiving existing fungible tokens across chains. If your token already exists on the chain you want to connect to, you can deploy the [**OFT Adapter**](https://github.com/hashgraph/hedera-smart-contracts/tree/main/lib/layer-zero#oft-adapter) contract to act as an intermediary lockbox for the token. Similarly, the ONFT Adapter handles sending and receiving existing fungible tokens across chains. If your NFT already exists on the chain you want to connect to, you can deploy the [**ONFT Adapter**](https://github.com/hashgraph/hedera-smart-contracts/tree/main/lib/layer-zero#onft-adapter) contract to act as an intermediary lockbox for the NFT.
#### **Use Case**
Intermediary contract that handles sending and receiving existing fungible tokens across chains. If your token already exists on the chain you want to connect to, you can deploy the OFT Adapter contract to act as an intermediary lockbox for the token.
**Example Contracts**
```solidity theme={null}
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import {OFTAdapter} from "@layerzerolabs/lz-evm-oapp-v2/contracts/oft/OFTAdapter.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
contract ExampleOFTAdapter is OFTAdapter {
constructor(
address _token,
address _lzEndpoint,
address _owner
) OFTAdapter(_token, _lzEndpoint, _owner) Ownable(_owner) {}
}
```
```solidity theme={null}
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ONFT721Adapter} from "@layerzerolabs/onft-evm/contracts/onft721/ONFT721Adapter.sol";
contract ExampleONFTAdapter is ONFT721Adapter {
constructor(
address _token,
address _lzEndpoint,
address _owner
) ONFT721Adapter(_token, _lzEndpoint, _owner) { }
}
```
**Considerations**
* HTS tokens can function as ERC-compatible assets through an OFT adapter, requiring no modifications.
### HTS Connector
The [**HTS Connector Contract**](https://github.com/hashgraph/hedera-smart-contracts/tree/main/lib/layer-zero#hts-connector) ([independent audit report](https://hedera.com/audits-and-standards)) extends LayerZero’s functionality to accommodate HTS tokens, addressing the differences between HTS and ERC token standards. It facilitates the integration of existing ERC tokens with Hedera by bridging them as native HTS tokens. This is a variant of OFT when bringing tokens to Hedera as HTS. If you bring a token to Hedera as an ERC token, you can use [**OFT**](https://github.com/hashgraph/hedera-smart-contracts/tree/main/lib/layer-zero#oft) or [**ONFT**](https://github.com/hashgraph/hedera-smart-contracts/tree/main/lib/layer-zero#onft).
#### **Use Case**
Bridging a token from other networks to Hedera as an HTS token.
**Considerations:**
* When deploying HTS connector:
* The contract should be associated to the token or be deployed with `maxAutomaticAssociation`
* The "supply key" of the token must contain the address of the HTS Connector contract.
```solidity theme={null}
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
import {OFTCore} from "@layerzerolabs/lz-evm-oapp-v2/contracts/oft/OFTCore.sol";
import "./hts/HederaTokenService.sol";
import "./hts/IHederaTokenService.sol";
import "./hts/KeyHelper.sol";
/**
* @title HTS Connector
* @dev HTS Connector is a HTS token that extends the functionality of the OFTCore contract.
*/
abstract contract HTSConnector is OFTCore, KeyHelper, HederaTokenService {
address public htsTokenAddress;
bool public finiteTotalSupplyType = true;
event TokenCreated(address tokenAddress);
/**
* @dev Constructor for the HTS Connector contract.
* @param _name The name of HTS token
* @param _symbol The symbol of HTS token
* @param _lzEndpoint The LayerZero endpoint address.
* @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
*/
constructor(
string memory _name,
string memory _symbol,
address _lzEndpoint,
address _delegate
) payable OFTCore(8, _lzEndpoint, _delegate) {
IHederaTokenService.TokenKey[] memory keys = new IHederaTokenService.TokenKey[](1);
keys[0] = getSingleKey(
KeyType.SUPPLY,
KeyValueType.INHERIT_ACCOUNT_KEY,
bytes("")
);
IHederaTokenService.Expiry memory expiry = IHederaTokenService.Expiry(0, address(this), 8000000);
IHederaTokenService.HederaToken memory token = IHederaTokenService.HederaToken(
_name, _symbol, address(this), "memo", finiteTotalSupplyType, 5000, false, keys, expiry
);
(int responseCode, address tokenAddress) = HederaTokenService.createFungibleToken(
token, 1000, int32(int256(uint256(8)))
);
require(responseCode == HederaTokenService.SUCCESS_CODE, "Failed to create HTS token");
int256 transferResponse = HederaTokenService.transferToken(tokenAddress, address(this), msg.sender, 1000);
require(transferResponse == HederaTokenService.SUCCESS_CODE, "HTS: Transfer failed");
htsTokenAddress = tokenAddress;
emit TokenCreated(tokenAddress);
}
/**
* @dev Retrieves the address of the underlying HTS implementation.
* @return The address of the HTS token.
*/
function token() public view returns (address) {
return htsTokenAddress;
}
/**
* @notice Indicates whether the HTS Connector contract requires approval of the 'token()' to send.
* @return requiresApproval Needs approval of the underlying token implementation.
*/
function approvalRequired() external pure virtual returns (bool) {
return false;
}
/**
* @dev Burns tokens from the sender's specified balance.
* @param _from The address to debit the tokens from.
* @param _amountLD The amount of tokens to send in local decimals.
* @param _minAmountLD The minimum amount to send in local decimals.
* @param _dstEid The destination chain ID.
* @return amountSentLD The amount sent in local decimals.
* @return amountReceivedLD The amount received in local decimals on the remote.
*/
function _debit(
address _from,
uint256 _amountLD,
uint256 _minAmountLD,
uint32 _dstEid
) internal virtual override returns (uint256 amountSentLD, uint256 amountReceivedLD) {
(amountSentLD, amountReceivedLD) = _debitView(_amountLD, _minAmountLD, _dstEid);
int256 transferResponse = HederaTokenService.transferToken(htsTokenAddress, _from, address(this), int64(uint64(_amountLD)));
require(transferResponse == HederaTokenService.SUCCESS_CODE, "HTS: Transfer failed");
(int256 response,) = HederaTokenService.burnToken(htsTokenAddress, int64(uint64(amountSentLD)), new int64[](0));
require(response == HederaTokenService.SUCCESS_CODE, "HTS: Burn failed");
}
/**
* @dev Credits tokens to the specified address.
* @param _to The address to credit the tokens to.
* @param _amountLD The amount of tokens to credit in local decimals.
* @dev _srcEid The source chain ID.
* @return amountReceivedLD The amount of tokens ACTUALLY received in local decimals.
*/
function _credit(
address _to,
uint256 _amountLD,
uint32 /*_srcEid*/
) internal virtual override returns (uint256) {
(int256 response, ,) = HederaTokenService.mintToken(htsTokenAddress, int64(uint64(_amountLD)), new bytes[](0));
require(response == HederaTokenService.SUCCESS_CODE, "HTS: Mint failed");
int256 transferResponse = HederaTokenService.transferToken(htsTokenAddress, address(this), _to, int64(uint64(_amountLD)));
require(transferResponse == HederaTokenService.SUCCESS_CODE, "HTS: Transfer failed");
return _amountLD;
}
}
```
***
## Developer Considerations to Note EVM Differences
Please note the smallest unit of ***HBAR is the tinybar (8 decimal places)***, while the ***JSON-RPC relay operates 18 decimal places*** for compatibility with EVM tools. This means when dealing with `msg.value`, conversions between tinybars and weibars are necessary. Please take these differences into account, especially when calling `quote`. Reference the [Understanding Hedera's EVM Differences and Compatibility: For EVM Developers](/hedera/core-concepts/smart-contracts/understanding-hederas-evm-differences-and-compatibility/for-evm-developers-migrating-to-hedera) section for a more comprehensive list of differences.
***
## Additional Resources
* [**LZ Examples Repo**](https://github.com/hashgraph/hedera-smart-contracts/tree/main/lib/layer-zero#layer-zero-examples)
* [**Independent Audit Report**](https://hedera.com/audits-and-standards)
* [**Demo Code Repo**](https://github.com/hedera-dev/hedera-example-layer-zero-bridging-oapp)
* [**LayerZero Scan**](https://layerzeroscan.com/)
* [**Hedera Fee Estimator**](https://hedera.com/fees)
* [**LayerZero Developer Resources**](https://layerzero.network/developers)
* [**Hedera Testnet LayerZero Endpoint**](https://docs.layerzero.network/v2/developers/evm/technical-reference/deployed-contracts#hedera-testnet)
# NFT Studio
Source: https://docs.hedera.com/hedera/open-source-solutions/nft-studio
## Introduction to NFT Studio
NFT Studio is a free, open-source toolkit that makes it easier to create and manage NFTs on the Hedera network. Whether you’re creating, checking, analyzing, or organizing NFTs, NFT Studio offers a set of tools to help you through every step of the process. The Hedera network ensures that NFTs are secure, can scale as needed, and are cost-effective, making it a great choice for developers and creators at any point in their NFT projects.
Learn how NFT Studio simplifies NFT creation and management.
Explore all available tools for creating, analyzing, and organizing NFTs.
Open the live demo and experiment with NFT Studio tools directly.
Check out the open-source TypeScript SDK for developers.
See walkthroughs and tutorials on how NFT Studio works.
***
## How NFT Studio Works
NFT Studio operates through a powerful [TypeScript SDK](https://github.com/hashgraph/hedera-nft-sdk) that provides programmatic access to various tools for managing NFTs. It’s designed to support developers across every stage of the NFT lifecycle with specialized key features:
* Mint NFTs and validate metadata for [HIP-412](https://hips.hedera.com/hip/hip-412) compliance.
* Calculate rarity, assess risk, and ensure NFT security.
* Compile token holder lists, verify airdrops, and manage your community.
***
## Overview of the NFT Studio Tools
NFT Studio's tools are designed to enhance every aspect of your NFT creation and management.
Verifies which accounts are eligible to receive a specified token through an airdrop.\
[Try Demo](/hedera/open-source-solutions/nft-studio/airdrop-list-verifier) · [Open Tool](https://nft-studio.hashgraph.com/airdrop-list-verifier/) · [View Source](https://github.com/hedera-dev/airdrop-verifier)
Validates NFT metadata against [HIP-412](https://hips.hedera.com/hip/hip-412)
standards. [Try
Demo](/hedera/open-source-solutions/nft-studio/metadata-validator) · [Open
Tool](https://nft-studio.hashgraph.com/metadata-validator/) · [View
Source](https://github.com/hedera-dev/metadata-validator)
Analyzes unique traits within NFT collections to generate rarity scores and
insights. [Try
Demo](/hedera/open-source-solutions/nft-studio/nft-rarity-inspector) · [Open
Tool](https://nft-studio.hashgraph.com/nft-rarity-inspector/) · [View
Source](https://github.com/hedera-dev/rarity-inspector)
Compiles account lists by token holdings and ownership duration. [Try
Demo](/hedera/open-source-solutions/nft-studio/nft-token-holders-list-builder)
· [Open Tool](https://nft-studio.hashgraph.com/token-holders-list-builder/) ·
[View Source](https://github.com/hedera-dev/token-holders-list-builder)
Evaluates token risk on the Hedera network based on properties like Admin Key
and KYC Key. [Try
Demo](/hedera/open-source-solutions/nft-studio/nft-risk-calculator) · [Open
Tool](https://nft-studio.hashgraph.com/nft-risk-calculator/) · [View
Source](https://github.com/hedera-dev/risk-calculator-for-hedera-tokens)
Captures and filters token distribution snapshots for holders.\
[Try Demo](/hedera/open-source-solutions/nft-studio/token-balance-snapshot) · [Open Tool](https://nft-studio.hashgraph.com/snapshot-tool/) · [View Source](https://github.com/hedera-dev/balance-snapshot)
# Airdrop List Verifier
Source: https://docs.hedera.com/hedera/open-source-solutions/nft-studio/airdrop-list-verifier
The [Airdrop List Verifier](https://nft-studio.hashgraph.com/airdrop-list-verifier/) is a tool that streamlines organizing airdrops for Hedera tokens. By inputting a token ID and a list of account IDs, users can quickly verify which accounts are either associated with the token or have available auto-association slots. This tutorial will guide you through generating a refined list of eligible accounts, enabling efficient and targeted airdrops.
***
## How to Use the Airdrop List Verifier
### **Enter the Token and Account Details**
To demonstrate the functionality of the Airdrop List Verifier, we'll use the [SIWAS by Kabila](https://market.kabila.app/en/collections/2179656) collection (token ID: [`0.0.2179656`](https://hashscan.io/mainnet/token/0.0.2179656)) to verify which accounts are eligible to receive an airdrop. Open your browser and navigate to the [Airdrop List Verifier](https://nft-studio.hashgraph.com/airdrop-list-verifier/) web app. In the *Token ID* field, enter the ID of the token you want to verify for airdrop eligibility. Next, in the *Account IDs List* field, input the account IDs of the users you plan to airdrop the token to.
### **Build the List**
Once all details are entered, click **"Build List."** The verifier will process each account ID against the specified token ID to determine eligibility. Once complete, a list of eligible accounts will be generated, enabling seamless token distribution.
The Airdrop List Verifier can be applied in different scenarios, such as:
* *C*ommunity Reward Drops
* Verify the eligibility of community members based on their token associations before distributing rewards or exclusive NFTs.
* New Token Launches
* Before launching a new token, filter potential recipients who already hold related tokens or meet certain criteria (e.g., association with other collections).
* Filtered Airdrops Based on Ownership
* Target airdrops to specific groups of token holders, such as those who have held a token for a certain duration or meet minimum holding amounts.
**Best Practices**
To make the most out of the Airdrop List Verifier, consider the following best practices:
* Before uploading, make sure the list of account IDs is accurate and up to date, as any invalid entries will affect your results.
* If your token requires a specific association, ensure the correct token ID is input to avoid distributing it to unintended recipients.
* Ensure the token's settings (like KYC requirements and association rules) match your intended airdrop criteria so that only eligible accounts are verified.
These tips help prevent common issues like distributing to incorrect accounts or missing eligible recipients.
#### 🎉 Great job! You've successfully verified the eligible recipients for your airdrop. Next, use the Metadata Validator to ensure your NFT metadata is compliant.
***
## Additional Resources
* [**SIWAS by Kabila Collection** ](https://market.kabila.app/en/collections/2179656)
* [**HashScan Network Explorer**](https://hashscan.io/)
* [**Hedera Testnet HBAR Faucet**](https://portal.hedera.com/faucet)
* [**Hedera Developer Portal Account**](https://portal.hedera.com/)
* [**Create Your First Frictionless Airdrop Campaign**](/hedera/tutorials/token/create-your-first-frictionless-airdrop-campaign)
# Metadata Validator
Source: https://docs.hedera.com/hedera/open-source-solutions/nft-studio/metadata-validator
The [Metadata Validator](https://nft-studio.hashgraph.com/metadata-validator/) is built to check your NFT metadata against the [HIP-412](https://hips.hedera.com/hip/hip-412) *(NFT Token Metadata JSON Schema v2)* standards, ensuring proper representation. You can validate metadata by uploading a CSV file, a single JSON file, or a zip file containing multiple JSON files. The tool identifies errors or missing fields, allowing for easy corrections and ensuring compliance with standards. This tutorial will guide you through uploading, validating, and correcting your NFT metadata for seamless compliance.
***
## How to Use the NFT Metadata Validator
### Step 1: Download the Example Files
[Download](https://nft-studio.hashgraph.com/metadata-validator/examples/examples.zip) the example files. These files contain sample NFT metadata in various formats (zip, JSON, CSV) and will help you understand how to use the tool to validate your metadata.
### Step 2: Upload Metadata for Validation
If you're validating JSON metadata, drag the zip file with the JSON files into the "upload a file" drop area. Once the zip file is successfully uploaded, the tool will process all the JSON files included in it.
```json5 7.json theme={null}
{
"image": "Qma7YUAcUa4WZymcAJduafmpdmy34ZTpJpnbLweVQ6p5cA",
"type": "image/webp",
"name": "Cowboy cat #7",
"description": "A daring blend of the wild west and cyberpunk, this cat is a trailblazer in neon green and silver.",
"attributes": [
{ "trait_type": "face", "value": "cybernetic eye patch" },
{ "trait_type": "hair", "value": "neon green cowboy hat" },
{ "trait_type": "body", "value": "metallic silver vest" },
{ "trait_type": "background", "value": "digital wild west" },
{ "trait_type": "personality", "value": "adventurous" }
]
}
```
Alternatively, you can upload the example CSV file downloaded earlier. If you are unfamiliar with JSON, using a CSV file can be a simpler way to format your metadata. When you upload the CSV file, the tool provides an option to convert the CSV into JSON files, which is the standard format for NFT metadata. This feature helps you create valid JSON files to use with your NFTs.
```csv example-3.csv theme={null}
name,creator,creatorDID,description,image,type,properties,,attributes,,,,,
--,--,--,--,--,--,external_url,url,face,hair,body,background,head,personality
Cowboy Cat #1,,,"A cat that is a cowboy, embodying the spirit of the Wild West with a modern twist. This brave feline is not just any cat - it's a cat with a mission, a cat on the edge of adventure.",QmZVVALmDcoqgYmTJAqGUkyosEeMZYUdnar7m2z89QABwa,image/webp,,,holographic beard,white bucket cap,purple sweater with satchel,grey,gradient 2
Cowboy Cat #2,,,"An adventurous cat cowboy in the Wild West.",QmZ7EEZuqCqaxVUJwvbpGb7hXUaBZjUxzpAKk8Ld7ZjJTT,image/webp,,,smirking,black stetson,red bandana and blue jeans,desert,large sombrero
Cowboy Cat #3,,,"A cat ready for a night adventure, dressed in a cowboy outfit.",QmaNUz31TLU2SUgxVb3gPq82ZuQJq9yajMDJdWrWGdaXdP,image/webp,,,mysterious,hidden under a hat,cloaked figure,night desert,wearing a classic cowboy hat
Cowboy Cat #4,,,"A fearless cat cowboy standing boldly against the desert night.",QmXPXQaG27cFW7MS2pAj76njwHg3whfaZ8BY6NENz1ZECQ,image/webp,,,adventurous,visible under the moonlight,dark cloak with sheriff's badge,desert,wearing a cowboy hat with a wide brim
Cowboy Cat #5,,,"Ready for an adventure in the wild, wild west, Cowboy Cat #5 showcases a humorous and colorful style. This feline sheriff is all about fun and games, donning a bright red bandana and a shiny sheriff's badge.",,,,,smirking,brown cowboy hat,sheriff's badge,desert,bright red bandana
Cowboy Cat #6,,,"Embracing the mysteries of the wild west at night, Cowboy Cat #6 is all set for a nocturnal adventure. Dressed in a dark blue cowboy hat adorned with gold stars and a matching vest, this feline explorer is ready to roam the moonlit deserts.",QmSEp5ap1UZMKoYbc7xu7we5HWc9pov8CqJN4TjzTy47ec,image/webp,,,adventurous,dark blue cowboy hat with gold stars,dark blue with gold buttons,night desert,light blue neckerchief
Cowboy Cat #7,,,"A daring blend of the wild west and cyberpunk, this cat is a trailblazer in neon green and silver.",Qma7YUAcUa4WZymcAJduafmpdmy34ZTpJpnbLweVQ6p5cA,image/webp,,,cybernetic eye patch,neon green cowboy hat,metallic silver vest,digital wild west,,adventurous
Cowboy Cat #8,,,"Embodying the spirit of the Wild West, this cat cowboy stands as a symbol of traditional cowboy values, adorned with a wide-brimmed hat and a red bandana.",QmPie2bH6AaNu4xVKdSoQtK6VVM8owfsqojQpApiTddyD4,image/webp,,,welcoming smile,wide-brimmed cowboy hat,brown leather vest,desert landscape,red bandana
Cowboy Cat #9,,,"A confident cat cowboy standing in a desert landscape with cacti and a sunset in the background.",QmQZoDMLtoqrsDBCPy3bALCAfrNbAvNJqSmwBssACX13ya,image/webp,,,wide-brimmed,bandana,sheriff,desert sunset,confident
Cowboy Cat #10,,,"A playful cat cowboy with a calico or tortoiseshell fur pattern, holding a lasso in a typical western town.",QmcMjDcbysgnv9SKy48H7zXQfgEXQZK6QxQMRj9vG19Y8Z,image/webp,,,tilted cowboy,playful smirk,calico/tortoiseshell,western town,nice
Cowboy Cat #11,,,"A futuristic cat cowboy with cybernetic enhancements and neon lights, in a sci-fi western town.",QmcWCoXrXMyLcZ24hn8Wca87RMBEfDwUeE5CTfmhLGgvx5,image/webp,,,high-tech cowboy,cloak,calico/tortoiseshell,neon-lit western town,cybernetic
```
### Step 3: Review Validation Results
After processing, the tool will return a list of the validation results for each NFT in the file (see the above image in [Step 2](#step-2%3A-upload-metadata-for-validation)). It will indicate whether the metadata passes or fails the [HIP-412](https://hips.hedera.com/hip/hip-412) standards tests.
If an NFT fails validation, you can download an [error log](#error-log) for a complete list of validation errors.
```error_log.txt theme={null}
File Name: 7.json
Errors:
- The required "type" field is missing.
- The required "image" field is missing.
```
Or click the [Details](#details) link to see the specific errors for each NFT in the validation results list. For example, in the video demo, one NFT fails validation due to a missing **"type"** field and an absent **"image"** field. You will use these results to correct the errors in your NFT's metadata in the next step.
### Step 4: Resolve the Errors in the Metadata File
Before proceeding with your NFTs, ensure all required fields are present and meet the HIP-412 standards. Open the CSV file, update the missing "**type**" and "**image**" fields, and save the file. Upload your updated metadata file to the validator tool to confirm that the errors have been resolved.
* Before minting your NFTs on Hedera, use the Metadata Validator to ensure all
metadata meets HIP-412 standards, preventing errors during token creation. \*
If you have a large collection, you can validate multiple JSON files
simultaneously by uploading them as a `.zip` file, saving time in verifying
consistency across all NFTs. \* The tool provides a step-by-step report on any
errors or missing fields, allowing you to make corrections and re-upload your
file until compliance is achieved, ensuring a smooth minting process.
#### 🎉 Awesome! Your NFT metadata is now fully validated and compliant with HIP-412 standards. Up next, assess the uniqueness of your NFTs with the Rarity Inspector.
***
## Additional Resources
* [**Download Metadata CSV Template**](https://nft-studio.hashgraph.com/metadata-validator/templates/csv-template.csv)
* [**HashScan Network Explorer**](https://hashscan.io/)
* [**Hedera Testnet HBAR Faucet**](https://portal.hedera.com/faucet)
* [**Hedera Developer Portal Account**](https://portal.hedera.com/)
* [**Hedera Improvement Proposals (HIPs)**](https://hips.hedera.com/)
* [**Create and Transfer Your First Hedera NFT**](/hedera/tutorials/token/create-and-transfer-your-first-nft)
# NFT Rarity Inspector
Source: https://docs.hedera.com/hedera/open-source-solutions/nft-studio/nft-rarity-inspector
The [NFT Rarity Inspector](https://nft-studio.hashgraph.com/nft-rarity-inspector/) allows users to upload a `.zip` file to verify NFT metadata and check for compliance with [HIP-412 standards](https://hips.hedera.com/hip/hip-412). It calculates a rarity score by analyzing the NFT's traits, features, and properties compared to the entire collection. Once the inspection is complete, each NFT is assigned a rarity score based on its uniqueness, helping artists, collectors, and traders understand its value. The higher the score, the rarer and more unique the NFT, making it more valuable than those with lower scores.
***
## How to Use the NFT Rarity Inspector
### Step 1: Upload NFT Collection File
To follow along, download the example NFT collection *`.zip`* file from the [Rarity Inspector](https://www.nfttoolkit.app/nft-rarity-inspector/) web app. Once downloaded, upload the collection to the tool.
### Step 2: Visualize NFT Rarity, Distribution, and Attributes
After uploading the collection file, the tool will process and visually display its rarity distribution. The visualization will show some key highlights, such as:
* The **most rare NFT** in the collection.
* The **most common** **NFT** in the collection.
* The **most rare attribute** in the collection.
* The **most common attribute** found in the collection.
Next, scroll down to view a detailed rarity distribution of the entire collection, providing an overview of how rarity is spread throughout. On the top right-hand side (see image below), you’ll find the **“\***Attributes Rarity\*\*\*”\*\* table, which lists all attributes along with their corresponding rarity percentages, helping you understand how frequently specific traits appear in the collection.
Click on any NFT within the collection to view comprehensive details for that individual item. Scrolling down on the NFT's page reveals its rank within the collection's rarity curve, offering a clear perspective on its uniqueness relative to other NFTs.
The rarity score generated by the NFT Rarity Inspector provides valuable insights into an NFT's relative uniqueness and potential value. Here's how to interpret the results:
* The score typically ranges across a scale, where a higher score indicates a rarer NFT. The value of the score is relative to other NFTs within the same collection.
* Each NFT is also ranked within the entire collection based on its score, giving you an idea of how unique a particular NFT is compared to others.
* The tool offers a detailed breakdown of each attribute and its rarity percentage within the collection. For example, if only 5% of NFTs share a specific trait, that trait significantly boosts the NFT’s rarity score.
By understanding the rarity score and the associated ranking, you can make informed decisions about the value of each NFT within the collection.
The NFT Rarity Inspector is designed to support various stages of your NFT project, from development to sale. Here are some practical ways to use the tool:
* Use the inspector before minting to ensure a balanced distribution of traits and accurately represent any "rare" items in your collection.
* Sellers can use the rarity scores to price their NFTs more effectively, highlighting rare traits to potential buyers and setting competitive prices based on uniqueness.
* Buyers and collectors can analyze rarity scores to make informed purchasing decisions, selecting NFTs that are more rare and potentially have greater resale value.
* Share the rarity distribution with your community to enhance transparency and generate excitement about your collection's unique aspects.
**Best Practices**
* Ensure traits are named consistently across all NFTs in your collection for accurate analysis.
* Run the tool periodically as your collection evolves or new items are added to keep rarity information current.
* Include all relevant attributes and properties in your metadata to ensure a thorough analysis and accurate rarity score.
#### 🎉 Success! You've analyzed the rarity of your NFT collection and uncovered key insights into each token's uniqueness. Now, it's time to manage your community by building targeted lists with the Token Holders List Builder.
***
## Additional Resources
* [**Other Tools NFT Studio**](https://nft-studio.hashgraph.com/)
* [**HashScan Network Explorer**](https://hashscan.io/)
* [**Hedera Testnet HBAR Faucet**](https://portal.hedera.com/faucet)
* [**Hedera Developer Portal Account**](https://portal.hedera.com/)
* [**Create and Transfer Your First Hedera NFT**](/hedera/tutorials/token/create-and-transfer-your-first-nft)
# NFT Risk Calculator
Source: https://docs.hedera.com/hedera/open-source-solutions/nft-studio/nft-risk-calculator
The [NFT Risk Calculator](https://nft-studio.hashgraph.com/nft-risk-calculator/) evaluates the potential risk associated with tokens on the Hedera network, focusing on the likelihood of a "[rug pull](/hedera/support-and-community/glossary#rug-pull)" based on specific token properties. The risk calculator generates a comprehensive risk score and risk level by analyzing key factors, such as the Admin Key, Supply Key, and KYC Key. The calculator can be used to assess both existing tokens and those you plan to create, gaining insights into how specific properties may make a collection more or less risky. This helps developers and token creators make informed decisions about token security and governance.
***
## How to Use the NFT Risk Calculator
### **Select Token Type and Enter Token Details**
Start by choosing the type of token you want to evaluate. The application offers an easy-to-use interface that lets you toggle between assessing a new token or an existing token on the Hedera network.
For **existing tokens**, input the token ID you wish to analyze on the field labeled "Token ID." We'll use the [Wild Tigers](https://x.com/wildtigers_nft) collection (id: [`0.0.6024491`](https://hashscan.io/mainnet/token/0.0.6024491)) as an example.
For a **new token**, this would be the [proposed token’s ID](#what-is-a-proposed-token-id)\*.
**Customize Token Control Levels**
Each key grants a specific level of control over token operations, letting you customize how your token is managed and interacts with users. Toggling these keys (also see [risk factors table ](#risk-factors)in the next step) provides granular control over features and security, allowing configurations that range from flexible to highly governed.
### **Key Factors Evaluated**
The key factors evaluated include whether a token has control over its operations through specific keys. For example:
* *Admin Keys* grant control over modifying the token's properties or configurations. If enabled, the admin key significantly influences the risk score since it gives the holder broad control over the token.
* *Supply Keys* control the minting and burning of the token's supply. Tokens with a Supply Key enabled have higher flexibility in adjusting supply but also pose potential risks, as the supply could be manipulated.
* *KYC Keys* determine whether accounts need to be verified (KYC’d) before transacting with the token. A token requiring KYC may indicate stricter control and lower risk but also restricts participation.
This detailed risk factor score table below breaks down the potential vulnerabilities and shows how each key influences the overall risk score.
| Key |
Risk Score |
Description |
|
ADMIN
|
🔴 200
|
The ADMIN key can be used to delete the entire collection
as they have control over the token’s administration.
|
|
WIPE
|
🔴 200
|
The WIPE key can be used to delete all tokens within that
collection for a specific account.
|
|
FREEZE
|
🟠 50
|
A collection with a FREEZE key has a moderate risk because
it can freeze an account for token transfers.
|
|
KYC
|
🟠 50
|
The KYC key can mark an account as KYC-approved.
|
|
PAUSE
|
🟠 50
|
The PAUSE key can pause or unpause a collection. Pausing a
collection prevents all transfers of the tokens within the collection.
|
|
SUPPLY
|
🟡 20
|
The SUPPLY key can change the total supply of a token
within a collection and must be set to mint additional tokens.
|
|
FEE SCHEDULE
|
🟡 20
|
The FEE SCHEDULE key has the ability to change the
Collection’s royalty fees after it has been minted. Changing the royalty
fees of a Collection will impact all tokens within the Collection
(fixed, royalty and fallback).
|
The tool provides two main outputs: a risk score and a risk level. Here's how to interpret these results:
**Risk Score**
The risk score is a numerical value that indicates the overall potential risk associated with a token.
* **Lower Scores (0-25)**: Tokens with low risk, indicating that the settings and properties of the token minimize potential vulnerabilities.
* **Medium Scores (26-50)**: Moderate risk, suggesting some factors may need to be reviewed for secure token management.
* **High Scores (51+)**: This indicates significant risk, indicating that several factors make the token susceptible to governance issues or potential "rug pulls."
**Risk Level**
The risk level provides a qualitative assessment (e.g., Low, Medium, or High) to give a more general understanding of the token’s risk profile.
**Breakdown of Risk Factors**
* The calculator provides a detailed breakdown showing how each key and token property contributes to the final risk score.
* You can use this breakdown to pinpoint high-risk settings, allowing you to make targeted adjustments to your token configuration.
**Using the Results**
* If you're evaluating an *existing token*, use the results to inform investment decisions or suggest governance changes.
* For *new tokens*, adjust key settings to achieve a balanced risk level that fits your project’s goals for security and flexibility.
**Use Risk Calculator in Combination with Other Tools**
The NFT Risk Calculator pairs well with the [Token Holders List Builder](/hedera/open-source-solutions/nft-studio/nft-token-holders-list-builder) to evaluate the risk of tokens held by specific wallet addresses and understand the potential exposure of those holders. Moreover, after identifying the list of token holders, you can use the [Airdrop List Verifier](/hedera/open-source-solutions/nft-studio/airdrop-list-verifier) to ensure smooth distribution and airdrop eligibility.
#### 🎉 Congratulations! You've successfully assessed the risk factors for your NFT collection. On the next page, capture a detailed view of your token distribution using the Token Balance Snapshot.
***
## Additional Resources
* [**HashScan Network Explorer**](https://hashscan.io/)
* [**Testnet HBAR Faucet**](https://portal.hedera.com/)
* [**Wild Tigers Collection**](https://x.com/wildtigers_nft)
* [**Create and Transfer Your First Hedera NFT**](/hedera/tutorials/token/create-and-transfer-your-first-nft)
# NFT Token Holders List Builder
Source: https://docs.hedera.com/hedera/open-source-solutions/nft-studio/nft-token-holders-list-builder
The [NFT Token Holders List Builder](https://nft-studio.hashgraph.com/token-holders-list-builder/) streamlines the process of compiling a list of wallet accounts based on specific token ownership criteria, making airdrops and community engagement more targeted and efficient. You can specify one or more token IDs to filter eligible accounts and set conditions like minimum token holdings, duration of ownership, or even a specific start date for holding the NFT. This tool enables you to easily build a tailored list of accounts that qualify for your new token distribution or NFT collection drop.
hedera\open-source-solutions\nft-studio\nft-token-holders-list-builder.mdx
***
## How to Use the NFT Token Holders List Builder
### Enter the Token ID and Parameters
Enter the token ID for the NFT project you want to analyze. For this demo, we'll use the [HANGRY BABOONS](https://www.hangry.net/) collection (ID: [`0.0.1350444`](https://hashscan.io/mainnet/token/0.0.1350444)). Next, set the minimum number of NFTs each account must hold. For example, to identify holders with *at least two* HANGRY BABOONS NFTs set the token amount to *2*.
### Specify a Holding Duration (Optional)
To refine your results further, you can add a duration filter. Specify the date from which token holders must have held the NFTs or set a holding period (e.g., in days, weeks, or months). If this field is left blank, the list will include all token holders, regardless of how long they have held their NFTs.
### Add Additional Filters
To create a more refined list, you can add additional filters for other NFT projects. For this example, let's add a filter that requires holders to own at least two NFTs from the [Dead Pixels Ghost Club](https://www.deadpixels.club/) collection. By default, the tool is set to meet all conditions, meaning accounts must match all specified criteria to be included in the final list. In this case, an account must own two [HANGRY BABOONS](https://www.hangry.net/) NFTs and two Dead Pixels Ghost Club NFTs to be added to the list.
Alternatively, you can toggle the filter to meet at least one condition, returning any accounts that meet at least one of the filters. In this case, the account would only need to own two NFTs from one of the two specified collections.
### Generate List
After setting all your filters, click Build List to generate your list. The tool will then aggregate the account IDs that match your specified criteria. For example, with the filters applied above, the tool might return a list of 140 account IDs that meet all conditions.
#### **Tip: Verify Token Holders for Airdrops**
You can use the compiled list of account IDs in other tools, like the [Airdrop List Verifier](/hedera/open-source-solutions/nft-studio/airdrop-list-verifier), to check if these accounts are eligible to receive tokens. This helps streamline the process of planning token distribution to your NFT community.
After building your list, the tool provides a breakdown of eligible accounts, showing:
* The Hedera account IDs that meet your criteria.
* The number of tokens held by each account, confirming their eligibility based on the conditions you set.
1. Before airdropping tokens for a new NFT release, use the Token Holders List Builder to compile a list of eligible accounts that already hold specific NFTs in your ecosystem.
2. Create exclusive airdrops or rewards for accounts that have held tokens for a set duration, building loyalty and community trust.
3. Identify and reward users who own NFTs across multiple collections (e.g., holders of both Token A and Token B) to encourage diverse ownership and participation.
**Best Practices:**
* Always ensure the token IDs entered are correct to avoid including unintended accounts.
* For large airdrops, do a test run with a smaller account list to verify that all criteria and results are working as expected.
* Save the exported results securely, as the eligible list is essential for executing your airdrop accurately.
#### 🎉 Well done! You've compiled a list of your token holders for targeted engagement. Next, evaluate your NFT collection's potential vulnerabilities using the Risk Calculator.
***
## Additional Resources
* [**HashScan Network Explorer**](https://hashscan.io/)
* [**Hedera Testnet HBAR Faucet**](https://portal.hedera.com/)
* [**HANGRY BABOONS Collection**](https://www.hangry.net/)
* [**Dead Pixels Ghost Club Collection**](https://www.deadpixels.club/)
* [**Create and Transfer Your First Hedera NFT**](/hedera/tutorials/token/create-and-transfer-your-first-nft)
# Token Balance Snapshot
Source: https://docs.hedera.com/hedera/open-source-solutions/nft-studio/token-balance-snapshot
The [Token Balance Snapshot](https://nft-studio.hashgraph.com/snapshot-tool/) tool allows you to capture and analyze the current distribution of tokens within a collection, helping you identify how many tokens each account holds. This is particularly useful for managing and analyzing the distribution of NFTs or fungible tokens across holders. The tool provides flexible filtering options, such as setting a minimum token amount and selecting a specific holding date or time range to analyze. This lets you create comprehensive snapshots for any set of tokens, helping you make informed decisions about community rewards, airdrops, or token management.
***
## How to Use the Token Balance Snapshot Tool
### Step 1: Enter the Token ID
We will use the [Dead Pixels Ghost Club](https://www.deadpixels.club/) ([`0.0.878200`](https://hashscan.io/mainnet/token/0.0.878200)) collection as an example for this short demo. Input the **token ID** (required) of the NFT collection to generate a snapshot of all token holders.
* **`TokenId`**: The token ID of the NFT collection.
Apply filters to narrow down your results (optional):
* **`Min. amount`:** Specify the minimum number of tokens an account must hold.
* **`Set Date`**: Specify a start date for when accounts must have held the tokens.
Then, submit your query with **`Build List`** to return your collection's snapshot using the filters.
**Tips**
* Enter only the `token ID` to capture the entire list of holders without filters.
* Use minimum token amounts and holding dates to narrow down the list to active or significant holders.
### Step 2: View and Copy the Snapshot List
Choose to:
* Copy the full list of token holders.
* Copy the list with token balances included.
The results generated by the Token Balance Snapshot provide valuable insights into the token distribution for your specified criteria. Here's how to interpret and use them effectively:
**Account Balances & Token Holders**
* The snapshot will produce a list of Account IDs and their corresponding token balances. Each row of the list indicates an account holding tokens, along with the exact amount held.
* If you applied filters (e.g., minimum token amount, specific dates), the results will only include accounts meeting those criteria, giving you a refined view.
**Using Filters for Deeper Insights**
* By setting a higher threshold, you can focus on key stakeholders holding larger amounts of tokens.
* View how token distribution changes over time by filtering for specific dates, helping you analyze trends in holder activity and community growth.
**Export & Next Steps**
Once generated, you can export the snapshot as a CSV or other available formats. This export can then be used for:
* Import the list into an airdrop tool to distribute new tokens or NFTs to eligible holders.
* Use the data for deeper analytics on your token ecosystem to inform marketing strategies, governance decisions, or community rewards.
#### **Use Cases**
* Get a detailed overview of how tokens are spread across holders and identify key accounts, such as whales, in your community.
* Use the snapshot to create a refined list of eligible accounts based on holdings, helping you distribute tokens to long-term or high-value holders.
* Identify and reward accounts that have held tokens for a specified period (e.g., 6 months), fostering community loyalty.
#### **Best Practices**
* Always verify that the correct Token ID is input to avoid errors in the snapshot.
* When filtering large collections, begin with fewer filters or smaller datasets to verify accuracy before scaling up.
* Monitor token ownership trends over time by scheduling snapshots regularly, which helps with distribution planning and community engagement tracking.
* Store exported results securely, as they contain crucial data for decision-making and token distribution.
#### 🎉 Awesome! You've obtained a comprehensive snapshot of your token holders and their balances and now completed a full tour of NFT Studio's tools!
***
## Additional Resources
* [**HashScan Network Explorer**](https://hashscan.io/)
* [**Hedera Testnet HBAR Faucet**](https://portal.hedera.com/)
* [**Dead Pixels Ghost Club Collection**](https://www.deadpixels.club/)
* [**Create and Transfer Your First Hedera NFT**](/hedera/tutorials/token/create-and-transfer-your-first-nft)
# Oracle Networks
Source: https://docs.hedera.com/hedera/open-source-solutions/oracle-networks
Oracle networks integrated with the Hedera network.
Oracle networks integrated with Hedera provide secure, reliable, and decentralized off-chain data feeds for applications and smart contracts. They bridge the gap between blockchain-based systems and external data, enabling smart contracts to access real-world information like market prices, weather forecasts, and more to execute automated actions, such as payments or trading decisions.
Hedera supports integration with multiple oracle networks, each offering unique features and specialized data feeds tailored to various use cases. Explore the oracle networks below to find the one that best suits your needs:
# Chainlink Oracles
Source: https://docs.hedera.com/hedera/open-source-solutions/oracle-networks/chainlink-oracles
## What is Chainlink?
Chainlink Oracles are decentralized services that securely connect smart contracts to real-world data, events, and computations. By bridging the gap between blockchain applications and off-chain environments, Chainlink Oracles empowers developers to build advanced, feature-rich decentralized applications (dApps) across various industries.
***
## **Getting Started with Chainlink Oracles on Hedera**
To integrate Chainlink Oracles into your Hedera-based dApp, you can start with a ready-to-use Gitpod demonstrating how to get Chainlink price feeds on Hedera using the Chainlink Price Feeds Adapter.
### Try It in Gitpod
[](https://gitpod.io/?autostart=true#https://github.com/ed-marquez/hedera-example-chainlink-price-feeds)
1. Enter your Hedera testnet credentials in the `.env` file
2. Run the test to get the latest prices for all the price feeds:
```bash theme={null}
npx hardhat test
```
[](https://github.com/hedera-dev/hedera-example-chainlink-price-feeds/blob/main/assets/console-output.png)
***
## References
* [**Chainlink Price Feeds**](https://docs.chain.link/data-feeds/price-feeds/addresses/?network=hedera\&%3Bpage=1\&page=1)
* [**Testnet LINK Token Contract**](https://docs.chain.link/resources/link-token-contracts#hedera)
* #### [**Using Data Feeds on EVM Chains**](https://docs.chain.link/data-feeds/using-data-feeds#overview)
**Have questions?** Join the [Hedera Discord](https://hedera.com/discord) and post them in the [`developer-general`](https://discord.com/channels/373889138199494658/373889138199494660) channel or ask on [Stack Overflow](https://stackoverflow.com/questions/tagged/hedera-hashgraph).
# Pyth Oracles
Source: https://docs.hedera.com/hedera/open-source-solutions/oracle-networks/pyth-network-oracle
## What is Pyth?
The Pyth Network is a first-party financial oracle network designed to provide low-latency real-world data to multiple blockchains securely and transparently. Pyth currently supports 400+ real-time price feeds across crypto, equities, ETFs, FX pairs, and commodities and has facilitated more than \$100B in total trading volume across over 50 blockchain ecosystems.
## How to integrate with the Pyth Network on Hedera?
The Pyth Price Feeds uses a "pull" price update model, where users are responsible for posting price updates on-chain when needed. In the pull model, developers should integrate Pyth into both their on-chain and off-chain code:
1. On-chain programs should read prices from the Pyth program deployed on the same chain
2. Off-chain frontends and jobs should include Pyth price updates alongside (or within) their application-specific transactions.
Please note that it is possible to replicate the legacy Oracle design with the Pyth scheduler (previously known as "price pusher"). It is an off-chain application that regularly pulls price updates on to a blockchain you can [find here](https://docs.pyth.network/price-feeds/schedule-price-updates/using-scheduler).
## Demonstration: How to integrate with the Pyth Network on Hedera?
This demo is a simple example of using Pyth prices in Hedera and is based on the [tutorial here](https://docs.pyth.network/price-feeds/create-your-first-pyth-app/evm/part-1). Follow the instructions in the tutorial to build, deploy, and use this demo.
This demo is similar to the contract written in the tutorial. The only difference is that it uses a different math to calculate the price of 1\$ in HBAR because, In the Hedera EVM layer, the native token has only 8 decimal places, while Ethereum has 18 decimal places. This means that the smallest unit of HBAR (1 wei in Hedera EVM) is 0.00000001 HBAR, while the smallest unit of ETH is 0.000000000000000001 ETH. You can see the change in the code in the [MyFirstPythContract.sol](https://github.com/hedera-dev/tutorial-js-pyth-oracle-contract-pull/blob/main/contracts/src/MyFirstPythContract.sol).
For more details, please visit this [GitHub repository](https://github.com/hedera-dev/tutorial-js-pyth-oracle-contract-pull/).
If you have any questions, please refer to the Pyth Network [documentation](https://docs.pyth.network/home) or join [Discord](https://discord.gg/invite/PythNetwork).
***
**Contributors:** [**@KemarTiti**](https://github.com/KemarTiti)
# Supra Oracles
Source: https://docs.hedera.com/hedera/open-source-solutions/oracle-networks/supra-oracles
## Overview
[Supra](https://supra.com/) is a novel, high-throughput Oracle & IntraLayer offering a vertically integrated toolkit of cross-chain solutions. These solutions include data oracles, asset bridges, and automation networks that aim to interlink all public and private blockchains. Supra provides decentralized Oracle price feeds to deliver real-world data to web3 ecosystems through various on-chain and off-chain use cases. Oracles ensure that the data from the real world is accurate, which is crucial for decentralized applications (dApps) that rely on real-world, real-time data. This is important for dApps that need real-time information, such as the prices of cryptocurrencies and various other assets. The Supra x Hedera integration aims to bring speed, security, and accuracy to real-time data feeds, enhancing the functionality and reliability of dApps on the Hedera network.
## **Developer Considerations**
Contract calls, such as `eth_call` and `eth_estmateGas`, go to the mirror node, which limits those to a small data payload size. Our engineering team has successfully upgraded the API call data payload capacity to 24 KB. This enhancement is designed to fetch a single price pair from the data feed efficiently, ensuring a more streamlined retrieval process.
**Please Note:** While this update offers improved performance to pull single price pairs, attempting to pull more than one price pair at a time may surpass the new 24 KB data payload limit. Should this limit be exceeded, the API will return an error message. We recommend structuring your API calls accordingly to avoid any potential disruptions.
## Supra Demo on Hedera
### Pull Model
This example shows how to use Supra Oracles real-world data feeds (Pull model). It fetches and verifies price data from Supra's gRPC server and use it within a smart contract on the Hedera network. These are key files:
[**`main.js`**](https://github.com/hedera-dev/hedera-example-supra-oracle-contract-pull/blob/main/client/main.js)
This `main` script interfaces with the Supra Oracle to request price data proofs for a specified pair. It demonstrates the initialization of a PullServiceClient, the request for data proofs, and the interaction with a smart contract deployed on Hedera to deliver the obtained price data.
The script enables switching between the Hedera mainnet and testnet environments. It uses Web3.js and includes functions to sign and send transactions to Hedera, estimate gas, and extract price data.
[**`MockOracleClient.sol`**](https://github.com/hedera-dev/hedera-example-supra-oracle-contract-pull/blob/main/smartcontract/MockOracleClient.sol)
This Solidity smart contract acts as a mock client for consuming Oracle pull data. It defines a structure for the price data and a function to receive and process the verified Oracle proof bytes.
### Try this Example on Your Browser with GitPod
1. Go to [this link](https://gitpod.io/#https://github.com/hedera-dev/hedera-example-supra-oracle-contract)
2. Run the following commands on the terminal:
`cd client` `npm init --y` `npm install`
3. Rename the file `.env.SAMPLE` to `.env` and enter you Hedera network credentials (testnet/mainnet):
`cp .env.SAMPLE .env`
4. Run the `main.js` script:
`node main.js`
You should see a console output similar to:
[](https://github.com/hedera-dev/hedera-example-supra-oracle-contract-pull/blob/main/images/console_output.png)
### Push Model
This example shows how to use Supra Oracles real-world data feeds (Push model).
[**`main.js`**](https://github.com/hedera-dev/hedera-example-supra-oracle-contract-push/blob/master/main.js)
With this script, you start by deploying the [`ConsumerContract.sol`](https://github.com/hedera-dev/hedera-example-supra-oracle-contract-push/blob/master/contracts/ConsumerContract.sol) and passing to its constructor the Supra storage contract address (`storageContractAddress`). Get the right storage address from: [https://supra.com/docs/data-feeds/decentralized/networks/](https://supra.com/docs/data-feeds/decentralized/networks/)
Then call the `getPrice` and/or `getPriceForMultiplePair` functions using the desired price pair indices. Get the right price pair indices from: [https://supra.com/docs/data-feeds/data-feeds-index/](https://supra.com/docs/data-feeds/data-feeds-index/)
### Try this Example on Your Browser with GitPod
1. Go to [this link](https://gitpod.io/#https://github.com/hedera-dev/hedera-example-supra-oracle-contract-push)
2. Run the following commands on the terminal:
`npm install`
3. Rename the file `.env.SAMPLE` to `.env` and enter you Hedera network credentials (testnet/mainnet):
`cp .env.SAMPLE .env`
4. Run the `main.js` script:
`node main.js`
[](https://github.com/hedera-dev/hedera-example-supra-oracle-contract-push/blob/master/images/console_output.png)
# Stablecoin Studio
Source: https://docs.hedera.com/hedera/open-source-solutions/stablecoin-studio
# CLI Management
Source: https://docs.hedera.com/hedera/open-source-solutions/stablecoin-studio/cli-management
The Command Line Interface (CLI) is a core component of Stablecoin Studio and essential for developers aiming to streamline stablecoin management. This guide takes you from installing the SDK and CLI to customizing your config file and initiating stablecoin creation via CLI commands. Whether you're just getting started or already familiar with stablecoin management, this documentation provides the resources to navigate and optimize your stablecoin operations effectively.
***
## Table of Contents
1. [Prerequisites](#prerequisites)
2. [Install Stablecoin Studio](#install-stablecoin-studio)
3. [Configure CLI](#configure-cli)
1. [Factory Contracts](#factory-contracts)
2. [Deploy Factory Contracts](#deploy-custom-factory-contract-optional)
4. [CLI Flow](#cli-flow)
5. [Start CLI](#start-cli)
6. [Create Stablecoin](#create-stablecoin)
7. [Operate Stablecoin](#operate-stablecoin)
8. [Configure Proof-of-Reserve](#configure-proof-of-reserve-por)
9. [Additional Resources](#additional-resources)
***
## Prerequisites
* [NodeJS >= 18.13](https://nodejs.org/en)
* [Solidity >= 0.8.16](https://docs.soliditylang.org/en/latest/installing-solidity.html)
* [TypeScript >= 4.7](https://www.npmjs.com/package/typescript)
* [Git Command Line](https://git-scm.com/downloads)
* [Hedera Testnet Account](https://portal.hedera.com/)
* [HashPack Wallet](https://www.hashpack.app/download)
***
## Install Stablecoin Studio
Open a new terminal and navigate to your preferred directory where you want your Stablecoin Studio project to live. Clone the repo using this command:
```bash theme={null}
git clone https://github.com/hashgraph/stablecoin-studio.git
```
Install the `npm` package globally:
```bash theme={null}
npm install -g @hashgraph/stablecoin-npm-cli
```
***
## Configure CLI
To use the CLI correctly, it is necessary to generate a configuration file where the default network, their associated accounts, and the factory contract ID will be included. These parameters can be modified later on.
#### Create a config file
From the root of the `cli` directory, start the command line tool and create a configuration file using the `wizard` command:
```bash theme={null}
cd stablecoin-studio/cli
accelerator wizard
```
The first time you execute the `wizard` command in your terminal, if you haven't added your default configuration path, the interface will prompt you to "Write your config path." To use the default configuration path, hit `enter`. This will walk you through the prompts where you will input your configuration settings and create your `hsca-config-yaml` file.
Let's go over the configuration details:
**`defaultNetwork`**
This sets the default network the application will connect to when it starts. It’s essential for defining the environment where transactions will occur (e.g., `testnet` for testing, `mainnet` for production). We will be using `testnet` for this tutorial.
```yaml theme={null}
defaultNetwork: testnet
```
**`networks`**
This property contains a list of Hedera networks that the application can connect to. Each entry specifies the name of a network and a list of consensus nodes, allowing you to switch between different Hedera environments easily.
```yaml theme={null}
networks:
- name: mainnet
consensusNodes: []
- name: previewnet
consensusNodes: []
- name: testnet
consensusNodes: []
```
**`accounts`**
This property holds the credentials for various Hedera accounts. Each account has an `accountId`, a `privateKey`, and a network association. This is critical for performing transactions, as the private key is used to sign them. The `alias` field provides a user-friendly identifier for the account and `importedTokens` can store any tokens imported into this account. You can use the Hedera Developer Portal to create the default testnet account.
```yaml theme={null}
accounts:
- accountId: YOUR ACCOUNT ID
privateKey:
key: >-
YOUR PRIVATE KEY
type: ED25519
network: testnet
alias: main
importedTokens: []
```
**`mirrors`**
This property lists the available Hedera mirror nodes for each network. Mirror nodes hold historical data and can be queried for transactions, records, etc. The `selected` field indicates whether the mirror node is the default one to be used.
```yaml theme={null}
mirrors:
- name: HEDERA
network: testnet
baseUrl: https://testnet.mirrornode.hedera.com/api/v1
selected: true
- name: HEDERA
network: previewnet
baseUrl: https://previewnet.mirrornode.hedera.com/api/v1
selected: true
- name: HEDERA
network: mainnet
baseUrl: https://mainnet.mirrornode.hedera.com/api/v1
selected: true
```
**`rpcs`**
This property specifies the RPC (Remote Procedure Call) servers available for connecting to Consensus Node services. RPCs are essential for querying smart contracts, among other functionalities. Similar to mirror nodes, the `selected` field indicates the default RPC to use.
```yaml theme={null}
rpcs:
- name: HASHIO
network: testnet
baseUrl: https://testnet.hashio.io/api
selected: true
- name: HASHIO
network: previewnet
baseUrl: https://previewnet.hashio.io/api
selected: true
- name: HASHIO
network: mainnet
baseUrl: https://mainnet.hashio.io/api
selected: true
```
**`logs`**
Here, you can specify the path where log files will be stored (`path`) and the level of logging detail you want (`level`). For example, setting the level to `ERROR` will only log error events.
```yaml theme={null}
logs:
path: ./logs
level: ERROR
```
**`factories`**
This property lists factory contract IDs (`id`) and their associated network. Factories are smart contracts that can create other contracts. By listing them here, the application knows which factories it can interact with on each network.
```yaml theme={null}
factories:
- id: 0.0.636690
network: testnet
```
```yaml theme={null}
defaultNetwork: testnet
networks:
- name: mainnet
consensusNodes: []
- name: previewnet
consensusNodes: []
- name: testnet
consensusNodes: []
accounts:
- accountId: 0.0.1234
privateKey:
key: >-
302e020100300506032XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
type: ED25519
network: testnet
alias: main
importedTokens: []
mirrors:
- name: HEDERA
network: testnet
baseUrl: https://testnet.mirrornode.hedera.com/api/v1
selected: true
- name: HEDERA
network: previewnet
baseUrl: https://previewnet.mirrornode.hedera.com/api/v1
selected: true
- name: HEDERA
network: mainnet
baseUrl: https://mainnet.mirrornode.hedera.com/api/v1
selected: true
rpcs:
- name: HASHIO
network: testnet
baseUrl: https://testnet.hashio.io/api
selected: true
- name: HASHIO
network: previewnet
baseUrl: https://previewnet.hashio.io/api
selected: true
- name: HASHIO
network: mainnet
baseUrl: https://mainnet.hashio.io/api
selected: true
logs:
path: ./logs
level: ERROR
factories:
- id: 0.0.636690
network: testnet
```
***
### Factory contracts
We provide default contract addresses for factories that we have deployed for anyone to use. They are updated whenever a new version is released.
| Contract name | Address | Network |
| -------------- | ------------ | ---------- |
| FactoryAddress | 0.0.14455068 | Testnet |
| FactoryAddress | 0.0.XXXXXX | Previewnet |
A factory contract is a specialized type of smart contract designed to generate another smart contract. It serves as a template or blueprint for creating multiple instances of other contracts with similar features but possibly different initial states and parameters.
> For example, the `ERC20Factory` is a contract that facilitates the deployment of new ERC20 tokens. The factory uses the `EIP1167` standard for simply and cheaply cloning contract functionality.
### Deploy custom factory contract (optional)
If you want to deploy your own factory contract with custom logic tailored to your specific needs, check out the `/contracts` folder [`README`](https://github.com/hashgraph/hedera-accelerator-stablecoin/blob/main/contracts/README.md) for a comprehensive guide.
***
## CLI Flow
***
## Start CLI
Start the CLI tool using the `wizard` command:
```bash theme={null}
accelerator wizard
```
When the CLI is started with the configuration file properly configured, the first action will be to select the account you want to operate with. The list of configured accounts belonging to the default network indicated in the configuration file is displayed by default.
If there are no accounts in the file for the default network, a warning message will be displayed and a list of all the accounts in the file will be displayed.
#### Main Menu
The main menu will be displayed once you select an account you want to operate with. Choose one of the stablecoin management menu options listed and follow the prompts in your interface. Let's review each option to give you a better understanding of what's available to you:
This option starts your stablecoin creation process and where you will fill in the details of your stablecoin. Details such as:
1. **Set Factory**: Before anything else, specify the factory you'll be using. You can find the list of deployed factories in our [documentation](https://github.com/hashgraph/hedera-accelerator-stablecoin#deploying-the-stable-coin-factories).
2. **Basic Details**: Input essential information like the stablecoin's name and symbol.
3. **Auto-Renew Account**: This is set by default to your current account, enabling the stablecoin creation process.
4. **Optional Details**: You'll be prompted to add details like decimal count, initial, and max supply. Default values are used if you skip.
5. **Token Keys Ownership**: Decide whether the smart contract should own all underlying token keys like pause and wipe.
6. **KYC**: Choose whether to enable KYC. If yes, specify the KYC key and decide whether to grant KYC to the current account during stablecoin creation.
7. **Custom Fees**: Decide if you want to add custom fees to the token. If yes, specify the fee schedule key.
8. **Role Management**: For any token keys set to the smart contract, you can grant or revoke roles to other accounts.
9. **Proof of Reserve (PoR)**: Optionally, link your stablecoin to an existing PoR contract or deploy a new one, setting an initial reserve. Note that PoR here is demo-quality.
10. **PoR Admin**: If deploying a new PoR, your current account will become its admin by default.
11. **Proxy Admin Ownership**: Choose the account that will own the proxy admin. It can be set to another account or contract.
12. **Configuration File**: Make sure your configuration file contains the right factory and HederaTokenManager contract addresses.
13. **Execute**: Finally, the CLI will use the configuration file to submit the request, and your stablecoin will be created.
14. **Additional Contracts**: Users who wish to use their own contracts can update the configuration file with the new factory contract ID.
Refer to the [ChainLink documentation](https://docs.chain.link/data-feeds/proof-of-reserve/) for more on PoR feeds.
Stablecoins that we have not created with our account but for which we have been assigned one or several roles must be imported in order to operate them.
1. Add token
2. Refresh token
3. Remove token
Once a stablecoin is created or added, you can operate with it. The following list contains all the possible operations a user can perform if they have the appropriate role.
1. **Send Tokens**: Transfer tokens to other accounts.
2. **Cash In**: Mint tokens and transfer them to an account. If you have linked a PoR Feed to your stablecoin, this operation will fail in two cases:
1. If you try to mint more tokens than the total Reserve (1 to 1 match between the token's total supply and the Reserve)
2. If you try to mint tokens using more decimals than the Reserve has, for instance, minting 1.001 tokens when the Reserve only has two decimals.
> *📣 This DOES NOT mean that a stablecoin can not have more decimals than the Reserve, transfers between accounts can use as many decimals as required.*
3) **Check Details**: Retrieve the stablecoin's details.
4) **Check Balance**: Retrieve an account's balance.
5) **Burn Tokens**: Burn tokens from the treasury account.
6) **Wipe Tokens**: Burn tokens from any account.
7) **Rescue Tokens**: Use the smart contract to transfer tokens from the treasury to a rescue account.
8) **Rescue HBAR**: Similarly, transfer HBAR from the treasury to a rescue account via smart contract.
9) **Freeze Management**: Freeze or unfreeze an account and verify its status. If an account is frozen, it will not be able to transfer any tokens.
10) **Role Management:** Administrators of a stablecoin can manage user roles from this menu. They can grant, revoke, edit (manage the supplier allowance), and check roles.
1. The available roles are:
1. `CASHIN_ROLE`
2. `BURN_ROLE`
3. `WIPE_ROLE`
4. `RESCUE_ROLE`
5. `PAUSE_ROLE`
6. `FREEZE_ROLE`
7. `KYC_ROLE`
8. `DELETE_ROLE`
11. **Configuration:** The last option in the menu allows for dual configuration management of both the stable coin and its underlying token. For the stablecoin, you can upgrade its contract and change its proxy admin. For the token, admins can edit attributes like name, symbol, and keys. To transfer proxy admin ownership, the current owner invites a new account ID and can cancel before acceptance. Once accepted, the ownership change is finalized.
12. **Danger Zone**: This option groups high-risk stablecoin operations that either impact all token owners or are irreversible. These are placed in a sub-menu to prevent accidental execution.
1. **Pause/Unpause**: Suspend or resume all token operations.
2. **Delete Token**: Permanently remove a token. This action is irreversible.
> *📣 Take caution when using operations in the "Danger Zone" as they have significant impacts and may not be reversible.*
***See the*** [***repo***](https://github.com/hashgraph/hedera-accelerator-stablecoin/blob/main/cli/README.md) ***for more details.***
This option displays all the stable coins the user has created or added.
This last option allows the user to display the current configuration file, modify the configuration path, change the default network and manage:
* **Accounts**: Allows the user to change the current account, see all configured accounts and also add new accounts and remove existing ones.
* **Mirror nodes**: Allows the user to change the current mirror node, see all configured mirror nodes for the selected Hedera network, add new mirror nodes and remove existing ones except for the one that is being used.
* **JSON-RPC-Relay services**: Allows the user to change the current JSON-RPC-Relay service, see all configured services for the selected Hedera network, add new JSON-RPC-Relay servies and remove existing ones except for the one that is being used.
* **Factory**: Allows the user to change the factory id of the selected Hedera network in the configuration file, to upgrade the factory's proxy, to change the factory's proxy admin owner account and, finally, to view de current factory implementation contract address as well as the factory owner account previously commented.
***
## Create Stablecoin
Start the CLI tool using the wizard command:
```bash theme={null}
accelerator wizard
```
Select "Create a new stablecoin" and proceed through the prompts to fill in the details of your new stablecoin.
***
## Operate Stablecoin
Start the CLI using the wizard command:
```bash theme={null}
accelerator wizard
```
Select the "Operate with an existing stablecoin" option and proceed through the prompts to operate your stablecoin.
🪙 [Here](#operate-with-an-existing-stablecoin) is a list of stablecoin operations.
***
## Configure Proof of Reserve (PoR)
Start the CLI using the wizard command:
```bash theme={null}
accelerator wizard
```
Select the "Create a new stablecoin" option, then proceed through the prompts.
***
## Additional Resources
# Core Concepts
Source: https://docs.hedera.com/hedera/open-source-solutions/stablecoin-studio/core-concepts
## Introduction
As the adoption of [cryptocurrencies](/hedera/support-and-community/glossary#cryptocurrency) grows, a common obstacle deterring new adoption by users is price volatility, particularly when considering these assets for everyday transactions. Stablecoins offer a solution to this volatility by maintaining a consistent value, pegged to traditional assets like the US Dollar. Prominent examples include Tether (USDT), USD Coin (USDC), and Binance USD (BUSD). The stablecoin landscape also features asset-backed options such as MakerDAO's DAI, which is crypto-secured, and Paxos Gold (PAXG), backed by physical gold. These stable assets have not only transformed crypto trading by offering a secure place to store value temporarily but also have the potential to revolutionize e-commerce by providing a stable medium for online transactions.
> ***A*** [***stablecoin***](/hedera/support-and-community/glossary#stablecoin) ***is a specialized form of cryptocurrency engineered to maintain a stable value by pegging it to an external asset, such as a fiat currency like the US Dollar or a commodity like gold. By doing so, stablecoins seek to combine the programmability and ease of transfer inherent in cryptocurrencies with the price stability typically associated with traditional currencies. This low-volatility characteristic makes stablecoins particularly useful for transactions, cross-border payments, and as a stable asset within decentralized finance ecosystems.***
Despite its many advantages, Hedera currently lacks a ready-to-use stablecoin framework. Stablecoin Studio aims to fill that void by offering a comprehensive stablecoin solution tailored to Hedera’s architecture. Developers will be equipped with a suite of resources, including essential tools, documentation, and sample code, allowing them to create applications that make use of stablecoins, such as digital wallets. The ultimate goal is to facilitate the seamless integration of stablecoins into a variety of platforms and applications, thereby boosting Hedera’s utility and adoption.
***
## Stablecoin Studio
Stablecoin Studio is an open-source solution that simplifies and enhances the granularity of access control and permission management when issuing [stablecoins](/hedera/support-and-community/glossary#stablecoin) using Hedera network services. Utilizing a hybrid solution, the platform leverages both [Hedera Token Service (HTS)](/hedera/support-and-community/glossary#hedera-token-service-hts) and [Hedera Smart Contract Service (HSCS)](/hedera/support-and-community/glossary#hedera-smart-contract-service-hscs), offering [interoperability](/hedera/support-and-community/glossary#interoperable) with [Solidity](/hedera/support-and-community/glossary#solidity) Smart Contracts. This adds an extra layer of flexibility and capability for stablecoin issuers. As an all-in-one toolkit, this project enables stablecoin issuers to easily deploy applications and oversee operations via a comprehensive management toolkit, streamlining digital asset operations.
The toolkit offers [proof-of-reserve (PoR)](/hedera/support-and-community/glossary#proof-of-reserves-por) functionality that utilizes existing systems or on-chain oracles to bolster the ability to provide transparency in disclosure while seamless custody provider integrations ease development and reduce time-to-market.
Complemented by advanced Hedera-native [Know Your Customer (KYC)](/hedera/support-and-community/glossary#know-your-customer-kyc) / [Anti-Money Laundering (AML)](/hedera/support-and-community/glossary#anti-money-laundering-aml) account flags and integrated service provider hooks, Stablecoin Studio gives issuers new ways to manage compliance and security.
***
## Core Components
The core components of Stablecoin Studio include these four components that help simplify stablecoin creation and management:
The SDK implements the features for creating, managing, and operating stablecoins. The SDK interacts with the Smart Contract and exposes an API to be used by client-facing applications.
A visually rich platform that adds a layer of user-friendly interaction for creating, managing, and operating tokens. A dApp developed in React. Uses the SDK-exposed API.
A command line interface (CLI) tool for creating, managing, and operating stablecoins. Uses the SDK-exposed API.
A set of well-audited, open-source, smart contracts ready to be deployed for creating and managing stablecoins on Hedera network.
***
## Robust Administration and Compliance Configurations
Stablecoin Studio includes Hedera-native token administration functionalities, enabling issuers to easily burn, mint (cash-in), freeze, wipe, and pause stablecoins. Account-based permissions, like native KYC account flags, provide compliance configurations when connecting Stablecoin Studio to custody providers and KYC/AML services.
#### Hedera Native Token Administration Functionalities
| Functionality | Description |
|---|
CashIn (Mint) | Issuers can effortlessly create new tokens, increasing the total supply of the stablecoin. Minting is often subject to regulatory compliance and internal governance. |
Burn | The platform allows issuers to reduce the overall token supply by 'burning' or destroying tokens, usually in a controlled and auditable manner. |
Freeze/Unfreeze | For various compliance-related or operational reasons, Stablecoin Studio provides the option to freeze tokens, making them non-transferable until further actions are taken. |
Pause/Unpause | The platform includes a pause functionality, enabling issuers to temporarily halt all token-related activities in emergencies or for scheduled maintenance. |
Wipe | Stablecoin Studio allows issuers to wipe or delete tokens from specific accounts, mainly for regulatory or security reasons. |
#### Account-Based Permissions and Compliance Features
| Compliance Mechanisms | Description |
|---|
Native KYC Account Flags | Incorporate KYC checks directly into the token issuance and management process. These flags serve as compliance markers, indicating whether an account has been verified for KYC requirements. |
Integration with Custody Providers | Stablecoin Studio is designed to connect seamlessly with third-party custody solutions, offering an extra layer of security for asset management. |
KYC/AML Service Connections | Through native account flags and API integrations, Stablecoin Studio can be easily hooked into existing KYC/AML solutions, streamlining the compliance workflow. |
***
## Ecosystem Integrations
The Stablecoin Studio SDK provides integrations into third-party providers who can fully support your stablecoin offering on the public Hedera network. These providers offer solutions for KYC/AML, custody, wallets, infrastructure management, smart contract monitoring, regulatory compliance, and more.
#### Custody Providers
Zodia specializes in institutional-grade digital asset custody, offering cutting-edge tech within a compliant framework. They primarily cater to corporate investors and institutions.
DFNS offers a wallet-as-a-service infrastructure targeting crypto developers, allowing developers to focus on their applications by handling private key management.
Hex Trust offers bank-grade digital asset custody. Led by experienced finance and tech experts, their Hex Safe™ platform provides an array of custody solutions.
#### KYC/AML Service Providers
Elliptic offers a suite of compliance solutions designed to assist financial institutions. Services include: transaction monitoring for KYC/AML purposes, identity verification, and risk assessment.
Merkle Science provides transaction monitoring and intelligence solutions for cryptoasset service providers, financial institutions, and government agencies to detect, investigate, and prevent money laundering.
#### Oracle Provider
***
## Proof-of-Reserve (PoR) for Treasury Management
To ensure the security and transparency of your stablecoin, Stablecoin Studio offers a proof-of-reserve (PoR) feature. This feature serves two key objectives: preventing under-collateralization and providing transparent asset backing for your stablecoin. The PoR system employs automated verification, where [off-chain ](/hedera/support-and-community/glossary#off-chain)assets are continually monitored through [oracles](/hedera/support-and-community/glossary#oracles) or similar mechanisms. These monitoring systems subsequently update a dedicated reserve contract to reflect changes in the asset value accurately.
Before you mint new tokens, a [smart contract](/hedera/support-and-community/glossary#smart-contract) automatically checks this reserve contract. Minting is authorized only when sufficient reserve assets are available to back the new tokens. For instance, let's say you have enabled PoR with a reserve of 1,000 units. You can comfortably mint up to 900 tokens. However, if you attempt to mint an additional 100 tokens, the smart contract will halt the process due to insufficient reserves. You also have the flexibility to update these reserves either manually or programmatically as per your operational requirements.
Lastly, when using Stablecoin Studio, you can link an existing Oracle-fed reserve contract or let the platform automatically deploy a new one. Both options aim to guarantee the stability of your stablecoin and foster user trust.
##
***
## Stablecoin Studio: How It All Works Together
At a functional level, Stablecoin Studio provides a comprehensive architecture that enables developers to create, manage, and operate stablecoins on the Hedera network using pre-built “factory smart contracts” [audited by CertiK.](https://files.hedera.com/stablecoin-studio-audit.pdf) The architecture consists of several components that work together to facilitate the deployment and management of stablecoins:
1. **SDK**: The Software Development Kit (SDK) provides a set of tools and libraries for developers to build and deploy stablecoin applications on the Hedera network. It simplifies the process of interacting with Stablecoin Studio’s “factory contracts” used to create and manage stablecoins.
2. **CLI**: The Command Line Interface (CLI) offers a user-friendly way for developers to interact with the SDK and manage stablecoins. It allows developers to perform various operations, such as creating, managing, and operating stablecoins using simple commands.
3. **Web UI**: The User Interface (UI) component provides a graphical interface for developers and users to interact with stablecoins on the Hedera network. It simplifies the process of managing and operating stablecoins for non-technical users.
When you initiate the creation process using the SDK, CLI, or Web UI, two smart contracts are deployed: The Hedera Token Manager Proxy and the Hedera Token Manager. The former oversees the ownership of the latter, which in turn is responsible for managing the permissions and functionalities of your stablecoin.
As a stablecoin admin/delegate, you’ll manage your stablecoin using the Hedera Token Manager smart contract, offering granular control and flexibility. End-users will not need to navigate the complexities of smart contracts — they can interact directly with your stablecoin using the Hedera Token Service (HTS), ensuring a more convenient, cost-effective, and scalable experience.
# Web UI Application
Source: https://docs.hedera.com/hedera/open-source-solutions/stablecoin-studio/web-ui-application
The Stablecoin Studio Web User Interface (Web UI) is designed to provide a more intuitive and user-friendly experience for managing stablecoins. Developed using React, this interface offers a visual representation of all our Web UI capabilities, from initial setup to advanced administration. Whether you're a newcomer looking for an easier entry point or a seasoned developer seeking a more efficient way to manage stablecoins, this documentation offers the insights and resources to harness the full power of our React-based Web UI.
***
## Table of Contents
1. [Interactive Demo](#interactive-demo)
2. [Prerequisites](#prerequisites)
3. [Installation](#install-stablecoin-studio)
4. [Start Web UI](#start-the-web-ui)
5. [Create Stablecoins](#create-stablecoins)
6. [Operate Stablecoins](#operate-stablecoins)
7. [Manage Roles](#manage-roles)
8. [Stablecoin Details](#stablecoin-details)
9. [Additional Resources](#additional-resources)
***
## Interactive Demo
Get firsthand experience with Stablecoin Studio's capabilities using the open-source, React-based demo application sandbox. The sandbox application is built using Stablecoin Studio's TypeScript SDK.
After setting up a [Hedera testnet account](https://portal.hedera.com/), explore creating and managing stablecoins on Hedera through the interactive demo and follow along. Let's get started and explore the three paths for launching the Stablecoin Studio web application:
For a quick and effortless start, you can use the pre-configured Code Sandbox environment directly from StablecoinStudio.com. This approach requires no setup and provides a fully functional demo application.
Another easy way to get started is by launching a GitPod instance, which automates the initial setup and lets you dive into the application immediately. You can skip the prerequisites and installation steps.
A more technical method to build and install on your local machine. This guide focuses on this method, walking you through the steps needed to set up your local environment. Start from the first step: Prerequisites.
***
## Prerequisites
* [NodeJS >= 18.13](https://nodejs.org/en)
* [Solidity >= 0.8.16](https://docs.soliditylang.org/en/latest/installing-solidity.html)
* [TypeScript >= 4.7](https://www.npmjs.com/package/typescript)
* [Git Command Line](https://git-scm.com/downloads)
* [Hedera Testnet Account](https://portal.hedera.com/)
* [HashPack Wallet](https://www.hashpack.app/download)
***
## Install Stablecoin Studio
Open a new terminal and navigate to your preferred directory location where you want your Stablecoin Studio project to live. Clone the repo, `cd` in to the cloned directory, and install dependencies:
```bash theme={null}
git clone https://github.com/hashgraph/stablecoin-studio.git
cd stablecoin-studio
npm install
```
`cd` in to the `web` directory:
```bash theme={null}
cd web
```
#### Environment variables
Before we can start the web application, we need to configure the environment variables. From the root of the `web` project workspace, rename the `.env.sample` file to `.env` and configure the variables required to run the application. For the purposes of this demo, we will need:
1. The [factory contract ID.](https://github.com/hashgraph/hedera-accelerator-stablecoin/tree/main/cli#factories)
2. The [REST API](/hedera/sdks-and-apis/rest-api) testnet endpoint.
3. The [JSON-RPC relay ](/hedera/core-concepts/smart-contracts/json-rpc-relay)testnet endpoint.
The `.env` file contains the following parameters:
| Environment Variable | Description |
|---|
| REACT\_APP\_LOG\_LEVEL | Log level for the application. The default value is ERROR. Acceptable values are ERROR, WARN, INFO, HTTP, VERBOSE, DEBUG, and SILLY in order of priority (highest to lowest). |
| REACT\_APP\_FACTORIES | JSON array with a factory contract ID in Hedera format 0.0.XXXXX per environment. |
| REACT\_APP\_MIRROR\_NODE | The var must be a unique mirror node service for Hedera network, and this is the service that would be used when the UI starts. If the service doesn't require an API key to authorize requests the API\_KEY and HEADER properties must remain empty. Here is a list of mirror node endpoints. |
| REACT\_APP\_RPC\_NODE | The var must be a unique RPC node service for Hedera network, and this is the service that would be used when the UI starts. If the service doesn't require an API key to authorize requests the API\_KEY and HEADER properties must remain empty. Here is a list of RPC providers. |
| GENERATE\_SOURCEMAP | This is a proprietary Create React App configuration. You can read more information in its Create React App documentation. |
```bash .env wrap theme={null}
REACT_APP_LOG_LEVEL=ERROR
REACT_APP_FACTORIES='[{"Environment":"testnet","STABLE_COIN_FACTORY_ADDRESS":"0.0.467235"}]'
REACT_APP_MIRROR_NODE='[{"Environment":"testnet","BASE_URL":"https://testnet.mirrornode.hedera.com/api/v1/", "API_KEY": "", "HEADER": ""}]'
REACT_APP_RPC_NODE='[{"Environment":"testnet","BASE_URL":"https://testnet.hashio.io/api", "API_KEY": "", "HEADER": ""}]'
GENERATE_SOURCEMAP=false
```
***
## Start the Web UI
Once you have configured your environment variables, start the web UI from the `web` directory:
```bash theme={null}
npm run start
```
If the application is successfully run, the web application interface will open in a new browser:
Click "Connect your wallet" and select the wallet ([HashPack](https://www.hashpack.app/) or [MetaMask](https://metamask.io/)) and network you want to interact with. For the purposes of this demo, we will use HashPack and select Testnet.
Now that your project is set up and the web application is running let's create our first stablecoin!
***
## Create Stablecoins
#### Basic details (Required)
To initiate the creation of your stablecoin, head to the top of the interface and click on the + symbol. From the options that appear, select "Create coin." The required fields for basic details will be displayed:
* **HederaTokenManager impl.**: By default, this is set to a factory contract ID provided by Hedera, in the format `0.0.XXXXXX`. Advanced users have the option to deploy their own factory contract implementation.
* **Name**: This is where you name your new stablecoin, for example, "NewStableCoin."
* **Symbol**: Enter a symbol to represent your stablecoin, like "\$NSC."
#### Optional details
While the basic details are mandatory, you also have an option to further specify:
* **Initial Supply**: You can expand on the initial number of tokens that will be minted.
* **Max Supply**: If you chose 'Finite' in the 'Supply Type,' you might want to set an upper limit.
* **Decimals**: You can set additional decimal places if you need more precision.
#### Manage permissions
When creating a stablecoin, you have multiple key configuration options. One of those is the “Underlying Token’s Keys Definition.” This determines which accounts control various operations of the stablecoin, such as who can approve [KYC](/hedera/support-and-community/glossary#know-your-customer-kyc) checks or which account can change the coin supply. You have the flexibility to set these keys to be controlled by the stablecoin’s initial smart contract, assign them to a different key, or even leave them undefined.
If the KYC key is tied to the smart contract and the supply key isn't tied to the account that creates the stablecoin, you can opt to automatically grant KYC verification to the account creating the stablecoin at the time of its creation.
As for ownership settings, by default, the account that initiates the stablecoin creation also becomes the stablecoin proxy admin owner. However, you’re not locked into this default setup. You can alter this by specifying a different account ID during creation. This could be any account, including specialized accounts like a timelock controller for scheduled operations or a cold wallet for enhanced security.
#### Proof-of-reserve (PoR)
Choose if the stablecoin will be linked to a Proof of Reserve (PoR) contract. You can either use an existing PoR contract address or create a new one using the demo implementation included in the project and setting an initial reserve amount.
**Warning:** You can change the PoR contract address at any time, but exercise caution. Altering the address can affect your stablecoin's cash-in functionality, as it refers to a new reserve verification contract. In cases where the new contract has a lower reserve than the previous one, minting new tokens may become restricted.
For those using the project's demo PoR contract, you also have the option to modify its reserve amount. This can be done via the PoR admin account used during the stablecoin's deployment. Because the reserve can be changed arbitrarily in the demo, it's intended for demonstration purposes only.
#### Review
Final validation before creating the stablecoin. Review the stablecoin details and click the "Create stablecoin" button. Validate "Execute Smart Contract" and "Associate Token" transactions in your wallet. Once the stablecoin is created, it will be added to the drop-down list of coins you can access (with the account you used to create the stablecoin).
***
## Operate Stablecoins
To operate your stablecoin, connect your wallet to the platform. After successful authentication, select the stablecoin you wish to interact with from the drop-down list of available coins. Once the stablecoin information is loaded, navigate to the "Operations" tab.
You'll see a variety of actions and your accessible operations will be tied to the roles assigned to your account for the chosen stablecoin. Here's a quick rundown of what each operation allows:
* **Cash In**: Deposit assets into your stablecoin account.
* **Burn**: Permanently remove specific tokens from circulation.
* **Get Balance**: View the current balance of your stablecoin account.
* **Rescue**: Recover tokens in unique scenarios.
* **Rescue HBAR**: Specialized recovery for HBAR.
* **Wipe**: Clear particular stablecoin balances.
* **Freeze Account**: Temporarily disable transaction capabilities for an account.
* **Unfreeze**: Lift the freeze status from an account.
* **Check Account Frozen Status**: Verify whether an account is frozen.
* **Grant KYC**: Approve an account for KYC verification.
* **Revoke KYC**: Remove previously granted KYC approval.
* **Check KYC**: Confirm the KYC status of an account.
* **Danger Zone**: Access to operations that carry higher risk, generally because they affect every token owner (PAUSE) or can not be rolled back (DELETE).
To carry out an operation, simply click on the corresponding button and follow the on-screen prompts. The platform will automatically perform the operation based on the capabilities your account has been assigned.
The "Operations" tab in Stablecoin Studio is your hub for managing every aspect of your stablecoin, so make sure you're familiar with the roles and capabilities assigned to your account to leverage the suite of operations available to you fully.
***
## Manage Roles
In Stablecoin Studio, role management is a pivotal feature that gives you control over various functions related to your stablecoin. If your account has been designated with the "Admin Role," you unlock the capability to manage other roles for your stablecoin, making governance easier and more secure.
Roles you can manage include:
* **Cash In**: Permits an account to deposit or 'cash in' assets.
* **Burn**: Authorizes an account to remove tokens from circulation permanently.
* **Wipe**: Allows an account to clear specific balances.
* **Rescue**: Grants the ability to recover tokens in special circumstances.
* **Pause**: Enables stopping all transactions temporarily, which is useful in emergency situations.
* **Freeze**: Authorizes freezing specific accounts, disabling their ability to transact.
* **Delete**: Allows the removal of accounts or certain data, irreversible.
* **Admin Role**: Provides overarching administrative privileges, often reserved for key governance participants.
Connect your wallet and select the stablecoin from the drop-down list you want to interact with. Once the stablecoin information loads, head to the "Role management" tab.
***
## Stablecoin Details
This menu option displays stablecoin details and allows the user to update some token properties, like the name, symbol, and keys. Clicking on the pencil icon located at the top right side of the screen turns the information page into a form where these properties can be modified by the user.
🎉 Congrats on creating your first stablecoin with Stablecoin Studio! View the transaction details on [HashScan](https://hashscan.io/testnet/dashboard) by looking up your new token ID or clicking the [HashScan Explorer link ](https://hashscan.io/testnet/token/0.0.1573710)from the "Token ID" field.
***
## Additional Resources
# SDKs & APIs
Source: https://docs.hedera.com/hedera/sdks-and-apis
# Basic Types
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types
# AccountAmount
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/accountamount
An account, and the amount that it sends or receives during a cryptocurrency or token transfer.
| Field | Type | Description |
| ------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The Account ID that sends/receives cryptocurrency or tokens |
| `amount` | sint64 | The amount of tinybars (for Crypto transfers) or in the lowest denomination (for Token transfers) that the account sends(negative) or receives(positive) |
| `is_approval` | bool | If true then the transfer is expected to be an approved allowance and the accountID is expected to be the owner. The default is false (omitted). |
####
# AccountID
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/accountid
The ID for a cryptocurrency account.
| Field | Type | Description |
| ------------ | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `shardNum` | int64 | The shard number (nonnegative) |
| `realmNum` | int64 | The realm number (nonnegative) |
| `accountNum` | int64 | A nonnegative account number unique within its realm |
| `alias` | bytes | The public key bytes to be used as the account's alias. The public key bytes are the result of serializing a protobuf Key message for any primitive key type. Currently only primitive key bytes are supported as an alias (ThresholdKey, KeyList, ContractID, and delegatable\_contract\_id are not supported). At most one account can ever have a given alias and it is used for account creation if it was automatically created using a crypto transfer. It will be null if an account is created normally. It is immutable once it is set for an account. If a transaction auto-creates the account, any further transfers to that alias will simply be deposited in that account, without creating anything, and with no creation fee being charged. |
# ContractID
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/contractid
The ID for a smart contract instance
| Field | Description |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `shardNum` | The shard number (nonnegative) |
| `realmNum` | The realm number (nonnegative) |
| `contractNum` | A nonnegative number unique within its realm |
| `evm_address` | The 20-byte EVM address of the contract to call. Every contract has an EVM address determined by its shard.realm.num id. This address is as follows:
The first 4 bytes are the big-endian representation of the shard.
The next 8 bytes are the big-endian representation of the realm.
The final 8 bytes are the big-endian representation of the number.
Contracts created via CREATE2 have an additional, primary address that is derived from the EIP-1014 specification, and does not have a simple relation to a shard.realm.num id. (Please do note that CREATE2 contracts can also be referenced by the three-part EVM address described above.)
|
####
# CryptoAllowance
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/cryptoallowance
An approved allowance of hbar transfers for a spender.
| Field | Type | Description |
| --------- | --------- | ------------------------------------------------------------------- |
| `owner` | AccountID | The account ID of the hbar owner (ie. the grantor of the allowance) |
| `spender` | AccountID | The account ID of the spender of the hbar allowance |
| `amount` | int64 | The amount of the spender's allowance in tinybars |
####
# CurrentAndNextFeeSchedule
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/currentandnextfeeschedule
This contains two Fee Schedules with expiry timestamp.
| Field | Type | Description |
| -------------------- | ----------------------------------------------------------------------- | ----------------------------- |
| `currentFeeSchedule` | [FeeSchedule](/hedera/sdks-and-apis/hedera-api/basic-types/feeschedule) | Contains current Fee Schedule |
| `nextFeeSchedule` | [FeeSchedule](/hedera/sdks-and-apis/hedera-api/basic-types/feeschedule) | Contains next Fee Schedule |
####
# FeeComponents
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/feecomponents
The different components used for fee calculation
| Field | Description |
| ---------- | --------------------------------------------------------------------------------------------- |
| `min` | The minimum fees that needs to be paid |
| `max` | The maximum fees that can be submitted |
| `constant` | A constant determined by the business to calculate the fees |
| `bpt` | Bytes per transaction |
| `vpt` | Verifications per transaction |
| `rbh` | Ram byte seconds |
| `sbh` | Storage byte seconds |
| `gas` | Gas for the contract execution |
| `tv` | Transaction value (crypto transfers amount, tv is in tiny bars divided by 1000, rounded down) |
| `bpr` | Bytes per response |
| `sbpr` | Storage bytes per response |
####
# FeeData
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/feedata
The total fees charged for a transaction. It contains three parts namely node data, network data and service data
| Field | Type | Description |
| ------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `nodedata` | [FeeComponents](/hedera/sdks-and-apis/hedera-api/basic-types/feecomponents) | Fee charged by Node for this functionality |
| `networkdata` | [FeeComponents](/hedera/sdks-and-apis/hedera-api/basic-types/feecomponents) | Fee charged for network operations by Hedera |
| `servicedata` | [FeeComponents](/hedera/sdks-and-apis/hedera-api/basic-types/feecomponents) | Fee charged for providing service by Hedera |
| `subType` | [SubType](/hedera/sdks-and-apis/hedera-api/basic-types/subtype) | SubType distinguishing between different types of FeeData, correlating to the same HederaFunctionality |
####
# FeeSchedule
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/feeschedule
The fee schedule for a specific hedera functionality and the time period this fee schedule will expire
| Field | Type | Description |
| ------------------------ | --------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| `transactionFeeSchedule` | [TransactionFeeSchedule](/hedera/sdks-and-apis/hedera-api/basic-types/transactionfeeschedule) | Contains multiple functionality specific fee schedule. |
| `expiryTime` | [TimestampSeconds](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp#timestampseconds) | FeeSchedule expiry time |
####
# FileID
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/fileid
The ID for a file
| Field | Description |
| ---------- | ------------------------------------------------- |
| `shardNum` | The shard number (nonnegative) |
| `realmNum` | The realm number (nonnegative) |
| `fileNum` | A nonnegative File number unique within its realm |
####
# Fraction
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/fraction
A rational number, used to set the amount of a value transfer to collect as a custom fee.
| Field | Type | Description |
| ------------- | ----- | ----------------------------------------------------------------------------------- |
| `numerator` | int64 | The rational's numerator |
| `denominator` | int64 | The rational's denominator; a zero value will result in FRACTION\_DIVIDES\_BY\_ZERO |
# HederaFunctionality
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/hederafunctionality
The functionality provided by Hedera.
| Enum Name | Description |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `NONE` | UNSPECIFIED - Need to keep first value as unspecified because first element is ignored and not parsed (0 is ignored by parser) |
| `CryptoTransfer` | Crypto transfer |
| `CryptoUpdate` | Crypto update account |
| `CryptoDelete` | Crypto delete account |
| `CryptoAddLiveHash` | Add a livehash to a crypto account (0.5.0) |
| `CryptoDeleteLiveHash` | Delete a livehash from a crypto account (0.5.0) |
| `CryptoAddClaim` | Crypto add claim to the account |
| `CryptoDeleteClaim` | Crypto delete claim to the account |
| `ContractCall` | Smart Contract Call |
| `ContractCreate` | Smart Contract Create Contract |
| `ContractUpdate` | Smart Contract update contract |
| `FileCreate` | File Operation create file |
| `FileAppend` | File Operation append file |
| `FileUpdate` | File Operation update file |
| `FileDelete` | File Operation delete file |
| `CryptoGetAccountBalance` | Crypto get account balance |
| `CryptoGetAccountRecords` | Crypto get account record |
| `CryptoGetInfo` | Crypto get info |
| `ContractCallLocal` | Smart Contract Call |
| `ContractGetInfo` | Smart Contract get info |
| `ContractGetBytecode` | Smart Contract, get the byte code |
| `GetBySolidityID` | Smart Contract, get by solidity ID |
| `GetByKey` | Smart Contract, get by key |
| `CryptoGetClaim` | Crypto get the claim |
| `CryptoGetLiveHash` | Get a live hash from a crypto account |
| `CryptoGetStakers` | Crypto, get the stakers for the node |
| `FileGetContents` | File Operations get file contents |
| `FileGetInfo` | File Operations get the info of the file |
| `TransactionGetRecord` | Crypto get the transaction records |
| `ContractGetRecords` | Contract get the transaction records |
| `CryptoCreate` | crypto create account |
| `SystemDelete` | System delete file |
| `SystemUndelete` | System undelete file |
| `ContractDelete` | Delete contract |
| `Freeze` | Freeze |
| `CreateTransactionRecord` | Create Tx Record |
| `CryptoAccountAutoRenew` | Crypto Auto Renew |
| `ContractAutoRenew` | Contract Auto Renew |
| `getVersion` | Get Version |
| `TransactionGetReceipt` | Transaction Get Receipt |
| `ConsensusCreateTopic` | Create a topic |
| `ConsensusUpdateTopic` | Update a topic |
| `ConsensusDeleteTopic` | Delete a topic |
| `ConsensusGetTopicInfo` | Get topic info |
| `ConsensusSubmitMessage` | Submit a message to a topic |
| `TokenCreate` | Create Token |
| `TokenTransact` | Transfer Tokens |
| `TokenGetInfo` | Transfer Tokens |
| `TokenFreezeAccount` | Freeze Account |
| `TokenUnfreezeAccount` | Unfreeze Account |
| `TokenGrantKycToAccount` | Grant KYC to Account |
| `TokenRevokeKycFromAccount` | Revoke KYC from Account |
| `TokenDelete` | Delete Token |
| `TokenUpdate` | Update Token |
| `TokenMint` | Mint tokens to treasury |
| `TokenBurn` | Burn tokens from treasury |
| `TokenAccountWipe` | Wipe token amount from Account holder |
| `TokenAssociateToAccount` | Wipe token amount from Account holder |
| `TokenDissociateFromAccount` | Dissociate tokens from an account |
| `ScheduleCreate` | Create Scheduled Transaction |
| `ScheduleDelete` | Delete Scheduled Transaction |
| `ScheduleSign` | Sign Scheduled Transaction |
| `ScheduleGetInfo` | Get Scheduled Transaction Information |
| `TokenGetAccountNftInfo` | Get Token Account Nft Information |
| `TokenGetNftInfo` | Get Token Nft Information |
| `TokenGetNftInfos` | Get Token Nft List Information |
| `NetworkGetExecutionTime` | Get execution time(s) by TransactionID, if available |
| `TokenPause` | Pause the Token |
| `TokenUnpause` | Unpause the Token |
| `CryptoApproveAllowance` | Approve allowance for a spender relative to the payer account |
| `CryptoDeleteAllowance` | Deletes granted NFT allowances on an owner account |
# Key
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/key
A Key can be a public key from either the Ed25519 or ECDSA(secp256k1) signature schemes, where in the ECDSA(secp256k1) case we require the 33-byte compressed form of the public key. We call these public keys **primitive keys**.
If an account has primitive key associated to it, then the corresponding private key must sign any transaction to transfer cryptocurrency out of it. A Key can also be the ID of a smart contract instance, which is then authorized to perform any precompiled contract action that requires this key to sign.
Note that when a Key is a smart contract ID, it *doesn't* mean the contract with that ID will actually create a cryptographic signature. It only means that when the contract calls a precompiled contract, the resulting "child transaction" will be authorized to perform any action controlled by the Key.
A Key can be a "threshold key", which means a list of M keys, any N of which must sign in order for the threshold signature to be considered valid. The keys within a threshold signature may themselves be threshold signatures, to allow complex signature requirements.
A Key can be a "key list" where all keys in the list must sign unless specified otherwise in the documentation for a specific transaction type (e.g. FileDeleteTransactionBody). Their use is dependent on context. For example, a Hedera file is created with a list of keys, where all of them must sign a transaction to create or modify the file, but only one of them is needed to sign a transaction to delete the file. So it's a single list that sometimes acts as a 1-of-M threshold key, and sometimes acts as an M-of-M threshold key. A key list is always an M-of-M, unless specified otherwise in documentation. A key list can have nested key lists or threshold keys.Nested key lists are always M-of-M. A key list can have repeated primitive public keys, but all repeated keys are only required to sign once.
A Key can contain a ThresholdKey or KeyList, which in turn contain a Key, so this mutual recursion would allow nesting arbitrarily deep. A ThresholdKey which contains a list of primitive keys has 3 levels: ThresholdKey -> KeyList -> Key. A KeyList which contains several primitivekeys has 2 levels: KeyList -> Key. A Key with 2 levels of nested ThresholdKeys has 7 levels: Key -> ThresholdKey -> KeyList -> Key -> ThresholdKey -> KeyList -> Key.
Each Key should not have more than 46 levels, which implies 15 levels of nested ThresholdKeys.
| Field | Type | Description | |
| ----- | ------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| key | oneof | | |
| | `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | smart contract instance that is authorized as if it had signed with a key |
| | `ed25519` | | ed25519 public key bytes |
| | `RSA_3072` | | RSA-3072 public key bytes (NOT SUPPORTED) |
| | `ECDSA_384` | | ECDSA with the p-384 curve public key bytes (NOT SUPPORTED) |
| | `thresholdKey` | [ThresholdKey](/hedera/sdks-and-apis/hedera-api/basic-types/thresholdkey) | a threshold N followed by a list of M keys, any N of which are required to form a valid signature |
| | `keyList` | [KeyList](/hedera/sdks-and-apis/hedera-api/basic-types/keylist) | A list of Keys of the Key type. |
| | `ECDSA_secp256k1` | | Compressed ECDSA(secp256k1) public key bytes |
| | `delegatable_contract-id` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | A smart contract that, if the recipient of the active message frame, should be treated as having signed. (Note this does not mean the *code being executed in the frame* will belong to the given contract, since it could be running another contract's code via delegatecall. So setting this key is a more permissive version of setting the contractID key, which also requires the code in the active message frame belong to the contract with the given id.) |
\\
# KeyList
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/keylist
A list of keys that requires all keys (M-of-M) to sign unless otherwise specified in the documentation. A KeyList may contain repeated keys, but all repeated keys are only required to sign once.
| Field | Type | Description |
| ------ | --------------------------------------------------------- | ------------ |
| `keys` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | list of keys |
####
# NftAllowance
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/nftallowance
An approved allowance of NFT transfers for a spender.
| Field | Type | Description |
| -------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `TokenId` | TokenID | The token that the allowance pertains to |
| `owner` | AccountID | The account ID of the hbar owner (ie. the grantor of the allowance) |
| `spender` | AccountID | The account ID of the spender of the hbar allowance |
| `serialNumbers` | repeated int64 | The list of serial numbers that the spender is permitted to transfer |
| `approvedForAll` | google.protobuf.BoolValuegoogle.protobuf.BoolValue | If true, the spender has access to all of the account owner's NFT instances (currently \*\*\*\* owned and any in the future). If this field is set to true the serialNumbers field should be empty. |
| `delegating_spender` | AccountID | The account ID of the spender who is granted approvedForAll allowance and granting approval on an NFT serial to another spender. |
####
# NftTransfer
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/nfttransfer
A sender account, a receiver account, and the serial number of an NFT of a Token with `NON_FUNGIBLE_UNIQUE` type.
| Field | Type | Description |
| ------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `senderAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The accountID of the sender |
| `receiverAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The accountID of the receiver |
| `serialNumber` | int64 | The serial number of the NFT |
| `is_approval` | bool | If true then the transfer is expected to be an approved allowance and the senderAccountID is expected to be the owner. The default is false (omitted). |
# NodeAddress
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/nodeaddress
The metadata for a Node – including IP Address, and the crypto account associated with the Node.
| Field | Type | Description |
| ----------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `ipAddress` | bytes | The ip address of the Node with separator & octets \[deprecated v0.13.0] |
| `portno` | int32 | The port number of the grpc server for the node \[deprecated v0.13.0] |
| `memo` | bytes | The memo field of the node \[deprecated v0.13.0] |
| `RSA_PubKey` | string | The RSA public key of the node. |
| `nodeId` | int64 | A non-sequential identifier for the node |
| `nodeAccountId` | [AccountId](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account to be paid for queries and transactions sent to this node |
| `nodeCertHash` | bytes | A hash of the X509 cert used for gRPC traffic to this node |
| `serviceEndpoint` | repeated [ServiceEndpoint](/hedera/sdks-and-apis/hedera-api/basic-types/serviceendpoint) | A node's service IP addresses and ports \[Added v0.13.0] |
| `description` | string | A description of the node, with UTF-8 encoding up to 100 bytes \[Added v0.13.0] |
| `stake` | int64 | The amount of tinybars staked to the node \[Added v0.13.0] |
# NodeAddressBook
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/nodeaddressbook
A list of nodes and their metadata.
| Field | Type | Description |
| ------------- | ----------------------------------------------------------------------- | ---------------------------------------------- |
| `nodeAddress` | [NodeAddress](/hedera/sdks-and-apis/hedera-api/basic-types/nodeaddress) | Contains multiple Node Address for the network |
# RealmID
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/realmid
The ID for a realm. Within a given shard, every realm has a unique ID. Each account, file, and contract instance belongs to exactly one realm.
| Field | Description |
| ---------- | ------------------------------ |
| `shardNum` | The shard number (nonnegative) |
| `realmNum` | The realm number (nonnegative) |
# ScheduleID
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/scheduleid
A unique identifier for a Schedule.
| Field | Type | yDescription |
| ------------- | ----- | ------------------------------ |
| `shardNum` | int64 | The shard number (nonnegative) |
| `realmNum` | int64 | The realm number (nonnegative) |
| `scheduleNum` | int64 | A nonnegative schedule number |
# SemanticVersion
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/semanticversion
Hedera follows semantic versioning ([https://semver.org/](https://semver.org/)) for both the HAPI protobufs and the Services software. This type allows the getVersionInfo query in the NetworkService to return the deployed versions of both protobufs and software on the node answering the query.
| Field | Type | Description |
| ------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `major` | int32 | Increases with incompatible API changes |
| `minor` | int32 | Increases with backwards-compatible new functionality |
| `patch` | int32 | Increases with backwards-compatible bug fixes |
| `pre` | string | A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers ([https://semver.org/#spec-item-9](https://semver.org/#spec-item-9)); so given a semver 0.14.0-alpha.1+21AF26D3, this field would contain 'alpha.1' |
| `build` | build | Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version ([https://semver.org/#spec-item-10](https://semver.org/#spec-item-10)); so given a semver 0.14.0-alpha.1+21AF26D3, this field would contain '21AF26D3' |
####
# ServiceEndpoint
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/serviceendpoint
Contains the IP address and the port representing a service endpoint of a Node in a network. Used to reach the Hedera API and submit transactions to the network.
| Field | Type | Description | Consensus Node Version |
| ------------- | ----- | ------------------------------------------------------------------------------------------------------------- | ---------------------- |
| `ipAddressV4` | bytes | The 32-bit IPv4 address of the node encoded in left to right order (e.g. 127.0.0.1 has 127 as its first byte) | 0.13.0 |
| `port` | int32 | The port of the node | 0.13.0 |
# ServicesConfigurationList
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/servicesconfigurationlist
| Field | Type | Description |
| ----------- | --------------------------------------------------------------- | ------------------------------------------------------ |
| `nameValue` | [Setting](/hedera/sdks-and-apis/hedera-api/basic-types/setting) | list of name value pairs of the application properties |
# Setting
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/setting
| Field | Description |
| ------- | --------------------------------- |
| `name` | name of the property |
| `value` | value of the property |
| `data` | any data associated with property |
# ShardID
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/shardid
Each shard has a nonnegative shard number. Each realm within a given shard has a nonnegative realm number (that number might be reused in other shards). And each account, file, and smart contract instance within a given realm has a nonnegative number (which might be reused in other realms). Every account, file, and smart contract instance is within exactly one realm. So a FileID is a triplet of numbers, like 0.1.2 for entity number 2 within realm 1 within shard 0. Each realm maintains a single counter for assigning numbers, so if there is a file with ID 0.1.2, then there won't be an account or smart contract instance with ID 0.1.2.
| Field | Description |
| ---------- | ------------------------------ |
| `shardNum` | the shard number (nonnegative) |
# Signature
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/signature
This message is deprecated and succeeded by [SignaturePair](/hedera/sdks-and-apis/hedera-api/basic-types/signature-pair) and [SignatureMap ](/hedera/sdks-and-apis/hedera-api/basic-types/signaturemap)messages.
A Signature corresponding to a Key. It is a sequence of bytes holding a public key signature from one of the three supported systems (ed25519, RSA-3072, ECDSA with p384). Or, it can be a list of signatures corresponding to a single threshold key. Or, it can be the ID of a smart contract instance, which is authorized to act as if it had a key. If an account has an ed25519 key associated with it, then the corresponding private key must sign any transaction to transfer cryptocurrency out of it. If it has a smart contract ID associated with it, then that smart contract is allowed to transfer cryptocurrency out of it. The smart contract doesn't actually have a key, and doesn't actually sign a transaction. But it's as if a virtual transaction were created, and the smart contract signed it with a private key. A key can also be a "threshold key", which means a list of M keys, any N of which must sign in order for the threshold signature to be considered valid. The keys within a threshold signature may themselves be threshold signatures, to allow complex signature requirements (this nesting is not supported in the currently, but will be supported in a future version of API). If a Signature message is missing the "signature" field, then this is considered to be a null signature. That is useful in cases such as threshold signatures, where some of the signatures can be null.
| Field | Type | Description | |
| ---------- | ------------------ | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| deprecated | | | |
| signature | oneof | | |
| | contract | | Smart contract virtual signature (always length zero) |
| | ed25519 | | Ed25519 signature bytes |
| | RSA\_3072 | | RSA-3072 signature bytes |
| | ECDSA\_384 | | ECDSA p-384 signature bytes |
| | thresholdSignature | [ThresholdSignature](/hedera/sdks-and-apis/hedera-api/basic-types/thresholdsignature) | A list of signatures for a single N-of-M threshold Key. This must be a list of exactly M signatures, at least N of which are non-null. |
| | signatureList | [SignatureList](/hedera/sdks-and-apis/hedera-api/basic-types/signature-list) | A list of M signatures, each corresponding to a Key in a KeyList of the same length. |
####
# SignatureList
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/signature-list
This message is deprecated and succeeded by [SignaturePair](/hedera/sdks-and-apis/hedera-api/basic-types/signature-pair) and [SignatureMap ](/hedera/sdks-and-apis/hedera-api/basic-types/signaturemap)messages.
The signatures corresponding to a KeyList of the same length.
| Field | Type | Description |
| ------ | --------------------------------------------------------------------- | -------------------------------------------------- |
| option | deprecated=true | |
| sigs | [Signature](/hedera/sdks-and-apis/hedera-api/basic-types/signature) | each signature corresponds to a Key in the KeyList |
####
# SignaturePair
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/signature-pair
The client may use any number of bytes from zero to the whole length of the public key for pubKeyPrefix. If zero bytes are used, then it must be that only one primitive key is required to sign the linked transaction; it will surely resolve to INVALID\_SIGNATURE otherwise.
**IMPORTANT:** In the special case that a signature is being provided for a key used to authorize a precompiled contract, the pubKeyPrefix must contain the **entire public key**! That is, if the key is a Ed25519 key, the pubKeyPrefix should be 32 bytes long. If the key is a ECDSA(secp256k1) key, the pubKeyPrefix should be 33 bytes long, since we require the compressed form of the public key.
Only Ed25519 and ECDSA(secp256k1) keys and hence signatures are currently supported.
| Field | Type | Description | |
| -------------- | ---------------- | --------------------------------- | ----------------------------------------------------- |
| `pubKeyPrefix` | | First few bytes of the public key | |
| `signature` | oneof | | |
| | contract | | smart contract virtual signature (always length zero) |
| | ed25519 | | ed25519 signature |
| | RSA\_3072 | | RSA-3072 signature |
| | ECDSA\_384 | | ECDSA p-384 signature |
| | ECDSA\_secp256k1 | | ECDSA(secp256k1) signature |
\\
# SignatureMap
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/signaturemap
A set of signatures corresponding to every unique public key used to sign a given transaction.
| Field | Type | Description |
| --------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
| `sigPair` | [SignaturePair](/hedera/sdks-and-apis/hedera-api/basic-types/signature-pair) | Each signature pair corresponds to a unique Key required to sign the transaction. |
# SubType
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/subtype
Possible FeeData Object SubTypes. Supplementary to the main HederaFunctionality Type. When not explicitly specified, DEFAULT is used.
| Enum Name | Description |
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `DEFAULT` | The resource prices have no special scope |
| `TOKEN_FUNGIBLE_COMMON` | The resource prices are scoped to an operation on a fungible common token |
| `TOKEN_NON_FUNGIBLE_UNIQUE` | The resource prices are scoped to an operation on a non-fungible unique token |
| `TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES` | The resource prices are scoped to an operation on a fungible common token with a custom fee schedule |
| `TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES` | The resource prices are scoped to an operation on a non-fungible unique token with a custom fee schedule |
# ThresholdKey
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/thresholdkey
A set of public keys that are used together to form a threshold signature. If the threshold is N and there are M keys, then this is an N of M threshold signature. If an account is associated with ThresholdKeys, then a transaction to move cryptocurrency out of it must be signed by a list of M signatures, where at most M-N of them are blank, and the other at least N of them are valid signatures corresponding to at least N of the public keys listed here.
| Field | Type | Description |
| ----------- | ----------------------------------------------------------------- | ------------------------------------------------------------- |
| `threshold` | | A valid signature set must have at least this many signatures |
| `keys` | [KeyList](/hedera/sdks-and-apis/hedera-api/basic-types/keylist) | List of all the keys that can sign |
####
# ThresholdSignature
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/thresholdsignature
This message is deprecated and succeeded by [SignaturePair](/hedera/sdks-and-apis/hedera-api/basic-types/signature-pair) and [SignatureMap ](/hedera/sdks-and-apis/hedera-api/basic-types/signaturemap)messages.
A signature corresponding to a ThresholdKey. For an N-of-M threshold key, this is a list of M signatures, at least N of which must be non-null.
| Field | Type | Description |
| -------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
| `option` | deprecated=true | |
| `sigs` | [SignatureList](/hedera/sdks-and-apis/hedera-api/basic-types/signature-list) | for an N-of-M threshold key, this is a list of M signatures, at least N of which must be non-null |
# TokenAllowance
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokenallowance
An approved allowance of token transfers for a spender.
| Field | Type | Description |
| --------- | --------- | ------------------------------------------------------------------- |
| `TokenId` | TokenID | The token that the allowance pertains to |
| `owner` | AccountID | The account ID of the hbar owner (ie. the grantor of the allowance) |
| `spender` | AccountID | The account ID of the spender of the hbar allowance |
| `amount` | int64 | The amount of the spender's token allowance |
####
# TokenBalance
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokenbalance
A number of transferable units of a certain token. The transferable unit of a token is its smallest denomination, as given by the token's decimals property---each minted token contains 10decimals transferable units. For example, we could think of the cent as the transferable unit of the US dollar (decimals=2); and the tinybar as the transferable unit of hbar (decimals=8). Transferable units are not directly comparable across different tokens.
| Field | Type | Description |
| ---------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tokenId` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | A unique token id |
| `balance` | uint64 | A number of transferable units of the identified token. For token of type `FUNGIBLE_COMMON` - balance in the smallest denomination. For token of type `NON_FUNGIBLE_UNIQUE` - the number of NFTs held by the account |
| `decimals` | uint32 | Tokens divide into 10 decimals pieces |
# TokenBalances
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokenbalances
A sequence of token balances.
| Field | Type | Description |
| --------------- | ------------------------------------------------------------------------------------ | ---------------------------- |
| `tokenBalances` | repeated [TokenBalances](/hedera/sdks-and-apis/hedera-api/basic-types/tokenbalances) | A sequence of token balances |
# TokenFreezeStatus
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokenfreezestatus
Possible Freeze statuses returned on TokenGetInfoQuery or CryptoGetInfoResponse in TokenRelationship
| Enum Name | Description |
| --------------------- | ------------------------------------------ |
| `FreezeNotApplicable` | Freeze n/a |
| `Frozen` | Token cannot be transferred to the account |
| `Unfrozen` | Token can be transferred to the account |
# TokenID
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokenid
A unique identifier for a token.
| Field | Description |
| ---------- | -------------------------- |
| `shardNum` | A nonnegative shard number |
| `realmNum` | A nonnegative realm number |
| `tokenNum` | A nonnegative token number |
####
# TokenKycStatus
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokenkycstatus
Possible KYC statuses returned on TokenGetInfoQuery or CryptoGetInfoResponse in TokenRelationship.
| Enum Name | Description |
| ------------------ | --------------- |
| `KycNotApplicable` | KYC n/a |
| `Granted` | KYC was granted |
| `Revoked` | KYC was revoked |
####
# TokenPauseStatus
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokenpausestatus
Possible Pause statuses returned on TokenGetInfoQuery.
| Enum Name | Description |
| -------------------- | -------------------------------------- |
| `PauseNotApplicable` | Indicates that a Token has no pauseKey |
| `Paused` | Indicates that a Token is Paused |
| `Unpaused` | Indicates that a Token is Unpaused |
# TokenRelationship
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokenrelationship
Token's information related to the given Account.
| Field | Type | Description |
| ----------------------- | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tokenId` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | A unique token id |
| `symbol` | string | The Symbol of the token |
| `balance` | uint64 | For token of type `FUNGIBLE_COMMON` - the balance that the Account holds in the smallest denomination. For token of type `NON_FUNGIBLE_UNIQUE` - the number of NFTs held by the account |
| `kycStatus` | [TokenKycStatus](/hedera/sdks-and-apis/hedera-api/basic-types/tokenkycstatus) | The KYC status of the account (KycNotApplicable, Granted or Revoked). If the token does not have KYC key, KycNotApplicable is returned |
| `freezeStatus` | [TokenFreezeStatus](/hedera/sdks-and-apis/hedera-api/basic-types/tokenfreezestatus) | The Freeze status of the account (FreezeNotApplicable, Frozen or Unfrozen). If the token does not have Freeze key, FreezeNotApplicable is returned |
| `decimals` | uint32 | Tokens divide into 10 decimal pieces |
| `automatic_association` | bool | Specifies if the relationship is created implicitly.
False : explicitly associated,
True : implicitly associated.
|
# TokenSupplyType
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokensupplytype
Possible Token Supply Types (IWA Compatibility). Indicates how many tokens can have during its lifetime.
| Enum Name | Description |
| ---------- | ------------------------------------------------------------------------------------------------ |
| `INFINITE` | Indicates that tokens of that type have an upper bound of Long.MAX\_VALUE. |
| `FINITE` | Indicates that tokens of that type have an upper bound of maxSupply, provided on token creation. |
# TokenTransferList
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokentransferlist
A list of token IDs and amounts representing the transferred out (negative) or into (positive) amounts, represented in the lowest denomination of the token.
| Field | Type | Description |
| ------------------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The ID of the token |
| `transfers` | repeated [AccountAmount](/hedera/sdks-and-apis/hedera-api/basic-types/accountamount) | Multiple list of AccountAmounts, each of which has an account and amount |
| `nftTransfers` | repeated [NftTransfers](/hedera/sdks-and-apis/hedera-api/basic-types/nfttransfer) | Applicable to tokens of type NON\_FUNGIBLE\_UNIQUE. Multiple list of NftTransfers, each of which has a sender and receiver account, including the serial number of the NFT |
| `expected_decimals` | google.protobuf.UInt32Value | If present, the number of decimals this fungible token type is expected to have. The transfer will fail with UNEXPECTED\_TOKEN\_DECIMALS if the actual decimals differ. |
# TokenType
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/tokentype
Possible Token Types (IWA Compatibility).
Apart from fungible and non-fungible, Tokens can have either a common or unique representation. This distinction might seem subtle, but it is important when considering how tokens can be traced and if they can have isolated and unique properties.
| Enum Name | Description |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `FUNGIBLE_COMMON` | Interchangeable value with one another, where any quantity of them has the same value as another equal quantity if they are in the same class. Share a single set of properties, not distinct from one another. Simply represented as a balance or quantity to a given Hedera account. |
| `NON_FUNGIBLE_UNIQUE` | Unique, not interchangeable with other tokens of the same type as they typically have different values. Individually traced and can carry unique properties (e.g. serial number). |
####
# TopicID
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/topicid
Unique identifier for a topic (used by the consensus service)
| Field | Description |
| ---------- | ----------------------------------------------------- |
| `shardNum` | The shard number (nonnegative) |
| `realmNum` | The realm number (nonnegative) |
| `topicNum` | Unique topic identifier within a realm (nonnegative). |
####
# TransactionFeeSchedule
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/transactionfeeschedule
The fees for a specific transaction or query based on the fee data.
| Field | Type | Description |
| --------------------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `hederaFunctionality` | [HederaFunctionality](/hedera/sdks-and-apis/hedera-api/basic-types/hederafunctionality) | A particular transaction or query |
| `feeData` | [FeeData](/hedera/sdks-and-apis/hedera-api/basic-types/feedata) | Resource price coefficients
\[deprecated]
|
| `fees` | repeated [FeeData](/hedera/sdks-and-apis/hedera-api/basic-types/feedata) | Resource price coefficients. Supports subtype price definition |
####
# TransactionID
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/transactionid
The ID for a transaction. This is used for retrieving receipts and records for a transaction, for appending to a file right after creating it, for instantiating a smart contract with bytecode in a file just created, and internally by the network for detecting when duplicate transactions are submitted. A user might get a transaction processed faster by submitting it to N nodes, each with a different node account, but all with the same TransactionID. Then, the transaction will take effect when the first of all those nodes submits the transaction and it reaches consensus. The other transactions will not take effect. So this could make the transaction take effect faster, if any given node might be slow. However, the full transaction fee is charged for each transaction, so the total fee is N times as much if the transaction is sent to N nodes.
**Applicable to Scheduled Transactions**
* The ID of a Scheduled Transaction has `transactionValidStart` and `accountIDs` inherited from the `ScheduleCreate` transaction that created it. That is to say that they are equal
* The scheduled property is true for Scheduled Transactions
* `transactionValidStart`, `accountID` and scheduled properties should be omitted
| Field | Type | Description |
| ----------------------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `transactionValidStart` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | The transaction is invalid if consensusTimestamp \< transactionID.transactionStartValid |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The Account ID that paid for this transaction |
| `scheduled` | bool | Whether the Transaction is of type Scheduled or no |
| `nonce` | int32 | The identifier for an internal transaction that was spawned as part of handling a user transaction. (These internal transactions share the transactionValidStart and accountID of the user transaction, so a
nonce is necessary to give them a unique TransactionID.)
An example is when a "parent" ContractCreate or ContractCall transaction calls one or more HTS precompiled contracts; each of the "child" transactions spawned for a precompile has a id with a different nonce.
|
# TransferList
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/basic-types/transferlist
A list of accounts and amounts to transfer out of each account (negative) or into it (positive).
| Field | Type | Description |
| ---------------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `accountAmounts` | repeated [AccountAmount](/hedera/sdks-and-apis/hedera-api/basic-types/accountamount) | Multiple list of AccountAmount pairs, each of which has an account and an amount to transfer into it (positive) or out of it (negative) |
# Consensus Service
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/consensus
# Consensus Service
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/consensus/consensus-service
The Consensus Service provides the ability for Hedera to provide aBFT consensus as to the order and validity of messages submitted to a topic, as well as a consensus timestamp for those messages.
Automatic renewal can be configured via an autoRenewAccount (not currently implemented).\
Any time an autoRenewAccount is added to a topic, that createTopic/updateTopic transaction must be signed by the autoRenewAccount.
The autoRenewPeriod on an account must currently be set a value in createTopic between MIN\_AUTORENEW\_PERIOD (6999999seconds) and MAX\_AUTORENEW\_PERIOD (8000001 seconds). During creation this sets the initial expirationTime of the topic (see more below).
If no adminKey is on a topic, there may not be an autoRenewAccount on the topic, deleteTopic is not allowed, and the only change allowed via an updateTopic is to extend the expirationTime.
If an adminKey is on a topic, every updateTopic and deleteTopic transaction must be signed by the adminKey, except for updateTopics which only extend the topic's expirationTime (no adminKey authorization required).
If an updateTopic modifies the adminKey of a topic, the transaction signatures on the updateTopic must fulfill both the pre-update and post-update adminKey signature requirements.
Mirrornet ConsensusService may be used to subscribe to changes on the topic, including changes to the topic definition and the consensus ordering and timestamp of submitted messages.
Until autoRenew functionality is supported by HAPI, the topic will not expire, the autoRenewAccount will not be charged, and the topic will not automatically be deleted.
\
Once autoRenew functionality is supported by HAPI:
1. Once the expirationTime is encountered, if an autoRenewAccount is configured on the topic, the account will be charged automatically at the expirationTime, to extend the expirationTime of the topic up to the topic's autoRenewPeriod (or as much extension as the account's balance will supply).
2. If the topic expires and is not automatically renewed, the topic will enter the EXPIRED state. All transactions on the topic will fail with TOPIC\_EXPIRED, except an updateTopic() call that modifies only the expirationTime. getTopicInfo() will succeed. This state will be available for a AUTORENEW\_GRACE\_PERIOD grace period (7 days).
3. After the grace period, if the topic's expirationTime is not extended, the topic will be automatically deleted and no transactions or queries on the topic will succeed after that point.
## ConsensusService
| RPC | Request | Response | Comments |
| --------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `createTopic` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Create a topic to be used for consensus.
If an autoRenewAccount is specified, that account must also sign this transaction.
If an adminKey is specified, the adminKey must sign the transaction.
On success, the resulting TransactionReceipt contains the newly created TopicId.
Request is ConsensusCreateTopicTransactionBody
|
| `updateTopic` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Update a topic.
If there is no adminKey, the only authorized update (available to anyone) is to extend the expirationTime.
Otherwise transaction must be signed by the adminKey.
If an adminKey is updated, the transaction must be signed by the pre-update adminKey and post-update adminKey.
If a new autoRenewAccount is specified (not just being removed), that account must also sign the transaction.
Request is ConsensusUpdateTopicTransactionBody
|
| `deleteTopic` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Delete a topic. No more transactions or queries on the topic (via HAPI) will succeed.
If an adminKey is set, this transaction must be signed by that key.
If there is no adminKey, this transaction will fail UNAUTHORIZED.
Request is ConsensusDeleteTopicTransactionBody
|
| `getTopicInfo` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieve the latest state of a topic. This method is unrestricted and allowed on any topic by any payer account.
Deleted accounts will not be returned.
Request is ConsensusGetTopicInfoQuery
Response is ConsensusGetTopicInfoResponse
|
| `submitMessage` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Submit a message for consensus.
Valid and authorized messages on valid topics will be ordered by the consensus service, gossipped to the
mirror net, and published (in order) to all subscribers (from the mirror net) on this topic.
The submitKey (if any) must sign this transaction.
On success, the resulting TransactionReceipt contains the topic's updated topicSequenceNumber and
topicRunningHash.
Request is ConsensusSubmitMessageTransactionBody
|
# ConsensusCreateTopic
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/consensus/consensuscreatetopic
## ConsensusCreateTopicTransactionBody
| Field | Type | Description |
| ------------------ | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `memo` | string | Short publicly visible memo about the topic. No guarantee of uniqueness. |
| `adminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | Access control for updateTopic/deleteTopic.
Anyone can increase the topic's expirationTime via ConsensusService.updateTopic(), regardless of the adminKey.
If no adminKey is specified, updateTopic may only be used to extend the topic's expirationTime, and deleteTopic
is disallowed.
|
| `submitKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | Access control for submitMessage.
If unspecified, no access control is performed on ConsensusService.submitMessage (all submissions are allowed).
|
| `autoRenewPeriod` | [Duration](/hedera/sdks-and-apis/hedera-api/miscellaneous/duration) | The initial lifetime of the topic and the amount of time to attempt to extend the topic's lifetime by
automatically at the topic's expirationTime, if the autoRenewAccount is configured (once autoRenew functionality
is supported by HAPI).
Limited to MIN\_AUTORENEW\_PERIOD and MAX\_AUTORENEW\_PERIOD value by server-side configuration.
Required.
|
| `autoRenewAccount` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | Optional account to be used at the topic's expirationTime to extend the life of the topic (once autoRenew
functionality is supported by HAPI).
The topic lifetime will be extended up to a maximum of the autoRenewPeriod or however long the topic
can be extended using all funds on the account (whichever is the smaller duration/amount and if any extension
is possible with the account's funds).
If specified, there must be an adminKey and the autoRenewAccount must sign this transaction.
|
# ConsensusDeleteTopic
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/consensus/consensusdeletetopic
## ConsensusDeleteTopicTransactionBody
| Field | Type | Description |
| --------- | ----------------------------------------------------------------- | ----------------- |
| `topicID` | [TopicID](/hedera/sdks-and-apis/hedera-api/basic-types/topicid) | Topic identifier. |
# ConsensusGetTopicInfo
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/consensus/consensusgettopicinfo
## ConsensusGetTopicInfoQuery
| Field | Type | Description |
| --------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `topicID` | [TopicID](/hedera/sdks-and-apis/hedera-api/basic-types/topicid) | The Topic for which information is being requested |
## ConsensusGetTopicInfoResponse
Retrieve the parameters of and state of a consensus topic.
| Field | Type | Description |
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither. |
| `topicID` | [TopicID](/hedera/sdks-and-apis/hedera-api/basic-types/topicid) | Topic identifier. |
| `topicInfo` | [ConsensusTopicInfo](/hedera/sdks-and-apis/hedera-api/consensus/consensustopicinfo) | Current state of the topic |
\\
# ConsensusSubmitMessage
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/consensus/consensussubmitmessage
## ConsensusMessageChunkInfo
| Field | Type | Description |
| ---------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `initialTransactionID` | [TransactionID](/hedera/sdks-and-apis/hedera-api/basic-types/transactionid) | TransactionID of the first chunk, gets copied to every subsequent chunk in a fragmented message. |
| `total` | int32 | The total number of chunks in the message. |
| `number` | int32 | The sequence number (from 1 to total) of the current chunk in the message. |
## ConsensusSubmitMessageTransactionBody
| Field | Type | Description |
| ----------- | --------------------------------------------------------------- | -------------------------------------------------------------------- |
| `topicID` | [TopicID](/hedera/sdks-and-apis/hedera-api/basic-types/topicid) | Topic to submit message to. |
| `message` | bytes | Message to be submitted. Max size of a message is 1024 bytes (1 kb). |
| `chunkInfo` | [ConsensusMessageChunkInfo](#consensusmessagechunkinfo) | Optional information of the current chunk in a fragmented message. |
🚨 **NOTE:** Max size of a transaction (including messages and signatures) is 6kb.
# ConsensusTopicInfo
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/consensus/consensustopicinfo
| Field | Type | Description |
| ------------------ | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `memo` | | Short publicly visible memo about the topic. No guarantee of uniqueness. |
| `runningHash` | | When a topic is created, its running hash is initialized to 48 bytes of binary zeros. For each submitted message, the topic’s running hash is then updated to the output of a particular SHA-384 digest whose input data include the previous running hash.
See the TransactionReceipt.proto documentation for an exact description of the data included in the SHA-384 digest used for the update.
|
| `sequenceNumber` | | Sequence number (starting at 1 for the first submitMessage) of messages on the topic. |
| `expirationTime` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | Effective consensus timestamp at (and after) which submitMessage calls will no longer succeed on the topic and the topic will expire and after AUTORENEW\_GRACE\_PERIOD be automatically deleted. |
| `adminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | Access control for update/delete of the topic. Null if there is no key. |
| `submitKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | Access control for ConsensusService.submitMessage. Null if there is no key. |
| `autoRenewPeriod` | [Duration](/hedera/sdks-and-apis/hedera-api/miscellaneous/duration) | The duration in which to renew the topic |
| `autoRenewAccount` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | Null if there is no autoRenewAccount. |
| `ledger_id` | bytes | The ledger ID the response was returned from; please see [HIP-198](https://github.com/hashgraph/hedera-improvement-proposal/blob/master/HIP/hip-198.md) for the network-specific IDs. |
# ConsensusUpdateTopic
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/consensus/consensusupdatetopic
All fields left null will not be updated.
## ConsensusUpdateTopicTransactionBody
| Field | Type | Description | |
| ------------------ | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - |
| `topicID` | [TopicID](/hedera/sdks-and-apis/hedera-api/basic-types/topicid) | UNDOCUMENTED | |
| `memo` | google.protobuf.StringValue | Short publicly visible memo about the topic. No guarantee of uniqueness. Null for "do not update". | |
| `expirationTime` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | Effective consensus timestamp at (and after) which all consensus transactions and queries will fail.
The expirationTime may be no longer than MAX\_AUTORENEW\_PERIOD (8000001 seconds) from the consensus timestamp of
this transaction.
On topics with no adminKey, extending the expirationTime is the only updateTopic option allowed on the topic.
If unspecified, no change.
| |
| `adminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | Access control for update/delete of the topic.
If unspecified, no change.
If empty keyList - the adminKey is cleared.
| |
| `submitKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | Access control for ConsensusService.submitMessage.
If unspecified, no change.
If empty keyList - the submitKey is cleared.
| |
| `autoRenewPeriod` | [Duration](/hedera/sdks-and-apis/hedera-api/miscellaneous/duration) | The amount of time to extend the topic's lifetime automatically at expirationTime if the autoRenewAccount is
configured and has funds (once autoRenew functionality is supported by HAPI).
Limited to between MIN\_AUTORENEW\_PERIOD (6999999 seconds) and MAX\_AUTORENEW\_PERIOD (8000001 seconds) by
servers-side configuration (which may change).
If unspecified, no change.
| |
| `autoRenewAccount` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | Optional account to be used at the topic's expirationTime to extend the life of the topic.
Once autoRenew functionality is supported by HAPI, the topic lifetime will be extended up to a maximum of the
autoRenewPeriod or however long the topic can be extended using all funds on the account (whichever is the
smaller duration/amount).
If specified as the default value (0.0.0), the autoRenewAccount will be removed.
If unspecified, no change.
| |
| `memo` | string | The memo associated with the topic (UTF-8 encoding max 100 bytes) | |
# Cryptocurrency Accounts
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts
# CryptApproveAllowance
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptapproveallowance
## CryptoApproveAllowanceTransactionBody
Creates one or more hbar/token approved allowances **relative to the payer account of thistransaction**. Each allowance grants a spender the right to transfer a pre-determined amount of the payer's hbar/token to any other account of the spender's choice. (So if account 0.0.X pays for this transaction and owner is not specified in the allowance, then at consensus each spender account will have new allowances to spend hbar or tokens from 0.0.X).
| Field | Type | Description |
| ----------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `cryptoAllowance` | repeated [CryptoAllowance](/hedera/sdks-and-apis/hedera-api/basic-types/cryptoallowance) | List of hbar allowances approved by the account owner |
| `nftAllowance` | repeated [NftAllowance](/hedera/sdks-and-apis/hedera-api/basic-types/nftallowance) | List of non-fungible token allowances approved by the account owner |
| `tokenAllowance` | repeated [TokenAllowance](/hedera/sdks-and-apis/hedera-api/basic-types/tokenallowance) | List of fungible token allowances approved by the account owner. |
# CryptoCreate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptocreate
## CryptoCreateTransactionBody
Create a new account. After the account is created, the AccountID for it is in the receipt, or can be retrieved with a GetByKey query, or by asking for a Record of the transaction to be created, and retrieving that. The account can then automatically generate records for large transfers into it or out of it, which each last for 25 hours. Records are generated for any transfer that exceeds the thresholds given here. This account is charged cryptocurrency for each record generated, so the thresholds are useful for limiting Record generation to happen only for large transactions. The Key field is the key used to sign transactions for this account. If the account has receiverSigRequired set to true, then all cryptocurrency transfers must be signed by this account's key, both for transfers in and out. If it is false, then only transfers out have to be signed by it. When the account is created, the payer account is charged enough hbars so that the new account will not expire for the next autoRenewPeriod seconds. When it reaches the expiration time, the new account will then be automatically charged to renew for another autoRenewPeriod seconds. If it does not have enough hbars to renew for that long, then the remaining hbars are used to extend its expiration as long as possible. If it is has a zero balance when it expires, then it is deleted. This transaction must be signed by the payer account. If receiverSigRequired is false, then the transaction does not have to be signed by the keys in the keys field. If it is true, then it must be signed by them, in addition to the keys of the payer account.
| Field | Type | Description |
| ---------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `key` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The key that must sign each transfer out of the account. If receiverSigRequired is true, then it must also sign any transfer into the account. |
| `initialBalance` | uint64 | The initial number of tinybars to put into the account |
| `proxyAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | ID of the account to which this account is proxy staked. If proxyAccountID is null, or is an invalid account, or is an account that isn't a node, then this account is automatically proxy staked to a node chosen by the network, but without earning payments. If the proxyAccountID account refuses to accept proxy staking , or if it is not currently running a node, then it will behave as if proxyAccountID was null. |
| `sendRecordThreshold` | uint64 | **\[Deprecated v0.8.0**] The threshold amount (in tinybars) for which an account record is created for any send/withdraw transaction |
| `receiveRecordThreshold` | uint64 | **\[Deprecated v0.8.0**] The threshold amount (in tinybars) for which an account record is created for any receive/deposit transaction |
| `receiverSigRequired` | bool | If true, this account's key must sign any transaction depositing into this account (in addition to all withdrawals) |
| `autoRenewPeriod` | [Duration](/hedera/sdks-and-apis/hedera-api/miscellaneous/duration) | The account is charged to extend its expiration date every this many seconds. If it doesn't have enough balance, it extends as long as possible. If it is empty when it expires, then it is deleted. |
| `shardID` | [ShardID](/hedera/sdks-and-apis/hedera-api/basic-types/shardid) | The shard in which this account is created |
| `realmID` | [RealmID](/hedera/sdks-and-apis/hedera-api/basic-types/realmid) | The realm in which this account is created (leave this null to create a new realm) |
| `newRealmAdminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | If realmID is null, then this the admin key for the new realm that will be created |
| `memo` | string | The memo associated with the account (UTF-8 encoding max 100 bytes) |
| `max_automatic_token_associations` | int32 | The maximum number of tokens that an Account can be implicitly associated with. Defaults to 0 and up to a maximum value of 1000. |
# CryptoDelete
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptodelete
## CryptoDeleteTransactionBody
Mark an account as deleted, moving all its current HBAR to another account. It will remain in the ledger, marked as deleted, until it expires. Transfers into it a deleted account fail. But a deleted account can still have its expiration extended in the normal way.
| Field | Type | Description |
| ------------------- | ------------------------------------------------------------------- | ----------------------------------------------------- |
| `transferAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account ID which will receive all remaining hbars |
| `deleteAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account ID which should be deleted |
# CryptoDeleteAllowance
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptodeleteallowance
Deletes one or more non-fungible approved allowances from an owner's account. This operation will remove the allowances granted to one or more specific non-fungible token serial numbers. Each owner account listed as wiping an allowance must sign the transaction. Hbar and fungible token allowances can be removed by setting the amount to zero in CryptoApproveAllowance.
| Field | Type | Description |
| --------------- | -------------------------------------------------- | ------------------------------------------------ |
| `nftAllowances` | repeated [NFTRemoveAllowance](#nftremoveallowance) | List of non-fungible token allowances to remove. |
### NFTRemoveAllowance
Nft allowances to be removed on an owner account.
| Field | Type | Description |
| ---------------- | -------------- | --------------------------------------------------------------------- |
| `token_id` | TokenID | The token that the allowance pertains to. |
| `owner` | AccountID | The account ID of the token owner (ie. the grantor of the allowance). |
| `serial_numbers` | repeated int64 | The list of serial numbers to remove allowances from. |
# CryptoGetAccountBalance
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptogetaccountbalance
## CryptoGetAccountBalanceQuery
Get the balance of a cryptocurrency account. This returns only the balance, so it is a smaller and faster reply than CryptoGetInfo, which returns the balance plus additional information.
| Field | Type | Description |
| ------------ | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| **one of:** | | |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account ID for which information is requested |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The contract ID for which information is requested |
## CryptoGetAccountBalanceResponse
Response when the client sends the node CryptoGetAccountBalanceQuery
| Field | Type | Description |
| --------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account ID that is being described (this is useful with state proofs, for proving to a third party) |
| `balance` | uint64 | The current balance, in tinybars |
| `tokenBalances` | [TokenBalance](/hedera/sdks-and-apis/hedera-api/basic-types/tokenbalance) | The array of tokens that the account possesses |
# CryptoGetAccountRecords
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptogetaccountrecords
## CryptoGetAccountRecordsQuery
Get all the records for an account for any transfers into it and out of it, that were above the threshold, during the last 25 hours.
| Field | Type | Description |
| ----------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account ID for which the records should be retrieved |
## CryptoGetAccountRecordsResponse
Returns records of all transactions for which the given account was the effective payer in the last 3 minutes of consensus time and `ledger.keepRecordsInState=true` was true during `handleTransaction.`
| Field | Type | Description |
| ----------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account that this record is for |
| `records` | repreated [TransactionRecord](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionrecord) | List of records |
# CryptoGetInfo
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptogetinfo
## CryptoGetInfoQuery
Get all the information about an account, including the balance. This does not get the list of account records.
| Field | Type | Description |
| ----------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account ID for which information is requested |
## CryptoGetInfoResponse
Response when the client sends the node CryptoGetInfoQuery
| Field | Type | Description |
| -------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
## AccountInfo
Response when the client sends the node CryptoGetInfoQuery
| Field | Type | Description |
| ---------------------------------- | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account ID for which this information applies |
| `contractAccountID` | string | The Contract Account ID comprising of both the contract instance and the cryptocurrency account owned by the contract instance, in the format used by Solidity |
| `deleted` | bool | If true, then this account has been deleted, it will disappear when it expires, and all transactions for it will fail except the transaction to extend its expiration date |
| `proxyAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The Account ID of the account to which this is proxy staked. If proxyAccountID is null, or is an invalid account, or is an account that isn't a node, then this account is automatically proxy staked to a node chosen by the network, but without earning payments. If the proxyAccountID account refuses to accept proxy staking , or if it is not currently running a node, then it will behave as if proxyAccountID was null. |
| `proxyReceived` | int64 | The total number of tinybars proxy staked to this account |
| `key` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The key for the account, which must sign in order to transfer out, or to modify the account in any way other than extending its expiration date. |
| `balance` | uint64 | The current balance of account in tinybars |
| `generateSendRecordThreshold` | uint64 | **\[Deprecated v0.8.0**] The threshold amount (in tinybars) for which an account record is created (and this account charged for them) for any send/withdraw transaction. |
| `generateReceiveRecordThreshold` | uint64 | **\[Deprecated v0.8.0**] The threshold amount (in tinybars) for which an account record is created (and this account charged for them) for any transaction above this amount. |
| `receiverSigRequired` | | If true, no transaction can transfer to this account unless signed by this account's key |
| `expirationTime` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | The TimeStamp time at which this account is set to expire |
| `autoRenewPeriod` | [Duration](/hedera/sdks-and-apis/hedera-api/miscellaneous/duration) | The duration for expiration time will extend every this many seconds. If there are insufficient funds, then it extends as long as possible. If it is empty when it expires, then it is deleted. |
| `liveHashes` | Claim | All of the livehashes attached to the account (each of which is a hash along with the keys that authorized it and can delete it ) |
| `tokenRelationships` | [TokenRelationship](/hedera/sdks-and-apis/hedera-api/basic-types/tokenrelationship) | All tokens related to this account |
| `memo` | string | The memo associated with the account |
| `ownedNfts` | int64 | The number of NFTs owned by this account |
| `max_automatic_token_associations` | int32 | The maximum number of tokens that an Account can be implicitly associated with |
| `alias` | bytes | The alias of this account |
| `ledger_id` | bytes | The ledger ID the response was returned from; please see [HIP-198](https://hips.hedera.com/hip/hip-198) for the network-specific IDs. |
####
# CryptoGetStakers
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptogetstakers
## AllProxyStakers
all of the accounts proxy staking to a given account, and the amounts proxy staked
| Field | Type | Description |
| ------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The Account ID that is being proxy staked to |
| `proxyStaker` | [ProxyStaker](#proxystaker) | Each of the proxy staking accounts, and the amount they are proxy staking |
## CryptoGetStakersQuery
Get all the accounts that are proxy staking to this account. For each of them, give the amount currently staked. This is not yet implemented, but will be in a future version of the API.
| Field | Type | Description |
| ----------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The Account ID for which the records should be retrieved |
## CryptoGetStakersResponse
Response when the client sends the node CryptoGetStakersQuery
| Field | Type | Description |
| --------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `stakers` | [AllProxyStakers](#allproxystakers) | List of accounts proxy staking to this account, and the amount each is currently proxy staking |
## ProxyStaker
information about a single account that is proxy staking
| Field | Type | Description |
| ----------- | ------------------------------------------------------------------- | --------------------------------------------------- |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The Account ID that is proxy staking |
| `amount` | int64 | The number of hbars that are currently proxy staked |
# CryptoService
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptoservice
| RPC | Request | Response | Comments |
| ------------------------ | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| createAccount | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Creates a new account by submitting the transaction. The grpc server returns the TransactionResponse |
| updateAccount | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Updates an account by submitting the transaction. The grpc server returns the TransactionResponse |
| cryptoTransfer | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Initiates a transfer by submitting the transaction. The grpc server returns the TransactionResponse |
| cryptoDelete | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Deletes and account by submitting the transaction. The grpc server returns the TransactionResponse |
| addLiveHash | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | (NOT CURRENTLY SUPPORTED) Adds a livehash |
| deleteLiveHash | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | (NOT CURRENTLY SUPPORTED) Deletes a livehash |
| getLiveHash | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | (NOT CURRENTLY SUPPORTED) Retrieves a livehash for an account |
| getAccountRecords | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the record(fetch by AccountID ID) for an account by submitting the query. |
| cryptoGetBalance | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the balance for an account by submitting the query. |
| getAccountInfo | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the account information for an account by submitting the query. |
| getTransactionReceipts | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the transaction receipts for an account by TxId which last for 180sec only for no fee. |
| getFastTransactionRecord | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the transaction record by TxID which last for 180sec only for no fee. |
| getTxRecordByTxID | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the transactions record(fetch by Transaction ID) for an account by submitting the query. |
| getStakersByAccountID | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the stakers for a node by account ID by submitting the query. |
| approveAllowances | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Adds one or more approved allowances for spenders to transfer the paying account's hbar or tokens |
| deleteAllowance | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Deletes the approved NFT allowances on an owner account |
# CryptoTransfer
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptotransfer
Transfer cryptocurrency from some accounts to other accounts. The accounts list can contain up to 10 accounts. The amounts list must be the same length as the accounts list. Each negative amount is withdrawn from the corresponding account (a sender), and each positive one is added to the corresponding account (a receiver). The amounts list must sum to zero. Each amount is a number of tinyBars (there are 100,000,000 tinyBars in one Hbar). If any sender account fails to have sufficient hbars to do the withdrawal, then the entire transaction fails, and none of those transfers occur, though the transaction fee is still charged. This transaction must be signed by the keys for all the sending accounts, and for any receiving accounts that have receiverSigRequired == true. The signatures are in the same order as the accounts, skipping those accounts that don't need a signature.
## CryptoTransferTransactionBody
| Field | Type | Description |
| -------------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| transfers | [TransferList](/hedera/sdks-and-apis/hedera-api/basic-types/transferlist) | Accounts and amounts to transfer |
| tokenTransfers | repeated [TokenTransferList](/hedera/sdks-and-apis/hedera-api/basic-types/tokentransferlist) | The desired token unit balance adjustments; if any custom fees are assessed, the ledger will try to deduct them from the payer of this CryptoTransfer, resolving the transaction to `INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE` if this is not possible |
# CryptoUpdate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptoupdate
## CryptoUpdateTransactionBody
Change properties for the given account. Any null field is ignored (left unchanged). This transaction must be signed by the existing key for this account. If the transaction is changing the key field, then the transaction must be signed by both the old key (from before the change) and the new key. The old key must sign for security. The new key must sign as a safeguard to avoid accidentally changing to an invalid key, and then having no way to recover. When extending the expiration date, the cost is affected by the size of the list of attached claims, and of the keys associated with the claims and the account.
| Field | Type | Description |
| ---------------------------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accountIDToUpdate` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account ID which is being updated in this transaction |
| `key` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The new key |
| `proxyAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | ID of the account to which this account is proxy staked. If proxyAccountID is null, or is an invalid account, or is an account that isn't a node, then this account is automatically proxy staked to a node chosen by the network, but without earning payments. If the proxyAccountID account refuses to accept proxy staking , or if it is not currently running a node, then it will behave as if proxyAccountID was null. |
| `proxyFraction` | | **\[Deprecated].** payments earned from proxy staking are shared between the node and this account, with proxyFraction / 10000 going to this account |
| `sendRecordThresholdField` | **one of:** | **\[Deprecated v0.8.0**] |
| | sendRecordThreshold | |
| | sendRecordThresholdWrapper | google.protobuf.UInt64Value |
| `receiveRecordThresholdField` | **one of:** | **\[Deprecated v0.8.0**] |
| | receiveRecordThreshold | |
| | receiveRecordThresholdWrapper | google.protobuf.UInt64Value |
| `autoRenewPeriod` | [Duration](/hedera/sdks-and-apis/hedera-api/miscellaneous/duration) | The duration in which it will automatically extend the expiration period. If it doesn't have enough balance, it extends as long as possible. If it is empty when it expires, then it is deleted. |
| `expirationTime` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | The new expiration time to extend to (ignored if equal to or before the current one) |
| `receiverSigRequiredField` | **one of:** | |
| | receiverSigRequired | \[Deprecated] Do NOT use this field to set a false value because the server cannot distinguish from the default value. Use receiverSigRequiredWrapper field for this purpose. |
| | receiverSigRequiredWrapper | google.protobuf.BoolValue |
| `memo` | string | The memo associated with the account (UTF-8 encoding max 100 bytes) |
| `max_automatic_token_associations` | google.protobuf.Int32Value | The maximum number of tokens that an Account can be implicitly associated with. Up to a 1000 including implicit and explicit associations. |
# File Service
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/file-service
# FileAppend
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/file-service/fileappend
## FileAppendTransactionBody
Append the given contents to the end of the specified file. If a file is too big to create with a single FileCreateTransaction, then it can be created with the first part of its contents, and then appended as many times as necessary to create the entire file.
| Field | Type | Description |
| ---------- | --------------------------------------------------------------- | ---------------------------------------------------------------- |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | The file to which the bytes will be appended |
| `contents` | bytes | The bytes that will be appended to the end of the specified file |
# FileCreate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/file-service/filecreate
## FileCreateTransactionBody
Create a new file, containing the given contents. After the file is created, the FileID for it can be found in the receipt, or record, or retrieved with a GetByKey query. The file contains the specified contents (possibly empty). The file will automatically disappear at the expirationTime, unless its expiration is extended by another transaction before that time. If the file is deleted, then its contents will become empty and it will be marked as deleted until it expires, and then it will cease to exist.
The keys field is a list of keys. All the keys on the list must sign to create or modify a file, but only one of them needs to sign in order to delete the file. Each of those “keys” may itself be threshold key containing other keys (including other threshold keys). In other words, the behavior is an AND for create/modify, OR for delete. This is useful for acting as a revocation server. If it is desired to have the behavior be AND for all 3 operations (or OR for all 3), then the list should have only a single Key, which is a threshold key, with N=1 for OR, N=M for AND. If a file is created without ANY keys in the keys field, the file is immutable and ONLY the expirationTime of the file can be changed with a FileUpdate transaction. The file contents or its keys cannot be changed.
An entity (account, file, or smart contract instance) must be created in a particular realm. If the realmID is left null, then a new realm will be created with the given admin key. If a new realm has a null adminKey, then anyone can create/modify/delete entities in that realm. But if an admin key is given, then any transaction to create/modify/delete an entity in that realm must be signed by that key, though anyone can still call functions on smart contract instances that exist in that realm. A realm ceases to exist when everything within it has expired and no longer exists. The current API ignores shardID, realmID, and newRealmAdminKey, and creates everything in shard 0 and realm 0, with a null key. Future versions of the API will support multiple realms and multiple shards.
| Field | Type | Description |
| ------------------ | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `expirationTime` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | The time at which this file should expire (unless FileUpdateTransaction is used before then to extend its life) |
| `keys` | [KeyList](/hedera/sdks-and-apis/hedera-api/basic-types/key) | All these keys must sign to create or modify the file. Any one of them can sign to delete the file. |
| `contents` | Content | The bytes that are the contents of the file |
| `shardID` | [ShardID](/hedera/sdks-and-apis/hedera-api/basic-types/shardid) | Shard in which this file is created |
| `realmID` | [RealmID](/hedera/sdks-and-apis/hedera-api/basic-types/realmid) | The Realm in which to the file is created (leave this null to create a new realm) |
| `newRealmAdminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | If realmID is null, then this the admin key for the new realm that will be created |
| `memo` | string | The memo associated with the file (UTF-8 encoding max 100 bytes) |
# FileDelete
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/file-service/filedelete
## FileDeleteTransactionBody
Delete the given file. After deletion, it will be marked as deleted and will have no contents. But information about it will continue to exist until it expires. A list of keys was given when the file was created. All the keys on that list must sign transactions to create or modify the file, but any single one of them can be used to delete the file. Each "key" on that list may itself be a threshold key containing other keys (including other threshold keys).
| Field | Type | Description |
| -------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | The file to delete. It will be marked as deleted until it expires. Then it will disappear. |
# FileGetContents
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/file-service/filegetcontents
## FileGetContentsQuery
Get the contents of a file. The content field is empty (no bytes) if the file is empty.
| Field | Type | Description |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/file-service/broken-reference/README.md) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `fileID` | [FileID](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/file-service/broken-reference/README.md) | The file ID of the file whose contents are requested |
## FileGetContentsResponse
Response when the client sends the node FileGetContentsQuery
| Field | Type | Description |
| -------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `fileContents` | [FileGetContentsResponse.FileContents](#filegetcontentsresponse) | the file ID and contents (a state proof can be generated for this) |
## FileGetContentsResponse
Response when the client sends the node FileGetContentsQuery
| Field | Type | Description |
| ---------- | ------------------------------------------------------------- | --------------------------------------------------------- |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | The file ID of the file whose contents are being returned |
| `contents` | FileContents | The bytes contained in the file |
# FileGetInfo
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/file-service/filegetinfo
## FileGetInfoQuery
Get all of the information about a file, except for its contents. When a file expires, it no longer exists, and there will be no info about it, and the fileInfo field will be blank. If a transaction or smart contract deletes the file, but it has not yet expired, then the fileInfo field will be non-empty, the deleted field will be true, its size will be 0, and its contents will be empty. Note that each file has a FileID, but does not have a filename.
| Field | Type | Description |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/file-service/broken-reference/README.md) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `fileID` | [FileID](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/file-service/broken-reference/README.md) | The file ID of the file for which information is requested |
## FileGetInfoResponse
Response when the client sends the node FileGetInfoQuery
| Field | Type | Description |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/file-service/broken-reference/README.md) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `fileInfo` | [FileGetInfoResponse.FileInfo](#filegetinforesponse-fileinfo) | The information about the file (a state proof can be generated for this) |
## FileGetInfoResponse
Response when the client sends the node FileGetInfoQuery
| Field | Type | Description |
| ---------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | The file ID of the file for which information is requested |
| `size` | int64 | Number of bytes in contents |
| `expirationTime` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | The current time at which this account is set to expire |
| `deleted` | bool | True if deleted but not yet expired |
| `keys` | [KeyList](/hedera/sdks-and-apis/hedera-api/basic-types/keylist) | One of these keys must sign in order to modify or delete the file |
| `memo` | string | The memo associated with the file (UTF-8 encoding max 100 bytes) |
| `ledger_id` | bytes | The ledger ID the response was returned from; please see [HIP-198](https://hips.hedera.com/hip/hip-198) for the network-specific IDs |
# FileService
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/file-service/fileservice
| RPC | Request | Response | Comments |
| ---------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| `createFile` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Creates a file |
| `updateFile` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Updates a file |
| `deleteFile` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Deletes a file |
| `appendContent` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Appends the file |
| `getFileContent` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the file content |
| `getFileInfo` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the file information |
| `systemDelete` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Deletes a file if the submitting account has network admin privileges |
| `systemUndelete` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Undeletes a file if the submitting account has network admin privileges |
# FileUpdate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/file-service/fileupdate
## FileUpdateTransactionBody
Modify the metadata and/or contents of a file. If a field is not set in the transaction body, the corresponding file attribute will be unchanged. This transaction must be signed by all the keys in the key list of the file being updated. If the keys themselves are being update, then the transaction must also be signed by all the new keys.
| Field | Type | Description |
| ---------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------ |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | The ID of the file to update |
| `expirationTime` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | The new expiry time (ignored if not later than the current expiry) |
| `keys` | [KeyList](/hedera/sdks-and-apis/hedera-api/basic-types/keylist) | The new list of keys that can modify or delete the file |
| `contents` | bytes | The new contents that should overwrite the file's current contents |
| `memo` | string | The memo associated with the file (UTF-8 encoding max 100 bytes) |
# Miscellaneous
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous
# Duration
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/duration
A length of time in seconds.
| Field | Description |
| --------- | --------------------- |
| `seconds` | The number of seconds |
# ExchangeRate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/exchangerate
## ExchangeRate
An exchange rate between hbar and cents (USD) and the time at which the exchange rate will expire, and be superseded by a new exchange rate.\
The price is computed as follow: `1 hbar = (centEquiv / hbarEquiv) USD cents`
| Field | Type | Description |
| ---------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| `centEquiv` | uint64 | Numerator in calculation of exchange rate between hbar and cents |
| `hbarEquiv` | uint64 | Denominator in calculation of exchange rate between hbar and cents |
| `expirationTime` | [TimestampSeconds](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp#timestampseconds) | Expiration time in seconds for this exchange rate |
## ExchangeRateSet
Two sets of exchange rate
| Field | Type | Description |
| ------------- | ----------------------------- | ------------------------------------------------------------------- |
| `currentRate` | [ExchangeRate](#exchangerate) | Current exchange rate |
| `nextRate` | [ExchangeRate](#exchangerate) | Next exchange rate which will take effect when current rate expires |
# Freeze
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/freeze
## FreezeTransactionBody
Set the freezing period in which the platform will stop creating events and accepting transactions. This is used before safely shut down the platform for maintenance.
| Field | Description |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `startHour[deprecated=true]` | The start hour (in UTC time), a value between 0 and 23 |
| `startMin[deprecated=true]` | The start minute (in UTC time), a value between 0 and 59 |
| `endHour[deprecated=true]` | The end hour (in UTC time), a value between 0 and 23 |
| `endMin[deprecated=true]` | The end minute (in UTC time), a value between 0 and 59 |
| `update_file` | If set, the file whose contents should be used for a network software update during the maintenance window. |
| `file_hash` | If set, the expected hash of the contents of the update file (used to verify the update). |
| `start_time` | The consensus time at which the maintenance window should begin. |
| `freeze_type` | The type of network freeze or upgrade operation to perform. |
## FreezeService.proto
#### FreezeService
| RPC | Request | Response | Comments |
| -------- | ----------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `freeze` | Transaction | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Freezes the nodes by submitting the transaction. The grpc server returns the TransactionResponse |
# FreezeType
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/freezetype
The type of network freeze or upgrade operation to be performed. This type dictates which fields are required.
| Enum | Description |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `UNKNOWN_FREEZE_TYPE` | An (invalid) default value for this enum, to ensure the client explicitly sets the intended type of freeze transaction. |
| `FREEZE_ONLY` | Freezes the network at the specified time. The start\_time field must be provided and must reference a future time. Any values specified for the update\_file and file\_hash fields will be ignored. This transaction does not perform any network changes or upgrades and requires manual intervention to restart the network. |
| `PREPARE_UPGRADE` | A non-freezing operation that initiates network wide preparation in advance of a scheduled freeze upgrade. The update\_file and file\_hash fields must be provided and valid. The start\_time field may be omitted and any value present will be ignored. |
| `FREEZE_UPGRADE` | Freezes the network at the specified time and performs the previously prepared automatic upgrade across the entire network. |
| `FREEZE_ABORT` | Aborts a pending network freeze operation. |
| `TELEMETRY_UPGRADE` | Performs an immediate upgrade on auxilary services and containers providing telemetry/metrics. Does not impact network operations. |
# GetByKey
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/getbykey
## EntityID
the ID for a single entity (account, claim, file, or smart contract instance)
| Field | Type | Description |
| ------------ | --------------------------------------------------------------------- | ---------------------------------------------- |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The Account ID for the cryptocurrency account |
| `liveHash` | LiveHash | A uniquely identifying livehash of an acount |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | The file ID of the file |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The smart contract ID that identifies instance |
## GetByKeyQuery
Get all accounts, claims, files, and smart contract instances whose associated keys include the given Key. The given Key must not be a contractID or a ThresholdKey. This is not yet implemented in the API, but will be in the future.
| Field | Type | Description |
| -------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `key` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The key to search for. It must not contain a contractID nor a ThresholdSignature. |
## GetByKeyResponse
Response when the client sends the node GetByKeyQuery
| Field | Type | Description |
| ---------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `entities` | EntityID | The list of entities that include this public key in their associated Key list |
# GetBySolidityID
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/getbysolidityid
## GetBySolidityIDQuery
Get the IDs in the format used by transactions, given the ID in the format used by Solidity. If the Solidity ID is for a smart contract instance, then both the ContractID and associated AccountID will be returned.
| Field | Type | Description |
| ------------ | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `solidityID` | string | The ID in the format used by Solidity |
## GetBySolidityIDResponse
Response when the client sends the node GetBySolidityIDQuery
| Field | Type | Description |
| ------------ | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The Account ID for the cryptocurrency account |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | The file Id for the file |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | A smart contract ID for the instance (if this is included, then the associated accountID will also be included) |
# NetworkGetVersionInfo
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/networkgetversioninfo
Get the deployed versions of Consensus Node and the HAPI proto in semantic version format
#### NetworkGetVersionInfoQuery
| Field | Type | Description |
| -------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
#### NetworkGetVersionInfoResponse
Response when the client sends the node NetworkGetVersionInfoQuery
| Field | Type | Description |
| ----------------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `hapiProtoVersion` | [SemanticVersion](/hedera/sdks-and-apis/hedera-api/basic-types/semanticversion) | The Hedera API (HAPI) protobuf version recognized by the responding node |
| `hederaServicesVersion` | [SemanticVersion](/hedera/sdks-and-apis/hedera-api/basic-types/semanticversion) | The version of the Consensus Node software deployed on the responding node |
# NetworkService
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/networkservice
The requests and responses for different network services.
#### NetworkService
| RPC | Request | Response | Comments |
| ---------------- | ------- | -------- | -------------------------------------------------------------- |
| `getVersionInfo` | Query | Response | Retrieves the active versions of Consensus Node and HAPI proto |
# Query
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/query
## Query
A single query, which is sent from the client to the node. This includes all possible queries. Each Query should not have more than 50 levels.
# QueryHeader
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader
Each query from the client to the node will contain the QueryHeader, which gives the requested response type, and includes a payment for the response. It will sometimes leave payment blank: it is blank for TransactionGetReceiptQuery. It can also be left blank when the responseType is costAnswer or costAnswerStateProof. But it needs to be filled in for all other cases. The idea is that an answer that is only a few bytes (or that was paid for earlier) can be given for free. But if the answer is something that requires many bytes or much computation (like a state proof), then it should be paid for.
| Field | Type | Description |
| -------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `payment` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | A signed CryptoTransferTransaction to pay the node a fee for handling this query |
| `responseType` | [ResponseType](#responsetype) | The requested response, asking for cost, state proof, both, or neither |
## ResponseType
The client uses the ResponseType to request that the node send it just the answer, or both the answer and a state proof. It can also ask for just the cost for getting the answer or both. If the payment in the query fails the precheck, then the response may have some fields blank. The state proof is only available for some types of information. It is available for a Record, but not a receipt. It is available for the information in each kind of \*GetInfo request.
| Enum Name | Description |
| ------------------------- | ----------------------------------------------------------------------------- |
| `ANSWER_ONLY` | Response returns answer |
| `ANSWER_STATE_PROOF` | Response returns both answer and state proof (not yet supported) |
| `COST_ANSWER` | Response returns the cost of answer |
| `COST_ANSWER_STATE_PROOF` | Response returns the total cost of answer and state proof (not yet supported) |
# Response
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/response
A single response, which is returned from the node to the client, after the client sent the node a query. This includes all responses.
| Field | Type | Description |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `getByKey` | [GetByKeyResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/getbykey#getbykeyresponse) | Get all entities associated with a given key |
| `getBySolidityID` | [GetBySolidityIDResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/getbysolidityid#getbysolidityidresponse) | Get the IDs in the format used in transactions, given the format used in Solidity |
| `contractCallLocal` | [ContractCallLocalResponse](/hedera/sdks-and-apis/hedera-api/smart-contracts/contractcalllocal#contractcalllocalresponse) | Response to call a function of a smart contract instance |
| `contractGetBytecodeResponse` | [ContractGetBytecodeResponse](/hedera/sdks-and-apis/hedera-api/smart-contracts/contractgetbytecode) | Get the bytecode for a smart contract instance |
| `contractGetInfo` | [ContractGetInfoResponse](/hedera/sdks-and-apis/hedera-api/smart-contracts/contractgetinfo#contractgetinforesponse) | Get information about a smart contract instance |
| `contractGetRecordsResponse` | [ContractGetRecordsResponse](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/miscellaneous/broken-reference/README.md) | Get all existing records for a smart contract instance |
| `cryptogetAccountBalance` | [CryptoGetAccountBalanceResponse](/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptogetaccountbalance) | Get the current balance in a cryptocurrency account |
| `cryptoGetAccountRecords` | [CryptoGetAccountRecordsResponse](/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptogetaccountrecords) | Get all the records that currently exist for transactions involving an account |
| `cryptoGetInfo` | [CryptoGetInfoResponse](/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptogetinfo#cryptogetinforesponse) | Get all information about an account |
| `cryptoGetLiveHash` | [CryptoGetLiveHashResponse](/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptogetinfo) | Get a single claim from a single account (or null if it doesn't exist) |
| `cryptoGetProxyStakers` | [CryptoGetStakersResponse](/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptogetstakers) | Get all the accounts that proxy stake to a given account, and how much they proxy stake |
| `fileGetContents` | [FileGetContentsResponse](/hedera/sdks-and-apis/hedera-api/file-service/filegetcontents) | Get the contents of a file (the bytes stored in it) |
| `fileGetInfo` | [FileGetInfoResponse](/hedera/sdks-and-apis/hedera-api/file-service/filegetinfo) | Get information about a file, such as its expiration date |
| `transactionGetReceipt` | [TransactionGetReceiptResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactiongetreceipt) | Get a receipt for a transaction (lasts 180 seconds) |
| `transactionGetRecord` | [TransactionGetRecordResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactiongetrecord) | Get a record for a transaction (lasts 1 hour) |
| `transactionGetFastRecord` | [TransactionGetFastRecordResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactiongetfastrecord) | Get a record for a transaction (lasts 180 seconds) |
| `consensusGetTopicInfo` | [ConsensusGetTopicInfoResponse](/hedera/sdks-and-apis/hedera-api/consensus/consensusgettopicinfo) | Parameters of and state of a consensus topic. |
| `networkGetVersionInfo` | [NetworkGetVersionInfoResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/networkgetversioninfo) | Semantic versions of Consensus Node and HAPI proto |
| `tokenGetInfo` | [TokenGetInfoResponse](/hedera/sdks-and-apis/hedera-api/token-service/tokengetinfo) | Get all information about a token |
| `scheduleGetInfo` | [ScheduleGetInfoResponse](/hedera/sdks-and-apis/hedera-api/schedule-service/schedulegetinfo) | Get all information about a schedule entity |
| `tokenGetAccountNftInfo` | [TokenGetAccountNftInfoResponse](/hedera/sdks-and-apis/hedera-api/token-service/tokengetaccountnftinfo) | A list of the NFTs associated with the account |
| `tokenGetNftInfo` | [TokenGetNftInfoResponse](/hedera/sdks-and-apis/hedera-api/token-service/tokengetnftinfo) | All information about an NFT |
| `tokenGetNftInfos` | [TokenGetNftInfosResponse](/hedera/sdks-and-apis/hedera-api/token-service/tokengetinfo) | A list of the NFTs for the token |
# ResponseCode
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/responsecode
The transaction passed the precheck validations.
For any error not handled by specific error codes listed below.
Payer account does not exist.
Node Account provided does not match the node account of the node the transaction was submitted to.
Pre-Check error when TransactionValidStart + transactionValidDuration is less than current consensus time.
Transaction start time is greater than current consensus time
Invalid transaction duration is a positive non-zero number that does not exceed 120 seconds
The transaction signature is not valid
Transaction memo size exceeded 100 bytes
The fee provided in the transaction is insufficient for this type of transaction
The payer account has insufficient cryptocurrency to pay the transaction fee
This transaction ID is a duplicate of one that was submitted to this node or reached consensus in the last 180 seconds (receipt period)
If API is throttled out
The API is not currently supported
The file id is invalid or does not exist
The account id is invalid or does not exist
The contract id is invalid or does not exist
Transaction id is not valid
Receipt for given transaction id does not exist
Record for given transaction id does not exist
The solidity id is invalid or entity with this solidity id does not exist
This node has submitted this transaction to the network. Status of the transaction is currently unknown.
The transaction succeeded
There was a system error and the transaction failed because of invalid request parameters.
There was a system error while performing fee calculation, reserved for future.
There was a system error while performing balance checks, reserved for future.
Key not provided in the transaction body
Unsupported algorithm/encoding used for keys in the transaction
When the account balance is not sufficient for the transfer
During an update transaction when the system is not able to find the Users Solidity address
Not enough gas was supplied to execute transaction
contract byte code size is over the limit
local execution (query) is requested for a function which changes state
Contract REVERT OPCODE executed
For any contract execution-related error not handled by the specific error codes listed above.
In Query validation, an account with +ve(amount) value should be a Receiving node account, the receiver account should be only one account in the list.
The header is missing in the Query request.
The update of the account failed.
Provided key encoding was not supported by the system.
null solidity address
update of the contract failed
the query header is invalid
Invalid fee submitted
Payer signature is invalid
The keys were not provided in the request.
Expiration time provided in the transaction was invalid.
WriteAccess Control Keys are not provided for the file
The contents of file are provided as empty.
The crypto transfer credit and debit do not sum equal to 0
Transaction body provided is empty
# ResponseHeader
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader
## ResponseHeader
Every query receives a response containing the QueryResponseHeader. Either or both of the cost and stateProof fields may be blank, if the responseType didn't ask for the cost or stateProof.
| Field | Type | Description |
| ----------------------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `nodeTransactionPrecheckCode` | [ResponseCodeEnum](/hedera/sdks-and-apis/hedera-api/miscellaneous/responsecode) | Result of fee transaction precheck, saying it passed, or why it failed |
| `responseType` | [ResponseType](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | The requested response is repeated back here, for convenience |
| `cost` | uint64 | The fee that would be charged to get the requested information (if a cost was requested). Note: This cost only includes the query fee and does not include the transfer fee(which is required to execute the transfer transaction to debit the payer account and credit the node account with query fee) |
| `stateProof` | bytes | The state proof for this information (if a state proof was requested, and is available) |
# SystemDelete
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/systemdelete
## SystemDeleteTransactionBody
Delete a file or smart contract - can only be done with a Hedera administrative multisignature. When it is deleted, it immediately disappears from the system as seen by the user, but is still stored internally until the expiration time, at which time it is truly and permanently deleted. Until that time, it can be undeleted by the Hedera administrative multisignature. When a smart contract is deleted, the cryptocurrency account within it continues to exist, and is not affected by the expiration time here.
| Field | Type | Description |
| ---------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `fileId` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | The file ID of the file to delete, in the format used in transactions |
| `contractId` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The contract ID instance to delete, in the format used in transactions |
| `expirationTime` | [TimestampSeconds](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | The timestamp in seconds at which the "deleted" file should truly be permanently deleted |
# SystemUndelete
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/systemundelete
## SystemUndeleteTransactionBody
Undelete a file or smart contract that was deleted by SystemDelete; requires a Hedera administrative multisignature.
| Field | Type | Description |
| ------------ | --------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | The file ID to undelete, in the format used in transactions |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The contract ID instance to undelete, in the format used in transactions |
# TimeStamp
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp
## TokenUnitBalance
| Field | Description |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tokenId` | A unique token id |
| `balance` | Number of transferable units of the identified token. For token of type `FUNGIBLE_COMMON` - balance in the smallest denomination. For token of type `NON_FUNGIBLE_UNIQUE` - the number of NFTs held by the account. |
## Timestamp
An exact date and time. This is the same data structure as the protobuf Timestamp.proto (see the comments in https:github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto)
| Field | Description |
| --------- | -------------------------------------------------------- |
| `seconds` | Number of complete seconds since the start of the epoch |
| `nanos` | Number of nanoseconds since the start of the last second |
## TimestampSeconds
An exact date and time, with a resolution of one second (no nanoseconds).
| Field | Description |
| --------- | ------------------------------------------------------- |
| `seconds` | Number of complete seconds since the start of the epoch |
# Transaction
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction
A single signed transaction, including all its signatures. The SignatureList will have a Signature for each Key in the transaction, either explicit or implicit, in the order that they appear in the transaction. For example, a CryptoTransfer will first have a Signature corresponding to the Key for the paying account, followed by a Signature corresponding to the Key for each account that is sending or receiving cryptocurrency in the transfer. Each Transaction should not have more than 50 levels.\
The SignatureList field is deprecated and succeeded by SignatureMap.
## Transaction
| Field | Type | Description | |
| ------------------------ | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ----------------- |
| `signedTransactionBytes` | bytes | SignedTransaction serialized into bytes | |
| `bodyBytes` | bytes | TransactionBody serialized into bytes, which needs to be signed | deprecated = true |
| `sigMap` | [SignatureMap](/hedera/sdks-and-apis/hedera-api/basic-types/signaturemap) | The signatures on the body with the new format, to authorize the transaction | deprecated = true |
# TransactionContents
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction-contents
## SignedTransaction
| Field | Type | Description |
| ----------- | ------------ | ---------------------------------------------------------------------------- |
| `bodyBytes` | | TransactionBody serialized into bytes, which needs to be signed |
| `sigMap` | SignatureMap | The signatures on the body with the new format, to authorize the transaction |
# TransactionBody
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionbody
A single transaction. All transaction types are possible here.
| Field | Type | Description |
| --------------------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `transactionID` | TransactionID | The ID for this transaction, which includes the payer's account (the account paying the transaction fee). If two transactions have the same transactionID, they won't both have an effect |
| `nodeAccountID` | AccountID | The account of the node that submits the client's transaction to the network |
| `transactionFee` | uint64 | The maximum transaction fee the client is willing to pay |
| `transactionValidDuration` | Duration | The transaction is invalid if consensusTimestamp > transactionID.transactionValidStart + transactionValidDuration |
| `generateRecord` | bool | Should a record of this transaction be generated? (A receipt is always generated, but the record is optional) |
| `memo` | string | Any notes or descriptions that should be put into the record (max length 100) |
| `contractCall` | ContractCallTransactionBody | Calls a function of a contract instance |
| `contractCreateInstance` | ContractCreateTransactionBody | Creates a contract instance |
| `contractUpdateInstance` | ContractUpdateTransactionBody | Updates a contract |
| `contractDeleteInstance` | ContractDeleteTransactionBody | Delete contract and transfer remaining balance into specified account |
| `cryptoAddLiveHash` | CryptoAddLiveHashTransactionBody | Attach a new livehash to an account |
| `cryptoApproveAllowance` | CryptoApproveAllowanceTransactionBody | Adds one or more approved allowances for spenders to transfer the paying account's hbar or tokens. |
| `cryptoDeleteAllowance` | CryptoDeleteAllowanceTransactionBody | Deletes one or more approved hbar or token allowances from an owner's account |
| `cryptoCreateAccount` | CryptoCreateTransactionBody | Create a new cryptocurrency account |
| `cryptoDelete` | CryptoDeleteTransactionBody | Delete a cryptocurrency account (mark as deleted, and transfer hbars out) |
| `cryptoDeleteLiveHash` | CryptoDeleteLiveHashTransactionBody | Remove a livehash from an account |
| `cryptoTransfer` | CryptoTransferTransactionBody | Transfer amount between accounts |
| `cryptoUpdateAccount` | CryptoUpdateTransactionBody | Modify information such as the expiration date for an account |
| `fileAppend` | FileAppendTransactionBody | Add bytes to the end of the contents of a file |
| `fileCreate` | FileCreateTransactionBody | Create a new file |
| `fileDelete` | FileDeleteTransactionBody | Delete a file (remove contents and mark as deleted until it expires) |
| `fileUpdate` | FileUpdateTransactionBody | Modify information such as the expiration date for a file |
| `systemDelete` | SystemDeleteTransactionBody | Hedera administrative deletion of a file or smart contract |
| `systemUndelete` | SystemUndeleteTransactionBody | To undelete an entity deleted by SystemDelete |
| `freeze` | FreezeTransactionBody | Freeze the nodes |
| `consensusCreateTopic` | ConsensusCreateTopicTransactionBody | Creates a topic |
| `consensusUpdateTopic` | ConsensusUpdateTopicTransactionBody | Updates a topic |
| `consensusDeleteTopic` | ConsensusDeleteTopicTransactionBody | Deletes a topic |
| `consensusSubmitMessage` | ConsensusSubmitMessageTransactionBody | Submits message to a topic |
| `uncheckedSubmit` | UncheckedSubmitBody | |
| `tokenCreation` | TokenCreateTransactionBody | Creates a token instance |
| `tokenTransfers` | TokenTransfersTransactionBody | Transfers tokens between accounts |
| `tokenFreeze` | TokenFreezeAccountTransactionBody | Freezes account not to be able to transact with a token |
| `tokenUnfreeze` | TokenUnfreezeAccountTransactionBody | Unfreezes account for a token |
| `tokenGrantKyc` | TokenGrantKycTransactionBody | Grants KYC to an account for a token |
| `tokenRevokeKyc` | TokenRevokeKycTransactionBody | Revokes KYC of an account for a token |
| `tokenDeletion` | TokenDeleteTransactionBody | Deletes a token instance |
| `tokenUpdate` | TokenUpdateTransactionBody | Updates a token instance |
| `tokenMint` | TokenMintTransactionBody | Mints new tokens to a token's treasury account |
| `tokenBurn` | TokenBurnTransactionBody | Burns tokens from a token's treasury account |
| `tokenWipe` | TokenWipeAccountTransactionBody | Wipes amount of tokens from an account |
| `tokenAssociate` | TokenAssociateTransactionBody | Associate tokens to an account |
| `tokenDissociate` | TokenDissociateTransactionBody | Dissociate tokens from an account |
| `token_fee_schedule_update` | TokenFeeScheduleUpdateTransactionBody | Updates a token's custom fee schedule |
| `token_pause` | TokenPauseTransactionBody | Pauses the Token |
| `token_unpause` | TokenUnpauseTransactionBody | Unpauses the Token |
| `scheduleCreate` | ScheduleCreateTransactionBody | Creates a scheduled transaction instance |
| `scheduleDelete` | ScheduleDeleteTransactionBody | Deletes a scheduled transaction instance |
| `scheduleSign` | ScheduleSignTransactionBody | Signs a scheduled transaction instance |
| `cryptoAdjustAllowance` | CryptoAdjustAllowanceTransactionBody | Adjusts the approved allowance for a spender to transfer the paying account's hbar or tokens |
| `cryptoApproveAllowance` | CryptoApproveAllowanceTransactionBody | Adds one or more approved allowances for spenders to transfer the paying account's hbar or tokens |
# TransactionGetFastRecord
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/transactiongetfastrecord
## TransactionGetFastRecordQuery
Get the tx record of a transaction, given its transaction ID. Once a transaction reaches consensus, then information about whether it succeeded or failed will be available until the end of the receipt period. Before and after the receipt period, and for a transaction that was never submitted, the receipt is unknown. This query is free (the payment field is left empty).
| Field | Type | Description |
| --------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `transactionID` | [TransactionID](/hedera/sdks-and-apis/hedera-api/basic-types/transactionid) | The ID of the transaction for which the record is requested. |
## TransactionGetFastRecordResponse
Response when the client sends the node TransactionGetFastRecordQuery. If it created a new entity (account, file, or smart contract instance) then one of the three ID fields will be filled in with the ID of the new entity. Sometimes a single transaction will create more than one new entity, such as when a new contract instance is created, and this also creates the new account that it owned by that instance.
| Field | Type | Description |
| ------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `transactionRecord` | [TransactionRecord](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionrecord) | The requested transaction records |
# TransactionGetReceipt
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/transactiongetreceipt
## TransactionGetReceiptQuery
Get the receipt of a transaction, given its transaction ID. Once a transaction reaches consensus, then information about whether it succeeded or failed will be available until the end of the receipt period. Before and after the receipt period, and for a transaction that was never submitted, the receipt is unknown. This query is free (the payment field is left empty). No State proof is available for this response
| Field | Type | Description |
| ------------------------ | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `transactionID` | [TransactionID](/hedera/sdks-and-apis/hedera-api/basic-types/transactionid) | The ID of the transaction for which the receipt is requested. |
| `includeDuplicates` | bool | Whether receipts of processing duplicate transactions should be returned along with the receipt of processing the first consensus transaction with the given id whose status was neither INVALID\_NODE\_ACCOUNT nor INVALID\_PAYER\_SIGNATURE; **or**, if no such receipt exists, the receipt of processing the first transaction to reach consensus with the given transaction id. |
| `include_child_receipts` | bool | Whether the response should include the receipts of any child transactions spawned by the top-level transaction with the given transactionID. |
## TransactionGetReceiptResponse
Response when the client sends the node TransactionGetReceiptQuery. If it created a new entity (account, file, or smart contract instance) then one of the three ID fields will be filled in with the ID of the new entity. Sometimes a single transaction will create more than one new entity, such as when a new contract instance is created, and this also creates the new account that it owned by that instance. No State proof is available for this response
| Field | Type | Description |
| ------------------------------ | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `receipt` | [TransactionReceipt](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionreceipt) | The receipt, indicating it reached consensus (and whether it succeeded or failed) or is currently unknown (because it hasn't reached consensus yet, or the transaction has expired already), and including the ID of any new account/file/instance created by that transaction. |
| `duplicateTransactionReceipts` | [TransactionReceipt](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactiongetreceipt) | The receipts of processing all transactions with the given id, in consensus time order. |
| `child_transaction_receipts` | repeated [TransactionReceipt](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactiongetreceipt) | The receipts (if any) of all child transactions spawned by the transaction with the given top-level id, in consensus order. Always empty if the top-level status is UNKNOWN. |
# TransactionGetRecord
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/transactiongetrecord
## TransactionGetRecordQuery
Get the record for a transaction. If the transaction requested a record, then the record lasts for one hour, and a state proof is available for it. If the transaction created an account, file, or smart contract instance, then the record will contain the ID for what it created. If the transaction called a smart contract function, then the record contains the result of that call. If the transaction was a cryptocurrency transfer, then the record includes the TransferList which gives the details of that transfer. If the transaction didn't return anything that should be in the record, then the results field will be set to nothing.
| Field | Type | Description |
| ----------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `transactionID` | [TransactionID](/hedera/sdks-and-apis/hedera-api/basic-types/transactionid) | The ID of the transaction for which the record is requested. |
| `includeDuplicates` | bool | Whether records of processing duplicate transactions should be returned along with the record of processing the first consensus transaction with the given id whose status was neither INVALID\_NODE\_ACCOUNT nor INVALID\_PAYER\_SIGNATURE; **or**, if no such record exists, the record of processing the first transaction to reach consensus with the given transaction id. |
| `include_child_records` | bool | Whether the response should include the records of any child transactions spawned by the \* top-level transaction with the given transactionID. |
## TransactionGetRecordResponse
Response when the client sends the node TransactionGetRecordQuery
| Field | Type | Description |
| ----------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither. |
| `transactionRecord` | [TransactionRecord](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionrecord) | The requested record |
| `duplicateTransactionRecords` | repeated [TransactionRecord](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionrecord) | The records of processing all consensus transaction with the same id as the distinguished record above, in chronological order. |
| `child_transaction_records` | repeated [TransactionRecord](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionrecord) | The records of processing all child transaction spawned by the transaction with the given \* top-level id, in consensus order. Always empty if the top-level status is UNKNOWN. |
# TransactionReceipt
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionreceipt
## TransactionReceipt
The summary of a transaction’s result so far. If the transaction has not reached consensus, this result will be necessarily incomplete.
| Field | Type | Description |
| ------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `status` | [ResponseCodeEnum](/hedera/sdks-and-apis/hedera-api/miscellaneous/responsecode) | The consensus status of the transaction; is UNKNOWN if consensus has not been reached, or if the associated transaction did not have a valid payer signature |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | In the receipt of a CryptoCreate, the id of the newly created account |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | In the receipt of a FileCreate, the id of the newly created file |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | In the receipt of a ContractCreate, the id of the newly created contract |
| `exchangeRate` | [ExchangeRateSet](/hedera/sdks-and-apis/hedera-api/miscellaneous/exchangerate) | The exchange rates in effect when the transaction reached consensus |
| `topicID` | [TopicID](/hedera/sdks-and-apis/hedera-api/basic-types/topicid) | In the receipt of a ConsensusCreateTopic, the id of the newly created topic. |
| `topicSequenceNumber` | uint64 | In the receipt of a ConsensusSubmitMessage, the new sequence number of the topic that received the message |
| `topicRunningHash` | bytes | In the receipt of a ConsensusSubmitMessage, the new running hash of the topic that received the message. This 48-byte field is the output of a particular SHA-384 digest whose input data are determined by the value of the topicRunningHashVersion. Please see table below. |
| `topicRunningHashVersion` | uint64 | In the receipt of a ConsensusSubmitMessage, the version of the SHA-384 digest used to update the running hash. |
| `tokenID` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | In the receipt of a CreateToken, the id of the newly created token |
| `scheduleID` | [ScheduleID](/hedera/sdks-and-apis/hedera-api/basic-types/scheduleid) | In the receipt of a CreateSchedule, the id of the newly created Scheduled Entity |
| `scheduledTransactionID` | [TransactionID](/hedera/sdks-and-apis/hedera-api/basic-types/transactionid) | In the receipt of a ScheduleCreate or ScheduleSign that resolves to SUCCESS, the TransactionID that should be used to query for the receipt or record of the relevant scheduled transaction |
| `serialNumbers` | repeated int64 | In the receipt of a TokenMint for tokens of type `NON_FUNGIBLE_UNIQUE`, the serial numbers of the newly created NFTs |
#### Topic Running Hash
The input data to the SHA-384 digest in order.
| topicRunningHashVersion | Input data to the SHA-384 digest in order |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 0 or 1 | 1. The previous running hash of the topic (48 bytes)
2. The topic's shard (8 bytes)
3. The topic's realm (8 bytes)
4. The topic's number (8 bytes)
5. The number of seconds since the epoch before the ConsensusSubmitMessage reached consensus (8 bytes)
6. The number of nanoseconds since 5. before the ConsensusSubmitMessage reached consensus (4 bytes)
7. The topicSequenceNumber from above (8 bytes)
8. The message bytes from the ConsensusSubmitMessage (variable).
|
| 2 | 1. The previous running hash of the topic (48 bytes)
2. The topicRunningHashVersion below (8 bytes)
3. The topic's shard (8 bytes)
4. The topic's realm (8 bytes)
5. The topic's number (8 bytes)
6. The number of seconds since the epoch before the ConsensusSubmitMessage reached consensus (8 bytes)
7. The number of nanoseconds since 6. before the ConsensusSubmitMessage reached consensus (4 bytes)
8. The topicSequenceNumber from above (8 bytes)
9. The output of the SHA-384 digest of the message bytes from the consensusSubmitMessage (48 bytes)
|
| 3 | 1. The previous running hash of the topic (48 bytes)
2. The topicRunningHashVersion below (8 bytes)
3. The payer account's shard (8 bytes)
4. The payer account's realm (8 bytes)
5. The payer account's number (8 bytes)
6. The topic's shard (8 bytes)
7. The topic's realm (8 bytes)
8. The topic's number (8 bytes)
9. The number of seconds since the epoch before the ConsensusSubmitMessage reached consensus (8 bytes)
10. The number of nanoseconds since 9. before the ConsensusSubmitMessage reached consensus (4 bytes)
11. The topicSequenceNumber from above (8 bytes)
12. The output of the SHA-384 digest of the message bytes from the consensusSubmitMessage (48 bytes)
|
# TransactionRecord
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionrecord
## repeated TokenAllowanceTransactionRecord
Response when the client sends the node TransactionGetRecordResponse
| Field | Type | Label | Description |
| ------------------------------ | ------------------------------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `receipt` | [TransactionReceipt](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionreceipt) | | The status (reach consensus, or failed, or is unknown) and the ID of any new account/file/instance created. |
| `transactionHash` | bytes | | The hash of the Transaction that executed (not the hash of any Transaction that failed for having a duplicate TransactionID) |
| `consensusTimestamp` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | | The consensus timestamp (or null if didn't reach consensus yet) |
| `transactionID` | [TransactionID](/hedera/sdks-and-apis/hedera-api/basic-types/transactionid) | | The ID of the transaction this record represents |
| `memo` | string | | The memo that was submitted as part of the transaction (max 100 bytes) |
| `transactionFee` | uint64 | | The actual transaction fee charged, not the original transactionFee value from TransactionBody |
| `contractCallResult` | ContractFunctionResult | | Record of the value returned by the smart contract function (if it completed and didn't fail) from ContractCallTransaction |
| `contractCreateResult` | ContractFunctionResult | | Record of the value returned by the smart contract constructor (if it completed and didn't fail) from ContractCreateTransaction |
| `transferList` | TransferList | | All hbar transfers as a result of this transaction, such as fees, or transfers performed by the transaction, or by a smart contract it calls, or by the creation of threshold records that it triggers. |
| `tokenTransferList` | [TokenTransferList](/hedera/sdks-and-apis/hedera-api/basic-types/tokentransferlist) | repeated | All Token transfers as a result of this transaction |
| `scheduleRef` | [ScheduleID](/hedera/sdks-and-apis/hedera-api/basic-types/scheduleid) | | Reference to the scheduled transaction ID that this transaction record represent |
| `assessedCustomFees` | [AssessedCustomFee](/hedera/sdks-and-apis/hedera-api/token-service/customfees/assessedcustomfee) | repeated | All custom fees that were assessed during a CryptoTransfer, and must be paid if the transaction status resolved to SUCCESS |
| `automatic_token_associations` | [TokenAssociation](/hedera/sdks-and-apis/hedera-api/token-service/tokenassociate) | repeated | All token associations implicitly created while handling this transaction |
| `parent_consensus_timestamp` | Timestamp | | In the record of an internal transaction, the consensus timestamp of the user transaction that spawned it. |
| `alias` | bytes | | In the record of an internal CryptoCreate transaction triggered by a user transaction with a (previously unused) alias, the new account's alias. |
# TransactionResponse
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse
When the client sends the node a transaction of any kind, the node replies with this, which simply says that the transaction passed the precheck (so the node will submit it to the network) or it failed (so it won't). To learn the consensus result, the client should later obtain a receipt (free), or can buy a more detailed record (not free).
| Field | Type | Description |
| ----------------- | --------------------------------------------------------------------------- | --------------------- |
| `nodeId` | [AccountId](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The node ID. |
| `transactionHash` | byte | The transaction hash. |
| `transactionId` | [TransactionId](/hedera/sdks-and-apis/hedera-api/basic-types/transactionid) | The transaction ID. |
# UncheckedSubmit
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/miscellaneous/uncheckedsubmit
Submit an arbitrary (serialized) Transaction to the network without prechecks. Requires superuser privileges.
## UncheckedSubmitBody
| Field | Type | Description |
| ------------------ | ----- | ------------------------------------------------------------------------- |
| `transactionBytes` | bytes | The serialized bytes of the Transaction to be submitted without prechecks |
# Schedule Service
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/schedule-service
# SchedulableTransactionBody
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/schedule-service/schedulabletransactionbody
A schedulable transaction. Note that the global/dynamic system property scheduling.whitelist controls which transaction types may be scheduled. In Consensus Node 0.13.0, it will include only CryptoTransfer and ConsensusSubmitMessage functions.
| Field | Type | Description |
| --------------------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `transactionFee` | uint64 | The maximum transaction fee the client is willing to pay |
| `memo` | string | A memo to include the execution record; the UTF-8 encoding may be up to 100 bytes and must not include the zero byte |
| **Oneof Data:** | | |
| `contractCall` | ContractCallTransactionBody | Calls a function of a contract instance |
| `contractCreateInstance` | ContractCreateTransactionBody | Creates a contract instance |
| `contractUpdateInstance` | ContractUpdateTransactionBody | Updates a contract |
| `contractDeleteInstance` | ContractDeleteTransactionBody | Delete contract and transfer remaining balance into specified account |
| `cryptoApproveAllowance` | CryptoApproveAllowanceTransactionBody | Adds one or more approved allowances for spenders to transfer the paying account's hbar or tokens. |
| `cryptoDeleteAllowance` | CryptoDeleteAllowanceTransactionBody | Deletes one or more NFT allowances from an owner's account |
| `cryptoCreateAccount` | CryptoCreateTransactionBody | Create a new cryptocurrency account |
| `cryptoDelete` | CryptoDeleteTransactionBody | Delete a cryptocurrency account (mark as deleted, and transfer hbars out) |
| `cryptoTransfer` | CryptoTransferTransactionBody | Transfer amount between accounts |
| `cryptoUpdateAccount` | CryptoUpdateTransactionBody | Modify information such as the expiration date for an account |
| `fileAppend` | FileAppendTransactionBody | Add bytes to the end of the contents of a file |
| `fileCreate` | FileCreateTransactionBody | Create a new file |
| `fileDelete` | FileDeleteTransactionBody | Delete a file (remove contents and mark as deleted until it expires) |
| `fileUpdate` | FileUpdateTransactionBody | Modify information such as the expiration date for a file |
| `systemDelete` | SystemDeleteTransactionBody | Hedera administrative deletion of a file or smart contract |
| `systemUndelete` | SystemUndeleteTransactionBody | To undelete an entity deleted by SystemDelete |
| `freeze` | FreezeTransactionBody | Freeze the nodes |
| `consensusCreateTopic` | ConsensusCreateTopicTransactionBody | Creates a topic |
| `consensusUpdateTopic` | ConsensusUpdateTopicTransactionBody | Updates a topic |
| `consensusDeleteTopic` | ConsensusDeleteTopicTransactionBody | Deletes a topic |
| `consensusSubmitMessage` | ConsensusSubmitMessageTransactionBody | Submits message to a topic |
| `tokenCreation` | TokenCreateTransactionBody | Creates a token instance |
| `tokenFreeze` | TokenFreezeAccountTransactionBody | Freezes account not to be able to transact with a token |
| `tokenUnfreeze` | TokenUnfreezeAccountTransactionBody | Unfreezes account for a token |
| `tokenGrantKyc` | TokenGrantKycTransactionBody | Grants KYC to an account for a token |
| `tokenRevokeKyc` | TokenRevokeKycTransactionBody | Revokes KYC of an account for a token |
| `tokenDeletion` | TokenDeleteTransactionBody | Deletes a token instance |
| `tokenUpdate` | TokenUpdateTransactionBody | Updates a token instance |
| `tokenMint` | TokenMintTransactionBody | Mints new tokens to a token's treasury account |
| `tokenBurn` | TokenBurnTransactionBody | Burns tokens from a token's treasury account |
| `tokenWipe` | TokenWipeAccountTransactionBody | Wipes amount of tokens from an account |
| `tokenAssociate` | TokenAssociateTransactionBody | Associate tokens to an account |
| `tokenDissociate` | TokenDissociateTransactionBody | Dissociate tokens from an account |
| `token_pause` | TokenPauseTransactionBody | Pauses the Token |
| `token_unpause` | TokenUnpauseTransactionBody | Unpauses the Token |
| `scheduleDelete` | ScheduleDeleteTransactionBody | Marks a schedule in the network's action queue as deleted, preventing it from executing |
| `token_fee_schedule_update` | TokenFeeScheduleUpdateTransactionBody | Updates a token's custom fee schedule |
| `cryptoAdjustAllowance` | CryptoAdjustAllowanceTransactionBody | Adjusts the approved allowance for a spender to transfer the paying account's hbar or tokens |
| `cryptoApproveAllowance` | CryptoApproveAllowanceTransactionBody | Adds one or more approved allowances for spenders to transfer the paying account's hbar or tokens |
# ScheduleCreate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/schedule-service/schedulecreate
Create a new schedule entity (or simply, \schedule\) in the network's action queue. Upon SUCCESS, the receipt contains the \`ScheduleID\` of the created schedule. A schedule entity includes a scheduledTransactionBody to be executed when the schedule has collected enough signing Ed25519 keys to satisfy the scheduled transaction's signing requirements. Upon \`SUCCESS\`, the receipt also includes the scheduledTransactionID to use to query for the record of the scheduled transaction's execution (if it occurs).
The expiration time of a schedule is always 30 minutes; it remains in state and can be queried using GetScheduleInfo until expiration, no matter if the scheduled transaction has executed or marked deleted.
If the adminKey field is omitted, the resulting schedule is immutable. If the adminKey is set, the ScheduleDelete transaction can be used to mark it as deleted. The creator may also specify an optional memo whose UTF-8 encoding is at most 100 bytes and does not include the zero byte is also supported.
When a scheduled transaction whose schedule has collected enough signing keys is executed, the network only charges its payer the service fee, and not the node and network fees. If the optional payerAccountID is set, the network charges this account. Otherwise it charges the payer of the originating ScheduleCreate.
Two ScheduleCreate transactions are identical if they are equal in all their fields other than payerAccountID. (Here "equal" should be understood in the sense of gRPC object equality in the network software runtime. In particular, a gRPC object with [unknown fields](https://developers.google.com/protocol-buffers/docs/proto3#unknowns) is not equal to a gRPC object without unknown fields, even if they agree on all known fields.)
A ScheduleCreate transaction that attempts to re-create an identical schedule already in state will receive a receipt with status
IDENTICAL\_SCHEDULE\_ALREADY\_CREATED; the receipt will include the ScheduleID of the extant schedule, which may be used in a subsequent ScheduleSign transaction. (The receipt will also include the TransactionID to use in querying or the receipt or record of the scheduled transaction.)
Other notable response codes include, INVALID\_ACCOUNT\_ID, UNSCHEDULABLE\_TRANSACTION, UNRESOLVABLE\_REQUIRED\_SIGNER, INVALID\_SIGNATURE.
## ScheduleCreateTransactionBody
| Field | Type | Description |
| ---------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SchedulableTransactionBody` | scheduledTransactionBody | The scheduled transaction |
| `adminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | An optional Hedera key which can be used to sign a ScheduleDelete and remove the schedule |
| `payerAccountId` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | An optional id of the account to be charged the service fee for the scheduled transaction at the consensus time that it executes (if ever); defaults to the ScheduleCreate payer if not give |
| `memo` | string | An optional memo with a UTF-8 encoding of no more than 100 bytes which does not contain the zero byte |
# ScheduleDelete
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/schedule-service/scheduledelete
Marks a schedule in the network's action queue as deleted. Must be signed by the admin key of the target schedule. A deleted schedule cannot receive any additional signing keys, nor will it be executed.
Other notable response codes include, INVALID\_SCHEDULE\_ID, SCHEDULE\_WAS\_DELETED, SCHEDULE\_WAS\_EXECUTED, SCHEDULE\_IS\_IMMUTABLE. For more information please see the section of this documentation on the ResponseCode enum.
## ScheduleDeleteTransactionBody
| Field | Type | Description |
| ------------ | --------------------------------------------------------------------- | ------------------------------ |
| `scheduleID` | [ScheduleID](/hedera/sdks-and-apis/hedera-api/basic-types/scheduleid) | The ID of the Scheduled Entity |
# ScheduleGetInfo
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/schedule-service/schedulegetinfo
Gets information about a schedule in the network's action queue. Responds with INVALID\_SCHEDULE\_ID if the requested schedule doesn't exist.
## ScheduleGetInfoQuery
| Field | Type | Description |
| ------------ | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `scheduleID` | [ScheduleID](/hedera/sdks-and-apis/hedera-api/basic-types/scheduleid) | The ID of the Scheduled Entity |
## ScheduleInfo
Information summarizing schedule state.
| Field | Type | Description |
| -------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `scheduleID` | [ScheduleID](/hedera/sdks-and-apis/hedera-api/basic-types/scheduleid) | The id of the schedule |
| `creatorAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The id of the account responsible for the service fee of the scheduled transaction |
| `payerAccountIDAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account which is going to pay for the execution of the scheduled transaction |
| `scheduledTransactionBody` | [SchedulableTransactionBody](/hedera/sdks-and-apis/hedera-api/schedule-service/schedulabletransactionbody) | The scheduled transaction |
| `signers` | [KeyList](/hedera/sdks-and-apis/hedera-api/basic-types/keylist) | The Ed25519 keys the network deems to have signed the scheduled transaction |
| `adminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The key used to delete the schedule from state |
| `memo` | string | The publicly visible memo of the schedule |
| `expirationTime` | [TimeStamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | The epoch second at which the schedule will expire |
| `scheduledTransactionID` | [TransactionID](/hedera/sdks-and-apis/hedera-api/basic-types/transactionid) | The transaction id that will be used in the record of the scheduled transaction (if it executes) |
| `ledger_id` | bytes | The ledger ID the response was returned from; please see [HIP-198](https://github.com/hashgraph/hedera-improvement-proposal/blob/master/HIP/hip-198.md) for the network-specific IDs |
| **`oneof data`** : | | |
| `deletion_time` | [TimeStamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | If the schedule has been deleted, the consensus time when this occurred |
| `execution_time` | [TimeStamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | If the schedule has been executed, the consensus time when this occurred |
## ScheduleGetInfoResponse
Response wrapper for the ScheduleInfo.
| Field | Type | Description |
| -------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither. |
| `scheduleInfo` | [ScheduleInfo](#scheduleinfo) | The information requested about this schedule instance |
# ScheduleService
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/schedule-service/scheduleservice
## Transactions and queries for the Schedule Service
The Schedule Service allows transactions to be submitted without all the required signatures and allows anyone to provide the required signatures independently after a transaction has already been created.
**Execution:**
Scheduled Transactions are executed once all required signatures are collected and witnessed. Every time new signature is provided, a check is performed on the "readiness" of the execution.
The Scheduled Transaction will be executed immediately after the transaction that triggered it and will be externalized in a separate Transaction Record.
**Transaction Record:**
The timestamp of the Scheduled Transaction will be equal to consensusTimestamp + 1 nano, where consensusTimestamp is the timestamp of the transaction that triggered the execution.
The Transaction ID of the Scheduled Transaction will have the scheduled property set to true and inherit the transactionValidStart and accountID from the ScheduleCreate transaction.
The scheduleRef property of the transaction record will be populated with the ScheduleID of the Scheduled Transaction.
**Post execution:**
Once a given Scheduled Transaction executes, it will be removed from the ledger and any upcoming operation referring the ScheduleID will resolve to INVALID\_SCHEDULE\_ID.
**Expiry:**
Scheduled Transactions have a global expiry time txExpiryTimeSecs (Currently set to 30 minutes). If txExpiryTimeSecs pass and the Scheduled Transaction haven't yet executed, it will be removed from the ledger as if ScheduleDelete operation is executed.
## ScheduleService
| RPC | Request | Response | Comments |
| ----------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| `createSchedule` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Creates a new Schedule by submitting the transaction |
| `signSchedule` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Signs a new Schedule by submitting the transaction |
| `deleteSchedule` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Deletes a new Schedule by submitting the transaction |
| `getScheduleInfo` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the metadata of a schedule entity |
# ScheduleSign
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/schedule-service/schedulesign
Adds zero or more signing keys to a schedule. If the resulting set of signing keys satisfy the scheduled transaction's signing requirements, it will be executed immediately after the triggering ScheduleSign.
Upon SUCCESS, the receipt includes the scheduledTransactionID to use to query for the record of the scheduled transaction's execution (if it occurs).
Other notable response codes include INVALID\_SCHEDULE\_ID, SCHEDULE\_WAS\_DELETED, INVALID\_ACCOUNT\_ID, UNRESOLVABLE\_REQUIRED\_SIGNERS, SOME\_SIGNATURES\_WERE\_INVALID, and NO\_NEW\_VALID\_SIGNATURES. For more information please see the section of this documentation on the ResponseCode enum.
## ScheduleSignTransactionBody
| Field | Type | Description |
| ------------ | --------------------------------------------------------------------- | ------------------------------ |
| `scheduleID` | [ScheduleID](/hedera/sdks-and-apis/hedera-api/basic-types/scheduleid) | The ID of the Scheduled Entity |
# Smart Contracts
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/smart-contracts
# ContractCall
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/smart-contracts/contractcall
## **ContractCallTransactionBody**
Call a function of the given smart contract instance, giving it functionParameters as its inputs. The call can use at maximum the given amount of gas – the paying account will not be charged for any unspent gas.
If this function results in data being stored, an amount of gas is calculated that reflects this storage burden.
The amount of gas used, as well as other attributes of the transaction, e.g. size, number of signatures to be verified, determine the fee for the transaction – which is charged to the paying account.
| Field | Type | Description |
| -------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The contract instance to call |
| `gas` | int64 | The maximum amount of gas to use for the call |
| `amount` | int64 | Number of tinybars sent (the function must be payable if this is nonzero) |
| `functionParameters` | bytes | Which function to call, and the parameters to pass to the function |
# ContractCallLocal
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/smart-contracts/contractcalllocal
## **ContractCallLocalQuery**
Call a function of the given smart contract instance, giving it functionParameters as its inputs. It will consume the entire given amount of gas.
| Field | Type | Description |
| -------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). The payment must cover the fees and all of the gas offered. |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The contract to make a static call against |
| `gas` | int64 | The amount of gas to use for the call. All of the gas offered will be charged for. |
| `functionParameters` | bytes | Which function to call, and the parameters to pass to the function |
| `maxResultSize` | int64 | Max number of bytes that the result might include. The run will fail if it would have returned more than this number of bytes. **\[deprecated 0.20.0]** |
## ContractCallLocalResponse
Response when the client sends the node ContractCallLocalQuery
| Field | Type | Description |
| ---------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `functionResult` | ContractFunctionResult | the value returned by the function (if it completed and didn't fail) |
## ContractFunctionResult
The result returned by a call to a smart contract function. This is part of the response to a ContractCallLocal query, and is in the record for a ContractCall or ContractCreateInstance transaction. The ContractCreateInstance transaction record has the results of the call to the constructor.
| Field | Type | Description |
| -------------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The smart contract instance whose function was called |
| `contractCallResult` | bytes | The result returned by the function |
| `errorMessage` | string | The message in case there was an error during smart contract execution |
| `bloom` | bytes | Bloom filter for record |
| `gasUsed` | uint64 | Units of gas used to execute contract |
| `logInfo` | [ContractLoginfo](#contractloginfo) | The log info for events returned by the function |
| `createdContractIDs` | repeated [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The list of smart contracts that were created by the function call \[deprecated] |
| `stateChanges` | repeated [ContractStateChange](#contractstatechanges) | The list of state reads and changes caused by this function call |
| `evm_address` | bytes | The 20-byte EVM address of the contract to call. Only populated after release 0.23, where each created contract will have its own record. There will be seperate chld record for each created contract.
Every contract has an EVM address determined by its shard.realm.num id. This address is as follows:
The first 4 bytes are the big-endian representation of the shard.
The next 8 bytes are the big-endian representation of the realm.
The final 8 bytes are the big-endian representation of the number.
Contracts created via CREATE2 have an additional, primary address that is derived from the EIP-1014 specification, and does not have a simple relation to a shard.realm.num id.
(Please do note that CREATE2 contracts can also be referenced by the three-part EVM address described above.)
|
| `gas` | int64 | The amount of gas available for the call, aka the gasLimit. This field should only be populated when the paired TransactionBody in the record stream is not a ContractCreateTransactionBody or a ContractCallTransactionBody. |
| `amount` | int64 | Number of tinybars sent (the function must be payable if this is nonzero). This field should only be populated when the paired TransactionBody in the record stream is not a ContractCreateTransactionBody or a ContractCallTransactionBody. |
| `functionParameters` | bytes | The parameters passed into the contract call. This field should only be populated when the paired TransactionBody in the record stream is not a ContractCreateTransactionBody or a ContractCallTransactionBody. |
| `signerNonce` | int64 | The value of the signer account nonce. This value can be null. |
## ContractLoginfo
The log information for an event returned by a smart contract function call. One function call may return several such events.
| Field | Type | Description |
| ------------ | --------------------------------------------------------------------- | -------------------------------------------- |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | Address of a contract that emitted the event |
| `bloom` | bytes | Bloom filter for a particular log |
| `topic` | repeated bytes | Topics of a particular event |
| `data` | bytes | Event data |
## ContractStateChange
The storage changes to a smart contract's storage as a side effect of the function call.
| Field | Type | Description |
| ---------------- | --------------------------------------------------------------------- | -------------------------------------------------- |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The contract to which the storage changes apply to |
| `storageChanges` | repeated [StorageChange](#storagechange) | The list of storage changes |
## StorageChange
A storage slot change description.
| Field | Type | Description |
| -------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `slot` | bytes | The storage slot changed. Up to 32 bytes, big-endian, zero bytes left trimmed |
| `valueRead` | bytes | The value read from the storage slot. Up to 32 bytes, big-endian, zero bytes left trimmed. Because of the way SSTORE operations are charged the slot is always read before being written to |
| `valueWritten` | google.protobuf.BytesValue | The new value written to the slot. Up to 32 bytes, big-endian, zero bytes left trimmed. If a value of zero is written the valueWritten will be present but the inner value will be absent. If a value was read and not written this value will not be present. |
# ContractCreate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/smart-contracts/contractcreate
## ContractCreateTransactionBody
Start a new smart contract instance. After the instance is created, the ContractID for it is in the receipt, or can be retrieved with a GetByKey query, or by asking for a Record of the transaction to be created, and retrieving that. The instance will run the bytecode stored in the given file, referenced either by FileID or by the transaction ID of the transaction that created the file. The constructor will be executed using the given amount of gas, and any unspent gas will be refunded to the paying account. Constructor inputs come from the given constructorParameters.
| Field | Type | Description |
| ----------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | the file containing the smart contract byte code. A copy will be made and held by the contract instance, and have the same expiration time as the instance. The file is referenced one of two ways: |
| `adminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | the state of the instance and its fields can be modified arbitrarily if this key signs a transaction to modify it. If this is null, then such modifications are not possible, and there is no administrator that can override the normal operation of this smart contract instance. Note that if it is created with no admin keys, then there is no administrator to authorize changing the admin keys, so there can never be any admin keys for that instance. |
| `gas` | int64 | gas to run the constructor |
| `initialBalance` | int64 | initial number of tinybars to put into the cryptocurrency account associated with and owned by the smart contract |
| `proxyAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | ID of the account to which this account is proxy staked. If proxyAccountID is null, or is an invalid account, or is an account that isn't a node, then this account is automatically proxy staked to a node chosen by the network, but without earning payments. If the proxyAccountID account refuses to accept proxy staking , or if it is not currently running a node, then it will behave as if proxyAccountID was null. |
| `autoRenewPeriod` | [Duration](/hedera/sdks-and-apis/hedera-api/miscellaneous/duration) | the instance will charge its account every this many seconds to renew for this long |
| `constructorParameters` | bytes | parameters to pass to the constructor |
| `shardID` | [ShardID](/hedera/sdks-and-apis/hedera-api/basic-types/shardid) | shard in which to create this |
| `realmID` | [RealmID](/hedera/sdks-and-apis/hedera-api/basic-types/realmid) | realm in which to create this (leave this null to create a new realm) |
| `newRealmAdminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | if realmID is null, then this the admin key for the new realm that will be created |
| `memo` | string | the memo that was submitted as part of the contract (max 100 bytes) |
###
# ContractDelete
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/smart-contracts/contractdelete
## **ContractDeleteTransactionBody**
Delete a smart contract.
| Field | Type | Description |
| -------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------- |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The Contract ID instance to delete (this can't be changed) |
| `obtainers` | | |
| **one of:** | | |
| `transferAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account ID which will receive all remaining hbars |
| `transferContractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The contract ID which will receive all remaining hbars |
# ContractGetByteCode
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/smart-contracts/contractgetbytecode
## ContractGetBytecodeQuery
Get the bytecode for a smart contract instance
| Field | Type | Description |
| ------------ | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | the contract for which information is requested |
## ContractGetBytecodeResponse
Response when the client sends the node ContractGetBytecodeQuery
| Field | Type | Description |
| ---------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `bytecode` | bytes | the bytecode |
# ContractGetInfo
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/smart-contracts/contractgetinfo
## ContractGetInfoQuery
Get information about a smart contract instance. This includes the account that it uses, the file containing its bytecode, and the time when it will expire.
| Field | Type | Description |
| ------------ | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | the contract for which information is requested |
## ContractGetInfoResponse
Response when the client sends the node ContractGetInfoQuery
| Field | Type | Description |
| -------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `contractInfo` | [ContractGetInfoResponse.ContractInfo](#contractgetinforesponse-contractinfo) | the information about this contract instance (a state proof can be generated for this) |
## ContractGetInfoResponse.ContractInfo
Response when the client sends the node ContractGetInfoQuery
| Field | Type | Description |
| -------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | ID of the contract instance, in the format used in transactions |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | ID of the cryptocurrency account owned by the contract instance, in the format used in transactions |
| `contractAccountID` | String | ID of both the contract instance and the cryptocurrency account owned by the contract instance, in the format used by Solidity |
| `adminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The state of the instance and its fields can be modified arbitrarily if this key signs a transaction to modify it. If this is null, then such modifications are not possible, and there is no administrator that can override the normal operation of this smart contract instance. Note that if it is created with no admin keys, then there is no administrator to authorize changing the admin keys, so there can never be any admin keys for that instance. |
| `expirationTime` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | The current time at which this contract instance (and its account) is set to expire |
| `autoRenewPeriod` | [Duration](/hedera/sdks-and-apis/hedera-api/miscellaneous/duration) | The expiration time will extend every this many seconds. If there are insufficient funds, then it extends as long as possible. If the account is empty when it expires, then it is deleted. |
| `storage` | uint64 | Number of bytes of storage being used by this instance (which affects the cost to extend the expiration time) |
| `memo` | String | The memo associated with the contract (max 100 bytes) |
| `balance` | uint64 | The current balance, in tinybars |
| `deleted` | bool | Whether the contract has been deleted |
| `tokenRelationships` | repeated [TokenRelationship](/hedera/sdks-and-apis/hedera-api/basic-types/tokenrelationship) | The tokens associated to the contract |
| `ledger_id` | bytes | The ledger ID the response was returned from; please see [HIP-198](https://hips.hedera.com/hip/hip-198) for the network-specific IDs |
# ContractGetRecords
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/smart-contracts/contractgetrecords
## ContractGetRecordsQuery
Get all the records for a smart contract instance, for any function call (or the constructor call) during the last 25 hours, for which a Record was requested.
| Field | Type | Description |
| ------------ | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The smart contract instance for which the records should be retrieved |
## ContractGetRecordsResponse
Response when the client sends the node ContractGetRecordsQuery
| Field | Type | Description |
| ------------ | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The smart contract instance that this record is for |
| `records` | [TransactionRecord](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionrecord) | List of records, each with contractCreateResult or contractCallResult as its body |
# ContractUpdate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/smart-contracts/contractupdate
## ContractUpdateTransactionBody
Modify a smart contract instance to have the given parameter values. Any null field is ignored (left unchanged). If only the `contractInstanceExpirationTime` is being modified, then no signature is needed on this transaction other than for the account paying for the transaction itself. But if any of the other fields are being modified, then it must be signed by the `adminKey`. The use of `adminKey` is not currently supported in this API, but in the future will be implemented to allow these fields to be modified, and also to make modifications to the state of the instance. If the contract is created with no admin key, then none of the fields can be changed that need an admin signature, and therefore no admin key can ever be added. The `adminKey` can be used to add flexibility to the management of smart contract behavior, but this is optional. If the smart contract is created without an `adminKey`, then such a key can never be added, and none of the fields can be changed that need an admin signature.
| Field | Type | Description |
| ----------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `contractID` | [ContractID](/hedera/sdks-and-apis/hedera-api/basic-types/contractid) | The Contract ID instance to update (this can't be changed) |
| `expirationTime` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | Extend the expiration of the instance and its account to this time (no effect if it already is this time or later) |
| `adminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The state of the instance can be modified arbitrarily if this key signs a transaction to modify it. If this is null, then such modifications are not possible, and there is no administrator that can override the normal operation of this smart contract instance. |
| `proxyAccountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | ID of the account to which this account is proxy staked. If proxyAccountID is null, or is an invalid account, or is an account that isn't a node, then this account is automatically proxy staked to a node chosen by the network, but without earning payments. If the proxyAccountID account refuses to accept proxy staking , or if it is not currently running a node, then it will behave as if proxyAccountID was null. |
| `autoRenewPeriod` | [Duration](/hedera/sdks-and-apis/hedera-api/miscellaneous/duration) | The instance will charge its account every this many seconds to renew for this long |
| `fileID` | [FileID](/hedera/sdks-and-apis/hedera-api/basic-types/fileid) | The file ID of file containing the smart contract byte code. A copy will be made and held by the contract instance, and have the same expiration time as the instance. **\[deprecated 0.20.0]** |
| `memo` | string | The memo associated with the contract (max 100 bytes) |
# SmartContractService
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/smart-contracts/smartcontractservice
| RPC | Request | Response | Comments |
| ------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| `createContract` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Creates a contract |
| `updateContract` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Updates a contract with the content |
| `contractCallMethod` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Calls a contract |
| `getContractInfo` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the contract information |
| `contractCallLocalMethod` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Calls a smart contract to be run on a single node |
| `ContractGetBytecode` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the byte code of a contract |
| `getBySolidityID` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves a contract by its Solidity address |
| `getTxRecordByContractID` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the 25-hour records stored for a contract |
| `deleteContract` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Deletes a contract instance and transfers any remaining hbars to a specified receiver |
| `systemDelete` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Deletes a contract if the submitting account has network admin privileges |
| `systemUndelete` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Undeletes a contract if the submitting account has network admin privileges |
# Token Service
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service
# CustomFees
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/customfees
# AssessedCustomFee
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/customfees/assessedcustomfee
A custom transfer fee that was assessed during the handling of a CryptoTransfer.
| Field | Type | Description |
| ---------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `amount` | int64 | The number of units assessed for the fee |
| `token_id` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The denomination of the fee; taken as hbar if left unset |
| `fee_collector_account_id` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account to receive the assessed fee |
| `effective_payer_account_id` | repeated [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account(s) whose final balances would have been higher in the absence of this assessed fee |
# CustomFee
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/customfees/customfee
A transfer fee to assess during a CryptoTransfer that transfers units of the token to which the fee is attached. A custom fee may be either fixed or fractional, and must specify a fee collector account to receive the assessed fees. Only positive fees may be assessed.
| Field | Type | Description |
| -------------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------- |
| one of fee `{` | | |
| `fixed_fee` | [FixedFee](/hedera/sdks-and-apis/hedera-api/token-service/customfees/fixedfee) | Fixed fee to be charged |
| `fractional_fee` | [FractionalFee](/hedera/sdks-and-apis/hedera-api/token-service/customfees/fractionalfee) | Fractional fee to be charged |
| `royalty_fee` | [RoyaltyFee](/hedera/sdks-and-apis/hedera-api/token-service/customfees/royaltyfee) | Royalty fee to be charged |
| `}` | | |
| `fee_collector_account_id` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account to receive the custom fee |
# FixedFee
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/customfees/fixedfee
A fixed number of units (hbar or token) to assess as a fee during a CryptoTransfer that transfers units of the token to which this fixed fee is attached.
| Field | Type | Description |
| ----------------------- | --------------------------------------------------------------- | -------------------------------------------------------- |
| `amount` | int64 | The number of units to assess as a fee |
| `denominating_token_id` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The denomination of the fee; taken as hbar if left unset |
# FractionalFee
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/customfees/fractionalfee
A fraction of the transferred units of a token to assess as a fee. The amount assessed will never be less than the given minimum\_amount, and never greater than the given maximum\_amount. The denomination is always units of the token to which this fractional fee is attached.
| Field | Type | Description |
| ------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `fractional_amount` | [Fraction](/hedera/sdks-and-apis/hedera-api/basic-types/fraction) | The fraction of the transferred units to assess as a fee |
| `minimum_amount` | int64 | The minimum amount to assess |
| `maximum_amount` | int64 | The maximum amount to assess (zero implies no maximum) |
| `net_of_transfers` | bool | If true, assesses the fee to the sender, so the receiver gets the full amount from the token transfer list, and the sender is charged an additional fee; if false, the receiver does NOT get the full amount, but only what is left over after paying the fractional fee |
# RoyaltyFee
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/customfees/royaltyfee
A fee to assess during a CryptoTransfer that changes ownership of an NFT. Defines the fraction of the fungible value exchanged for an NFT that the ledger should collect as a royalty. ("Fungible value" includes both ℏ and units of fungible HTS tokens.) When the NFT sender does not receive any fungible value, the ledger will assess the fallback fee, if present, to the new NFT owner. Royalty fees can only be added to tokens of type `NON_FUNGIBLE_UNIQUE`.
| Field | Type | Description |
| ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------- |
| `exchange_value_fraction` | Fraction | The fraction of fungible value exchanged for an NFT to collect as royalty |
| `fallback_fee` | FixedFee | If present, the fixed fee to assess to the NFT receiver when no fungible value is exchanged with the sender |
# TokenAssociate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenassociate
Associates the provided account with the provided tokens. Must be signed by the provided Account's key.
If the provided account is not found, the transaction will resolve to `INVALID_ACCOUNT_ID`.
If the provided account has been deleted, the transaction will resolve to `ACCOUNT_DELETED`.
If any of the provided tokens is not found, the transaction will resolve to `INVALID_TOKEN_REF`.
If any of the provided tokens has been deleted, the transaction will resolve to `TOKEN_WAS_DELETED`.
If an association between the provided account and any of the tokens already exists, the transaction will resolve to `TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT`.
If the provided account's associations count exceeds the constraint of maximum token associations per account, the transaction will resolve to `TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED`.
On success, associations between the provided account and tokens are made and the account is ready to interact with the tokens.
## TokenAssociateTransactionBody
| Field | Type | Description |
| --------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account to be associated with the provided tokens |
| `tokens` | repeated [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The tokens to be associated with the provided account. In the case of `NON_FUNGIBLE_UNIQUE` Type, once an account is associated, it can hold any number of NFTs (serial numbers) of that token type. |
# TokenBurn
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenburn
Burns tokens from the Token's treasury Account. If no Supply Key is defined, the transaction will resolve to `TOKEN_HAS_NO_SUPPLY_KEY`.
The operation decreases the Total Supply of the Token. Total supply cannot go below zero.
The amount provided must be in the lowest denomination possible. Example:
Token A has 2 decimals. In order to burn 100 tokens, one must provide amount of 10000. In order to burn 100.55 tokens, one must provide amount of 10055.
## TokenBurnTransactionBody
| Field | Type | Description |
| --------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token for which to burn tokens. If token does not exist, transaction results in INVALID\_TOKEN\_ID |
| `amount` | uint64 | The amount to burn from the Treasury Account. Amount must be a positive non-zero number, not bigger than the token balance of the treasury account (0; balance], represented in the lowest denomination. |
| `serialNumbers` | repeated int64 | Applicable to tokens of type `NON_FUNGIBLE_UNIQUE`. The list of serial numbers to be burned. |
# TokenCreate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokencreate
Create a new token. After the token is created, the Token ID for it is in the receipt.
The specified Treasury Account is receiving the initial supply of tokens as-well as the tokens from the Token Mint operation once executed. The balance of the treasury account is decreased when the Token Burn operation is executed.
The `initialSupply` is the initial supply of the smallest parts of tokens (like a tinybar, not an hbar).The supply that is going to be put in circulation is going to be the initial supply provided.
The supply can change over time. If the total supply at some moment is `S` parts of tokens, and the token is using `D` decimals, then `S` must be less than or equal to `2^63-1`, which is `9,223,372,036,854,775,807`. The number of whole tokens (not parts) will `S / 10^D`.
If `decimals` is 8 or 11, then the number of whole tokens can be at most a few billions or millions, respectively. For example, it could match Bitcoin (21 million whole tokens with 8 decimals) or hbars (50 billion whole tokens with 8 decimals). It could even match Bitcoin with milli-satoshis (21 million whole tokens with 11 decimals). (ed
Example:
Token A has an initial supply set to 10\_000 and decimals set to 2. The tokens that will be put into circulation are going be 100.
Token B has an initial supply set to 10\_012\_345\_678 and decimals set to 8. The number of tokens that will be put into circulation are going to be 100.12345678
Creating immutable token: Token can be created as immutable if the adminKey is omitted. In this case, the name, symbol, treasury, management keys, expiry and renew properties cannot be updated. If a token is created as immutable, anyone is able to extend the expiry time by paying the fee.
## TokenCreateTransactionBody
| Field | Type | Description | Signature Required |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| `name` | string | The publicly visible name of the token. The token name is specified as a Unicode string. Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). | N/A |
| `symbol` | string | The publicly visible token symbol. The token symbol is specified as a Unicode string. Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). | N/A |
| `decimals` | uint32 | For tokens of type `FUNGIBLE_COMMON` - the number of decimal places a token is divisible by. For tokens of type `NON_FUNGIBLE_UNIQUE` - value must be 0. | N/A |
| `initialSupply` | uint64 | Specifies the initial supply of tokens to be put in circulation. The initial supply is sent to the Treasury Account. The supply is in the lowest denomination possible. Maximum supply of tokens:`9,223,372,036,854,775,807` . In the case for `NON_FUNGIBLE_UNIQUE` Type the value must be 0 | N/A |
| `treasury` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account which will act as a treasury for the token. This account will receive the specified initial supply or the newly minted NFTs in the case for `NON_FUNGIBLE_UNIQUE` Type. | Required |
| `adminKey` | [Key](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | The key which can perform update/delete operations on the token. If empty, the token can be perceived as immutable (not being able to be updated/deleted) | If set, required |
| `kycKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The key which can grant or revoke KYC of an account for the token's transactions. If empty, KYC is not required, and KYC grant or revoke operations are not possible. | If set, required |
| `freezeKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The key which can sign to freeze or unfreeze an account for token transactions. If empty, freezing is not possible | If set, required |
| `wipeKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The key which can wipe the token balance of an account. If empty, wipe is not possible | If set, required |
| `supplyKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The key which can change the supply of a token. The key is used to sign Token Mint/Burn operations | If set, required |
| `freezeDefault` | bool | The default Freeze status (frozen or unfrozen) of Hedera accounts relative to this token. If true, an account must be unfrozen before it can receive the token | N/A |
| `expiry` | uint64 | The epoch second at which the token should expire; if an auto-renew account and period are specified, this is coerced to the current epoch second plus the autoRenewPeriod | N/A |
| `autoRenewAccount` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | An account which will be automatically charged to renew the token's expiration, at autoRenewPeriod interval | N/A |
| `autoRenewPeriod` | uint64 | The interval at which the auto-renew account will be charged to extend the token's expiry | N/A |
| `memo` | string | The memo associated with the token (UTF-8 encoding max 100 bytes)N/A | N/A |
| `tokenType` | [TokenType](/hedera/sdks-and-apis/hedera-api/basic-types/tokentype) | IWA compatibility. Specifies the token type. Defaults to `FUNGIBLE_COMMON` | N/A |
| `supplyType` | [TokenSupplyType](/hedera/sdks-and-apis/hedera-api/basic-types/tokensupplytype) | IWA compatibility. Specified the token supply type. Defaults to `INFINITE` | N/A |
| `maxSupply` | int64 | IWA Compatibility. Depends on TokenSupplyType. For tokens of type `FUNGIBLE_COMMON` - the maximum number of tokens that can be in circulation. For tokens of type `NON_FUNGIBLE_UNIQUE` - the maximum number of NFTs (serial numbers) that can be minted. This field can never be changed | N/A |
| `feeScheduleKey` | Key | The key which can change the token's custom fee schedule; must sign a TokenFeeScheduleUpdate transaction | N/A |
| `customFees` | repeated CustomFee | The custom fees to be assessed during a CryptoTransfer that transfers units of this token | N/A |
| `pause_key` | Key | The Key which can pause and unpause the Token. If Empty the token pause status defaults to PauseNotApplicable, otherwise Unpaused | N/A |
# TokenDelete
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokendelete
Marks a token as deleted, though it will remain in the ledger.
The operation must be signed by the specified Admin Key of the Token. If admin key is not set, Transaction will result in `TOKEN_IS_IMMUTABlE`.
Once deleted update, mint, burn, wipe, freeze, unfreeze, grant kyc, revoke kyc and token transfer transactions will resolve to `TOKEN_WAS_DELETED`.
## TokenDeleteTransactionBody
| Field | Type | Description |
| ------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token to be deleted. If invalid token is specified, transaction will result in `INVALID_TOKEN_ID` |
# TokenDissociate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokendissociate
Dissociates the provided account with the provided tokens. Must be signed by the provided Account's key.
If the provided account is not found, the transaction will resolve to `INVALID_ACCOUNT_ID`.
If the provided account has been deleted, the transaction will resolve to `ACCOUNT_DELETED`.
If any of the provided tokens is not found, the transaction will resolve to `INVALID_TOKEN_REF`.
If any of the provided tokens has been deleted, the transaction will resolve to `TOKEN_WAS_DELETED`.
If an association between the provided account and any of the tokens does not exist, the transaction will resolve to `TOKEN_NOT_ASSOCIATED_TO_ACCOUNT`.
If the provided account has a nonzero balance with any of the provided tokens, the transaction will resolve to `TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES`.
## TokenDissociateTransactionBody
| Field | Type | Description |
| --------- | ------------------------------------------------------------------------ | ------------------------------------------------------ |
| `account` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account to be dissociated with the provided tokens |
| `tokens` | repeated [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The tokens to be dissociated with the provided account |
# TokenFeeScheduleUpdate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenfeescheduleupdate
At consensus, updates a token type's fee schedule to the given list of custom fees. If the target token type has no fee\_schedule\_key, resolves to `TOKEN_HAS_NO_FEE_SCHEDULE_KEY.` \*\*\*\* Otherwise, this transaction must be signed to the fee\_schedule\_key, or the transaction will resolve to `INVALID_SIGNATURE`. If the custom\_fees list is empty, clears the fee schedule or resolves to `CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES` if the fee schedule was already empty.
| Field | Type | Description |
| ------------- | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `token_id` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token whose fee schedule is to be updated |
| `custom_Fees` | repeated [CustomFee](/hedera/sdks-and-apis/hedera-api/token-service/customfees/customfee) | The new custom fees to be assessed during a CryptoTransfer that transfers units of this token |
# TokenFreezeAccount
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenfreezeaccount
Freezes transfers of the specified token for the account. Must be signed by the Token's freezeKey.
If the provided account is not found, the transaction will resolve to INVALID\_ACCOUNT\_ID.
If the provided account has been deleted, the transaction will resolve to ACCOUNT\_DELETED.
If the provided token is not found, the transaction will resolve to INVALID\_TOKEN\_ID.
If the provided token has been deleted, the transaction will resolve to TOKEN\_WAS\_DELETED.
If an Association between the provided token and account is not found, the transaction will resolve to TOKEN\_NOT\_ASSOCIATED\_TO\_ACCOUNT.
If no Freeze Key is defined, the transaction will resolve to TOKEN\_HAS\_NO\_FREEZE\_KEY.
Once executed the Account is marked as Frozen and will not be able to receive or send tokens unless unfrozen. The operation is idempotent.
## TokenFreezeAccountTransactionBody
| Field | Type | Description |
| --------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token for which this account will be frozen. If token does not exist, transaction results in INVALID\_TOKEN\_ID |
| `account` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account to be frozen |
# TokenGetAccountNftInfo
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokengetaccountnftinfo
This query is currently deprecated.
## TokenGetAccountNftInfoQuery
Applicable only to tokens of type `NON_FUNGIBLE_UNIQUE`. Gets info on NFTs N through M owned by the specified accountId. Example: If Account A owns 5 NFTs (might be of different Token Entity), having start=0 and end=5 will return all of the NFTs
| Field | Type | Description |
| ----------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither) |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The Account for which information is requested |
| `start` | int64 | Specifies the start index (inclusive) of the range of NFTs to query for. Value must be in the range \[0; ownedNFTs-1] |
| `end` | int64 | Specifies the end index (exclusive) of the range of NFTs to query for. Value must be in the range (start; ownedNFTs] |
## TokenGetAccountNftInfoResponse
Response when the client sends the node TokenGetInfoQuery
| Field | Type | Description |
| -------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `nfts` | repeated [TokenNftInfo](/hedera/sdks-and-apis/hedera-api/token-service/tokengetnftinfo#tokennftinfo) | List of NFTs associated to the account |
# TokenGetInfo
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokengetinfo
## TokenGetInfoQuery
Gets information about Token instance
| Field | Type | Description |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither) |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token for which information is requested. If invalid token is provided, INVALID\_TOKEN\_ID response is returned. |
## TokenGetInfoResponse
Response when the client sends the node TokenGetInfoQuery
| Field | Type | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `tokenInfo` | TokenInfo | The information requested about this token instance |
## TokenInfo
The metadata about a Token instance
| Field | Type | Description |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tokenId` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | ID of the token instance |
| `name` | string | The name of the token. It is a string of ASCII only characters |
| `symbol` | string | The symbol of the token. It is a UTF-8 capitalized alphabetical string |
| `decimals` | uint32 | The number of decimal places a token is divisible by |
| `totalSupply` | uint64 | The total supply of tokens that are currently in circulation |
| `treasury` | [AccountID](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | The ID of the account which is set as Treasury |
| `adminKey` | [Key](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | The key which can perform update/delete operations on the token. If empty, the token can be perceived as immutable (not being able to be updated/deleted) |
| `kycKey` | [Key](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | The key which can grant or revoke KYC of an account for the token's transactions. If empty, KYC is not required, and KYC grant or revoke operations are not possible. |
| `freezeKey` | [Key](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | The key which can freeze or unfreeze an account for token transactions. If empty, freezing is not possible |
| `wipeKey` | [Key](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | The key which can wipe token balance of an account. If empty, wipe is not possible |
| `supplyKey` | [Key](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | The key which can change the supply of a token. The key is used to sign Token Mint/Burn operations |
| `defaultFreezeStatus` | [TokenFreezeStatus](/hedera/sdks-and-apis/hedera-api/basic-types/tokenfreezestatus) | The default Freeze status (not applicable, frozen or unfrozen) of Hedera accounts relative to this token. FreezeNotApplicable is returned if Token Freeze Key is empty. Frozen is returned if Token Freeze Key is set and defaultFreeze is set to true. Unfrozen is returned if Token Freeze Key is set and defaultFreeze is set to false |
| `defaultKycStatus` | [TokenKycStatus](/hedera/sdks-and-apis/hedera-api/basic-types/tokenkycstatus) | The default KYC status (KycNotApplicable or Revoked) of Hedera accounts relative to this token. KycNotApplicable is returned if KYC key is not set, otherwise Revoked |
| `isDeleted` | bool | Specifies whether the token was deleted or not |
| `autoRenewAccount` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | An account which will be automatically charged to renew the token's expiration, at autoRenewPeriod interval |
| `autoRenewPeriod` | uint64 | The interval at which the auto-renew account will be charged to extend the token's expiry |
| `expiry` | uint64 | The epoch second at which the token will expire; if an auto-renew account and period are specified, this is coerced to the current epoch second plus the autoRenewPeriod |
| `memo` | string | The memo associated with the token |
| `tokenType` | [TokenType](/hedera/sdks-and-apis/hedera-api/basic-types/tokentype) | The token type |
| `supplyType` | [TokenSupplyType](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | The token supply type |
| `maxSupply` | int64 | For tokens of type `FUNGIBLE_COMMON` - The Maximum number of fungible tokens that can be in circulation. For tokens of type `NON_FUNGIBLE_UNIQUE` - the maximum number of NFTs (serial numbers) that can be in circulation |
| `fee_schedule_key` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The key which can change the custom fee schedule of the token; if not set, the fee schedule is immutable |
| `custom_fees` | repeated [CustomFee](/hedera/sdks-and-apis/hedera-api/token-service/customfees/customfee) | The custom fees to be assessed during a CryptoTransfer that transfers units of this token |
| `pause_key` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The Key which can pause and unpause the Token |
| `pause_status` | [TokenPauseStatus](/hedera/sdks-and-apis/hedera-api/basic-types/tokenpausestatus) | Specifies whether the token is paused or not. PauseNotApplicable is returned if pauseKey is not set. |
| `ledger_id` | bytes | The ledger ID the response was returned from; please see [HIP-198](https://hips.hedera.com/hip/hip-198) for the network-specific IDs. |
###
# TokenGetNftInfo
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokengetnftinfo
## NftID
Represents an NFT on the Ledger.
| Field | Type | Description |
| -------------- | --------------------------------------------------------------- | --------------------------------------------------------- |
| `tokenID` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The (non-fungible) token of which this NFT is an instance |
| `serialNumber` | int64 | The unique identifier of this instance |
## TokenGetNftInfoQuery
Applicable only to tokens of type `NON_FUNGIBLE_UNIQUE`. Gets info on a NFT for a given TokenID (of type `NON_FUNGIBLE_UNIQUE`) and serial number.
| Field | Type | Description |
| -------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither) |
| `nftID` | [NftID](#nftid) | The ID of the NFT |
## TokenNftInfo
| Field | Type | Description |
| -------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `nftID` | [NftID](#nftid) | The ID of the NFT |
| `accountID` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The current owner of the NFT |
| `creationTime` | [Timestamp](/hedera/sdks-and-apis/hedera-api/miscellaneous/timestamp) | The effective consensus timestamp at which the NFT was minted |
| `metadata` | bytes | Represents the unique metadata of the NFT |
| `ledger_id` | bytes | The ledger ID the response was returned from; please see [HIP-198](https://hips.hedera.com/hip/hip-198) for the network-specific IDs |
| `spender_id` | AccountID | If an allowance is granted for the NFT, its corresponding spender account |
## TokenGetNftInfoResponse
| Field | Type | Description |
| -------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `nft` | [TokenNftInfo](#tokennftinfo) | The information about this NFT |
# TokenGetNftInfos
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokengetnftinfos
This query is deprecated.
## TokenGetNftInfosQuery
Applicable only to tokens of type `NON_FUNGIBLE_UNIQUE`. Gets info on NFTs N through M on the list of NFTs associated with a given `NON_FUNGIBLE_UNIQUE` Token. Example: If there are 10 NFTs issued, having start=0 and end=5 will query for the first 5 NFTs. Querying +all 10 NFTs will require start=0 and end=10.
| Field | Type | Description |
| --------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | [QueryHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/queryheader) | Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither) |
| `tokenID` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The ID of the token for which information is requested |
| `start` | int64 | Specifies the start index (inclusive) of the range of NFTs to query for. Value must be in the range \[0; ownedNFTs-1] |
| `end` | int64 | Specifies the end index (exclusive) of the range of NFTs to query for. Value must be in the range (start; ownedNFTs] |
## TokenGetNftInfosResponse
| Field | Type | Description |
| --------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `header` | [ResponseHeader](/hedera/sdks-and-apis/hedera-api/miscellaneous/responseheader) | Standard response from node to client, including the requested fields: cost, or state proof, or both, or neither |
| `tokenID` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The Token with type `NON_FUNGIBLE` that this record is for |
| `nfts` | repeated [TokenNftInfo](/hedera/sdks-and-apis/hedera-api/token-service/tokengetnftinfo#tokennftinfo) | List of NFTs associated to the specified token |
# TokenGrantKyc
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokengrantkyc
Grants KYC to the account for the given token. Must be signed by the Token's kycKey.
If the provided account is not found, the transaction will resolve to INVALID\_ACCOUNT\_ID.
If the provided account has been deleted, the transaction will resolve to ACCOUNT\_DELETED.
If the provided token is not found, the transaction will resolve to INVALID\_TOKEN\_ID.
If the provided token has been deleted, the transaction will resolve to TOKEN\_WAS\_DELETED.
If an Association between the provided token and account is not found, the transaction will resolve to TOKEN\_NOT\_ASSOCIATED\_TO\_ACCOUNT.
If no KYC Key is defined, the transaction will resolve to TOKEN\_HAS\_NO\_KYC\_KEY.
Once executed the Account is marked as KYC Granted.
## TokenGrantKycTransactionBody
| Field | Type | Description |
| --------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token for which this account will be granted KYC. If token does not exist, transaction results in INVALID\_TOKEN\_ID |
| `account` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account to be KYCed |
# TokenMint
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenmint
Mints tokens to the Token's treasury Account. If no Supply Key is defined, the transaction will resolve to `TOKEN_HAS_NO_SUPPLY_KEY`.
The operation increases the Total Supply of the Token. The maximum total supply a token can have is `2^63-1`.
The amount provided must be in the lowest denomination possible.\
Example:Token A has 2 decimals. In order to mint `100` tokens, one must provide amount of 10000. In order to mint `100.55` tokens, one must provide amount of `10055`.
## TokenMintTransactionBody
| Field | Type | Description |
| ---------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token for which to mint tokens. If token does not exist, transaction results in INVALID\_TOKEN\_ID |
| `amount` | uint64 | Applicable to tokens of type `FUNGIBLE_COMMON`. The amount to mint to the Treasury Account. Amount must be a positive non-zero number represented in the lowest denomination of the token. The new supply must be lower than 2^63. |
| `metadata` | repeated bytes | Applicable to tokens of type `NON_FUNGIBLE_UNIQUE`. A list of metadata that are being created. Maximum allowed size of each metadata is 100 bytes. The metadata can be arbitrary, but we recommend developers to follow [HIP-10](https://hips.hedera.com/hip/hip-10)standard. |
# TokenPause
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenpause
Pauses the Token from being involved in any kind of Transaction until it is unpaused.
* Must be signed with the Token's pause key.
* If the provided token is not found, the transaction will resolve to INVALID\_TOKEN\_ID.
* If the provided token has been deleted, the transaction will resolve to TOKEN\_WAS\_DELETED.
* If no Pause Key is defined, the transaction will resolve to TOKEN\_HAS\_NO\_PAUSE\_KEY.
* Once executed the Token is marked as paused and will be not able to be a part of any transaction.
## TokenPauseTransactionBody
| Field | Type | Description |
| ------- | --------------------------------------------------------------- | ---------------------- |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token to be paused |
# TokenRevokeKyc
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenrevokekyc
Revokes KYC to the account for the given token. Must be signed by the Token's kycKey.
If the provided account is not found, the transaction will resolve to INVALID\_ACCOUNT\_ID.
If the provided account has been deleted, the transaction will resolve to ACCOUNT\_DELETED.
If the provided token is not found, the transaction will resolve to INVALID\_TOKEN\_ID.
If the provided token has been deleted, the transaction will resolve to TOKEN\_WAS\_DELETED.
If an Association between the provided token and account is not found, the transaction will resolve to TOKEN\_NOT\_ASSOCIATED\_TO\_ACCOUNT.
If no KYC Key is defined, the transaction will resolve to TOKEN\_HAS\_NO\_KYC\_KEY.
Once executed the Account is marked as KYC Revoked
## TokenRevokeKycTransactionBody
| Field | Type | Description |
| --------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token for which this account will get his KYC revoked. If token does not exist, transaction results in INVALID\_TOKEN\_ID |
| `account` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account to be KYC Revoked |
# TokenService
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenservice
Transactions and queries for the Token Service.
To transfer tokens created by HTS, please reference the [`cryptoTransfer`](/hedera/sdks-and-apis/hedera-api/cryptocurrency-accounts/cryptotransfer) API.
## TokenService
| Method Name | Request Type | Response Type | Description |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `createToken` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Creates a new Token by submitting the transaction |
| `updateToken` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Updates the account by submitting the transaction |
| `mintToken` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Mints an amount of the token to the defined treasury account |
| `burnToken` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Burns an amount of the token from the defined treasury account |
| `deleteToken` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | (NOT CURRENTLY SUPPORTED) Deletes a Token |
| `wipeTokenAccount` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Wipes the provided amount of tokens from the specified Account ID |
| `freezeTokenAccount` | [Transaction](https://github.com/theekrystallee/hedera-style-guide/blob/sdk-v1/deprecated/hedera-api/token-service/broken-reference/README.md) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Freezes the transfer of tokens to or from the specified Account ID |
| `unfreezeTokenAccount` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Unfreezes the transfer of tokens to or from the specified Account ID |
| `grantKycToTokenAccount` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Flags the provided Account ID as having gone through KYC |
| `revokeKycFromTokenAccount` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Removes the KYC flag of the provided Account ID |
| `associateTokens` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Associates tokens to an account |
| `dissociateTokens` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Dissociates tokens from an account |
| `updateTokenFeeSchedule` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Updates the custom fee schedule on a token |
| `getTokenInfo` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the metadata of a token |
| `getAccountNftInfo` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Gets info on NFTs N through M on the list of NFTs associated with a given account |
| `getTokenNftInfo` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Retrieves the metadata of an NFT by TokenID and serial number |
| `getTokenNftInfo` | [Query](/hedera/sdks-and-apis/hedera-api/miscellaneous/query) | [Response](/hedera/sdks-and-apis/hedera-api/miscellaneous/response) | Gets info on NFTs N through M on the list of NFTs associated with a given Token of type `NON_FUNGIBLE` |
| `pauseToken` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Pause the token |
| `unpauseToken` | [Transaction](/hedera/sdks-and-apis/hedera-api/miscellaneous/transaction) | [TransactionResponse](/hedera/sdks-and-apis/hedera-api/miscellaneous/transactionresponse) | Unpause the token |
# TokenUnfreezeAccount
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenunfreezeaccount
Unfreezes transfers of the specified token for the account. Must be signed by the Token's freezeKey.
If the provided account is not found, the transaction will resolve to INVALID\_ACCOUNT\_ID.
If the provided account has been deleted, the transaction will resolve to ACCOUNT\_DELETED.
If the provided token is not found, the transaction will resolve to INVALID\_TOKEN\_ID.
If the provided token has been deleted, the transaction will resolve to TOKEN\_WAS\_DELETED.
If an Association between the provided token and account is not found, the transaction will resolve to TOKEN\_NOT\_ASSOCIATED\_TO\_ACCOUNT.
If no Freeze Key is defined, the transaction will resolve to TOKEN\_HAS\_NO\_FREEZE\_KEY.
Once executed the Account is marked as Unfrozen and will be able to receive or send tokens. The operation is idempotent.
## TokenUnfreezeAccountTransactionBody
| Field | Type | Description |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token for which this account will be unfrozen. If token does not exist, transaction results in INVALID\_TOKEN\_ID |
| `account` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account to be unfrozen |
# TokenUnpause
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenunpause
Unpauses the Token. Must be signed with the Token's pause key.
* If the provided token is not found, the transaction will resolve to INVALID\_TOKEN\_ID
* If the provided token has been deleted, the transaction will resolve to TOKEN\_WAS\_DELETED
* If no Pause Key is defined, the transaction will resolve to TOKEN\_HAS\_NO\_PAUSE\_KEY
* Once executed the Token is marked as Unpaused and can be used in Transactions
* The operation is idempotent - becomes a no-op if the Token is already unpaused
## TokenUnpauseTransactionBody
| Field | Type | Description |
| ------- | --------------------------------------------------------------- | ------------------------ |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token to be unpaused |
# TokenUpdate
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenupdate
Updates an already created Token.
If no value is given for a field, that field is left unchanged. For an immutable token (that is, a token created without an adminKey), only the expiry may be updated. Setting any other field, in that case, will cause the transaction status to resolve to TOKEN\_IS\_IMMUTABlE.
## TokenUpdateTransactionBody
| Field | Type | Description | Signature Required |
| ------------------ | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The Token to be updated | N/A |
| `symbol` | string | The new publicly visible symbol of the token. The token name is specified as a Unicode string. Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). | N/A |
| `name` | string | The new publicly visible name of the token. The token name is specified as a Unicode string. Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). | N/A |
| `treasury` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The new Treasury account of the Token. If the provided treasury account is not existing or deleted, the response will be INVALID\_TREASURY\_ACCOUNT\_FOR\_TOKEN. If successful, the Token balance held in the previous Treasury Account is transferred to the new one. | If updated, required |
| `adminKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The new Admin key of the Token. If Token is immutable, transaction will resolve to TOKEN\_IS\_IMMUTABlE. | If updated, required |
| `kycKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The new KYC key of the Token. If Token does not have currently a KYC key, transaction will resolve to TOKEN\_HAS\_NO\_KYC\_KEY. | If updated, required |
| `freezeKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The new Freeze key of the Token. If the Token does not have currently a Freeze key, transaction will resolve to TOKEN\_HAS\_NO\_FREEZE\_KEY. | If updated, required |
| `wipeKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The new Wipe key of the Token. If the Token does not have currently a Wipe key, transaction will resolve to TOKEN\_HAS\_NO\_WIPE\_KEY. | If updated, required |
| `supplyKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | The new Supply key of the Token. If the Token does not have currently a Supply key, transaction will resolve to TOKEN\_HAS\_NO\_SUPPLY\_KEY. | If updated, required |
| `autoRenewAccount` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The new account which will be automatically charged to renew the token's expiration, at autoRenewPeriod interval. | N/A |
| `autoRenewPeriod` | uint64 | The new interval at which the auto-renew account will be charged to extend the token's expiry. | N/A |
| `expiry` | uint64 | The new expiry time of the token. Expiry can be updated even if admin key is not set. If the provided expiry is earlier than the current token expiry, transaction wil resolve to INVALID\_EXPIRATION\_TIME | N/A |
| `memo` | string | The memo associated with the token (UTF-8 encoding max 100 bytes) | N/A |
| `feeScheduleKey` | [Key](/hedera/sdks-and-apis/hedera-api/basic-types/key) | If set, the new key to use to update the token's custom fee schedule; if the token does not currently have this key, transaction will resolve to TOKEN\_HAS\_NO\_FEE\_SCHEDULE\_KEY | N/A |
| `pause_key` | Key | The Key which can pause and unpause the Token. If the Token does not currently have a pause key, transaction will resolve to TOKEN\_HAS\_NO\_PAUSE\_KEY | N/A |
# TokenWipeAccount
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenwipeaccount
Wipes the provided amount of tokens from the specified Account. Must be signed by the Token's Wipe key.
If the provided account is not found, the transaction will resolve to `INVALID_ACCOUNT_ID`.
If the provided account has been deleted, the transaction will resolve to `ACCOUNT_DELETED`.
If the provided token is not found, the transaction will resolve to INVALID\_TOKEN\_ID.
If the provided token has been deleted, the transaction will resolve to `TOKEN_WAS_DELETED`.
If an Association between the provided token and account is not found, the transaction will resolve to `TOKEN_NOT_ASSOCIATED_TO_ACCOUNT`.
If Wipe Key is not present in the Token, the transaction results in `TOKEN_HAS_NO_WIPE_KEY`.
If the provided account is the Token's Treasury Account, the transaction results in `CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT`
On success, tokens are removed from the account and the total supply of the token is decreased by the wiped amount.
The amount provided is in the lowest denomination possible. Example:
Token A has 2 decimals. In order to wipe 100 tokens from account, one must provide amount of 10000. In order to wipe 100.55 tokens, one must provide amount of 10055.
## TokenWipeAccountTransactionBody
| Field | Type | Description |
| --------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token` | [TokenID](/hedera/sdks-and-apis/hedera-api/basic-types/tokenid) | The token for which the account will be wiped. If token does not exist, transaction results in `INVALID_TOKEN_ID` |
| `account` | [AccountID](/hedera/sdks-and-apis/hedera-api/basic-types/accountid) | The account to be wiped |
| `amount` | uint64 | Applicable to tokens of type `FUNGIBLE_COMMON`. The amount of tokens to wipe from the specified account. Amount must be a positive non-zero number in the lowest denomination possible, not bigger than the token balance of the account (0; balance] |
| `serialNumbers` | int64 | Applicable to tokens of type `NON_FUNGIBLE_UNIQUE`. The list of serial numbers to be wiped. |
# Hedera Consensus Service gRPC API
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-consensus-service-api
The Hedera Consensus Service (HCS) gRPC API is a public mirror node managed by Hedera. It offers the ability to subscribe to HCS topics and receive messages for the topic subscribed.
#### Important Notice: Deprecation of the Insecure Hedera Consensus Service (HCS) Mirror Node Endpoints
We are phasing out the legacy Hedera Consensus Service (HCS) mirror node endpoints. The APIs have transitioned from the legacy *hcs*.
`.mirrornode.hedera.com:5600` endpoints to the new `.mirrornode.hedera.com:443` endpoints.
For more details, please read our [blog post announcement](https://hedera.com/blog/deprecation-of-the-insecure-hedera-consensus-service-hcs-mirror-node-endpoints).
**HCS Mirror Node Endpoints:**\
**PREVIEWNET:** previewnet.mirrornode.hedera.com:443\
**TESTNET**: testnet.mirrornode.hedera.com:443\
**MAINNET**: mainnet.mirrornode.hedera.com:443
Requests for the public mainnet mirror node are throttled at 100 requests per second (rps). This may change in the future depending upon performance or security considerations. At this time, no authentication is required.
Community-supported mirror node information can be found here:
## Build a Mirror Node Client
If you building your client with a predefined Hedera network (previewnet, testnet, mainnet), you do not need to define the mirror client as it is built in. If you would like to modify the mirror node client, you can use `Client..setMirrorNetwork()`.
```java Java theme={null}
// You will need to upgrade to v2.0.6 or higher
Client client = Client.forMainnet();
client.setMirrorNetwork(Collections.singletonList("mainnet.mirrornode.hedera.com:443"))
```
```javascript JavaScript theme={null}
// You will need to upgrade to v2.0.23 or higher
const client = Client.forMainnet()
client.setMirrorNetwork("mainnet.mirrornode.hedera.com:443")
```
```go Go theme={null}
hedera.ClientForMainnet()
client.SetMirrorNetwork([]string{"mainnet.mirrornode.hedera.com:443"})
```
**Concurrent Subscription Limit**\
A single client can make a maximum of **5** concurrent subscription calls per connection.
### Subscribe to a topic
Please click the link below to see how you can subscribe to a topic.
# Hedera Status API
Source: https://docs.hedera.com/hedera/sdks-and-apis/hedera-status-api
## Overview
The **Hedera Status API** enables programmatic access to the current operational status, incident reports, and scheduled maintenance for the Hedera network. This API is especially useful for developers and system operators who want to integrate real-time status updates into their applications or monitor system health programmatically.
#### **Key Features**
* **Real-time Status Updates**: Retrieve the current operational state of all Consensus Nodes.
* **Incident Reports**: Access detailed information about current and past incidents, including affected components and resolution status.
* **Scheduled Maintenance**: Get advance notice and real-time updates on planned maintenance windows.
For real-time visual monitoring, visit [https://status.hedera.com](https://status.hedera.com).
## Base URL
The base URL for all endpoints is:
```bash theme={null}
https://status.hedera.com/api/v2
```
## Endpoints
| Endpoint | Description |
|---|
GET /summary.json | Get a summary of the status page, including a status indicator, component statuses, unresolved incidents, and any upcoming or in-progress scheduled maintenance. |
GET /status.json | Get the status rollup for the whole page. This endpoint includes an indicator - one of none, minor, major, or critical, as well as a human description of the blended component status. Examples of the blended status include "All Systems Operational," "Partial System Outage," and "Major Service Outage."
|
GET /components.json | List all components. Each component is listed along with its status - one of operational, degraded\_performance, partial\_outage, or major\_outage. |
GET /incidents.json | Get a list of the 50 most recent incidents. This includes all unresolved incidents as described above, as well as those in the Resolved and Postmortem state. |
GET /incidents/unresolved.json | Get a list of any unresolved incidents. This endpoint will only return incidents in the Investigating, Identified, or Monitoring state. |
GET /scheduled-maintenances.json | Get a list of the 50 most recent scheduled maintenance. This includes scheduled maintenance as described in the above two endpoints, as well as those in the Completed state. |
GET /scheduled-maintenances/upcoming.json | Get a list of any upcoming maintenance. This endpoint will only return scheduled maintenances still in the Scheduled state. |
GET /scheduled-maintenances/active.json | Get a list of any active maintenance. This endpoint will only return scheduled maintenance in the In Progress or Verifying state. |
***
## Additional Resources
For further integration support or detailed documentation on all available endpoints, visit the official [Hedera Status API page](https://status.hedera.com/api/v2).
# Mirror Node REST API
Source: https://docs.hedera.com/hedera/sdks-and-apis/rest-api
The mirror node REST API offers the ability to query transaction information.
## Overview
The **Hedera Mirror Node REST API** enables developers to access historical transaction data from Hedera's mainnet, testnet, and previewnet. Each transaction generates a record stored in a record file, which can be accessed via the Mirror Node REST APIs.
***
## Making a Request
To make a request, use the network endpoint and the REST API of choice.
For example, To get a list of transactions on the **Hedera mainnet**, use the following API endpoint:
```bash theme={null}
https://mainnet.mirrornode.hedera.com/api/v1/transactions
```
This will return a JSON response containing transaction details such as transaction ID, timestamps, and fees.
If you are using `curl`, you can make a request like this:
```bash theme={null}
curl -X GET "https://mainnet.mirrornode.hedera.com/api/v1/transactions" -H "Accept: application/json"
```
***
## Hedera Mirror Node Swagger UI Environments
Hedera provides interactive Swagger UI for its Mirror Node REST API. Developers can use these environments to explore available endpoints, check request parameters, and test API calls without writing code.
#### **Available Environments:**
***
## **Hedera Mirror Node Environments**
Hedera provides three different network environments for interacting with the Mirror Node API.
| Network | Base URL |
|---|
| Mainnet | [https://mainnet.mirrornode.hedera.com/](https://mainnet.mirrornode.hedera.com/) |
| Testnet | [https://testnet.mirrornode.hedera.com/](https://testnet.mirrornode.hedera.com/) |
| Previewnet | [https://previewnet.mirrornode.hedera.com/](https://previewnet.mirrornode.hedera.com/) |
Each of these base URLs serves as the foundation for all API calls.
#### Community Providers
You may also check out these community providers as alternatives:
* [**LinkPool**](https://linkpool.com/)
* `https://hedera-mirror.linkpool.pro/`
* [**Validation Cloud**](https://validationcloud.io/)
* `https://mainnet.hedera.validationcloud.io/`
* [**DragonGlass**](https://app.dragonglass.me/hedera/pricing)
* `https://api.dragonglass.me/hedera/`
Public mainnet mirror node requests per second (RPS) are currently throttled at **50 per IP address**. These configurations may change in the future depending on performance or security considerations. At this time, no authentication is required.
# Accounts
Source: https://docs.hedera.com/hedera/sdks-and-apis/rest-api/accounts
## Overview
The **Account** endpoints in the Hedera Mirror Node REST API provides endpoints to retrieve account details, crypto allowances, token relationships, NFTs owned by accounts, and staking reward payouts. These endpoints are crucial for tracking account balances, permissions, and historical activity.
## Endpoints
The following endpoints are available for the Accounts object:
| Endpoint | Description |
| ------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `GET /api/v1/accounts` | Retrieves a list of accounts on the network. |
| `GET /api/v1/accounts/{idOrAliasOrEvmAddress}` | Fetches details of a specific account by ID, alias, or EVM address. |
| `GET /api/v1/accounts/{idOrAliasOrEvmAddress}/allowances/crypto` | Retrieves hbar allowances granted by an account. |
| `GET /api/v1/accounts/{idOrAliasOrEvmAddress}/rewards` | Gets past staking reward payouts for an account. |
| `GET /api/v1/accounts/{idOrAliasOrEvmAddress}/airdrops/outstanding` | Fetches the outstanding token airdrops for a given account. |
| `GET /api/v1/accounts/{idOrAliasOrEvmAddress}/airdrops/pending` | Fetech the pending token airdrops for a given account. |
| `GET /api/v1/accounts/{idOrAliasOrEvmAddress}/allowances/tokens` | Retrieves token allowances granted by an account. |
| `GET /api/v1/accounts/{idOrAliasOrEvmAddress}/allowances/nfts` | Retrieves nft allowances granted by an account. |
| `GET /api/v1/accounts/{idOrAliasOrEvmAddress}/nfts` | Fetches the nfts for an account. |
## Accounts
The **accounts** object represents the information associated with an account and returns a list of account information.
Account IDs take the following format: **0.0.\**.
Example: 0.0.1000
Account IDs can also take the account number as an input value. For example, for account ID 0.0.1000, the number 1000 can be specified in the request.
# Balances
Source: https://docs.hedera.com/hedera/sdks-and-apis/rest-api/balances
## Overview
The **Balances endpoints** in the Hedera Mirror Node REST API allows developers to query **account balances** on the Hedera network. These endpoints provides real-time and historical balance data, essential for wallets, explorers, and financial applications.
## Endpoints
The following endpoint is available for the Balances object:
| **Endpoint** | **Description** |
| ---------------------- | ------------------------------------- |
| `GET /api/v1/balances` | Retrieves a list of account balances. |
## Balances
The **balance** object represents the balance of accounts on the Hedera network. You can retrieve this to view the **most recent** balance of all the accounts on the network at that given time. The balances object returns the account ID and the balance in HBAR. Balances are checked on a periodic basis and thus return the most recent snapshot of time captured prior to the request.
The **balance object** represents the balance of accounts on the Hedera network. It allows you to retrieve the **most recent** snapshot of all account balances on the network at a given time. Since balances are updated periodically, the returned values reflect the latest recorded state before the request.
Each **balance object** includes:
* **Account ID** – The Hedera account being queried.
* **Balance (in HBAR)** – The most recent balance available.
* **Token Balances (if applicable)** – Associated token balances for the account.
# Blocks
Source: https://docs.hedera.com/hedera/sdks-and-apis/rest-api/blocks
## Overview
The **Block endpoints** in the Hedera Mirror Node REST API allows developers to query **block data** on the Hedera network. These endpoints are essential for retrieving block metadata, including hashes, timestamps, and transactions within blocks.
## Endpoints
The following Block endpoints are available:
| **Endpoint** | **Description** |
| ------------------------------------- | ------------------------------------------------------------ |
| `GET /api/v1/blocks` | Retrieves a list of blocks on the network. |
| `GET /api/v1/blocks/{hash_or_number}` | Fetches details of a specific block by hash or block number. |
# Network
Source: https://docs.hedera.com/hedera/sdks-and-apis/rest-api/network
Mirror Node REST API endpoints for querying network supply, fees, exchange rates, nodes, and staking information.
## Overview
The Network Object in the Hedera Mirror Node REST API allows developers to query network-related information, such as network supply, fees, exchange rates, and node details. These endpoints are essential for monitoring network status, estimating transaction costs, and retrieving staking information.
## Endpoints
The following endpoints are available for the Network object:
| Endpoint | Description |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /api/v1/network/supply` | Retrieves the current total supply of HBAR. |
| `GET /api/v1/network/fees` | Fetches the latest transaction fee schedules. |
| `POST /api/v1/network/fees` | Estimates node, network, and service fees for a protobuf-encoded transaction, including the [HIP-1313](https://hips.hedera.com/hip/hip-1313) `high_volume_multiplier`. |
| `GET /api/v1/network/exchangerate` | Retrieves exchange rates to estimate transaction costs. |
| `GET /api/v1/network/nodes` | Lists the network address book nodes. |
| `GET /api/v1/network/stake` | Fetches staking-related information. |
For full request/response details, parameters, and interactive API playgrounds for each endpoint, see the API reference pages in the sidebar. For an overview of the Simple Fees model, see [Fee Model](/hedera/core-concepts/fee-model).
# Schedule Transactions
Source: https://docs.hedera.com/hedera/sdks-and-apis/rest-api/schedule-transactions
## Overview
The **Scheduled Transactions endpoints** in the Hedera Mirror Node REST API allows developers to query **scheduled transactions** on the Hedera network. These endpoints are essential for tracking transaction scheduling, execution status, and metadata related to scheduled transactions.
## Endpoints
The following endpoints are available for the Scheduled Transactions object:
| **Endpoint** | **Description** |
| ---------------------------- | ---------------------------------------------------------- |
| `GET /api/v1/schedules` | Retrieves a list of scheduled transactions on the network. |
| `GET /api/v1/schedules/{id}` | Fetches details of a specific scheduled transaction by ID. |
# Smart Contracts
Source: https://docs.hedera.com/hedera/sdks-and-apis/rest-api/smart-contracts
## Overview
The **Smart Contracts endpoints** in the Hedera Mirror Node REST API allows developers to query **smart contract metadata, execution results, state changes, and logs**. These endpoints are essential for tracking contract interactions, retrieving transaction results, and debugging contract executions on the Hedera network.
## Endpoints
The following endpoints are available for the Smart Contracts object:
| **Endpoint** | **Description** |
| ------------------------------------------------------------- | ------------------------------------------------------------------- |
| `GET /api/v1/contracts` | Retrieves a list of smart contract entities on the network. |
| `GET /api/v1/contracts/{contractIdOrAddress}` | Fetches details of a specific contract by ID. |
| `GET /api/v1/contracts/results/{transactionIdOrhash}` | Retrieves execution results for a specific contract transaction ID. |
| `GET /api/v1/contracts/{contractIdOrAddress}/results` | Retrieves execution results for a specific contract. |
| `GET /api/v1/contracts/{id}/state` | Fetches the state of a contract. |
| `GET /api/v1/contracts/results` | Lists execution results for all contracts. |
| `GET /api/v1/contracts/results/{transactionIdOrHash}/results` | Get contract actions by transaction ID or transaction hash. |
| `GET /api/v1/contracts/results/{timestamp}` | Retrieves execution results for a contract at a given timestamp. |
| `GET /api/v1/contracts/logs` | Lists logs emitted from contracts. |
| `GET /api/v1/contracts/{id}/results/logs` | Fetches logs for a specific contract. |
| `GET /api/v1/contracts/{id}/results/opcodes` | Get the opcode traces for historical transactions |
| `POST /api/v1/contracts/call` | Invokes a smart contract method. |
# Tokens
Source: https://docs.hedera.com/hedera/sdks-and-apis/rest-api/tokens
## Overview
The **Tokens endpoints** in the Hedera Mirror Node REST API allow developers to retrieve token details, token balances, NFT metadata, and transaction history. These endpoints are essential for tracking tokenized assets and interactions on the Hedera network.
## Endpoints
The following endpoints are available for the Tokens object:
| |
|---|
| Endpoint | Description |
GET /api/v1/tokens | Retrieves a list of all tokens on the network. |
GET /api/v1/tokens/balances | Lists token balances across accounts. |
GET /api/v1/tokens/ | Fetches details of a specific token by ID. |
GET /api/v1/tokens/nfts | Retrieves a list of all NFTs on the network. |
GET /api/v1/tokens/nfts/ | Fetches metadata and details for a specific NFT. |
GET /api/v1/tokens/nfts//transactions | Retrieves the transaction history of a specific NFT. |
# Topics
Source: https://docs.hedera.com/hedera/sdks-and-apis/rest-api/topics
## Overview
The **Topics endpoints** in the Hedera Mirror Node REST API allows developers to query **topics and messages**. These endpoints are crucial for retrieving topic details, message history, and tracking consensus events on the network.
## Endpoints
The following endpoints are available for the Topics object:
| **Endpoint** | **Description** |
| ------------------------------------------------------- | -------------------------------------------------------------- |
| `GET /api/v1/topics/{id}/messages` | Retrieves messages for a specific topic by ID. |
| `GET /api/v1/topics/{id}/messages/{sequence_number}` | Fetches a specific message from a topic using sequence number. |
| `GET /api/v1/topics/{id}/messages/{consensusTimestamp}` | Retrieves a topic message by consensus timestamp. |
| `GET /api/v1/topics/{topicid}` | Retrieves the topic details for the given topic ID. |
# Transactions
Source: https://docs.hedera.com/hedera/sdks-and-apis/rest-api/transactions
## Overview
The **Transactions endpoints** in the Hedera Mirror Node REST API allows developers to query **transaction history, details, and status** on the Hedera network. These endpoints is essential for tracking payments, token transfers, smart contract executions, and other network activities.
## Endpoints
The following endpoints are available for the Network activity object:
| **Endpoint** | **Description** |
| ------------------------------- | ------------------------------------------------------------ |
| `GET /api/v1/transactions` | Retrieves a list of transactions on the network. |
| `GET /api/v1/transactions/{id}` | Fetches details of a specific transaction by transaction ID. |
## Fetching Transactions
The **transaction** object represents the transactions processed on the Hedera network. You can retrieve this to view the transaction metadata information including transaction id, timestamp, transaction fee, transfer list, etc. If a transaction was submitted to multiple nodes, the successful transaction and duplicate transaction(s) will be returned as separate entries in the response with the same transaction ID. Duplicate transactions will still be assessed [network fees](https://www.hedera.com/fees).
# SDKs
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks
Hedera supported and community-maintained SDKs
There are several options for friendly, language-specific access to the Hedera API and its network services.
## Consensus Node Code SDKs
Hedera and the developer community contribute to and maintain Hiero's Consensus Node SDKs across various languages.
**Note:** The Hiero JavaScript SDK supports React Native with Expo on Android
devices and Android emulators. It does not currently support React Native
Bare.
Maintainer: Hiero
License: Apache 2.0
[GITHUB](https://github.com/hashgraph/hedera-sdk-java)
Maintainer: Hiero
License: Apache 2.0
[GITHUB](https://github.com/hashgraph/hedera-sdk-js)
Maintainer: Hiero
License: Apache 2.0
[GITHUB](https://github.com/hashgraph/hedera-sdk-go)
Maintainer: Hiero
License: Apache 2.0
[GITHUB](https://github.com/hashgraph/hedera-sdk-swift)
Maintainer: Hiero
License: Apache 2.0
[GITHUB](https://github.com/hiero-ledger/hiero-sdk-rust)
Maintainer: Hiero
License: Apache 2.0
[GITHUB](https://github.com/hiero-ledger/hiero-sdk-cpp)
## Development Tools & SDKs
Hedera and the developer community contribute to and maintain developer tools and SDKs. These can be used to make bootstrapping your own project even easier.
### Hedera Developer Playground
***ℹ️ Try the*** [***Hedera Developer Playground***](https://portal.hedera.com/playground) ***to explore services, transactions, and queries on your own using the Hedera SDKs.***
### Additional Language Support
Build a Hedera-powered application using your favorite language with these community-supported SDKs.
Maintainer: Community
License: Apache 2.0
[DOCUMENTATION](https://github.com/hiero-ledger/hiero-sdk-python)
[GITHUB](https://github.com/hiero-ledger/hiero-sdk-python)
### Ecosystem Wallet Support
If you're building a decentralized application on Hedera that requires wallet connectivity, such as allowing users to connect their [HashPack](https://www.hashpack.app/), [Kabila](https://magic.link/), [Blade](https://sunset.bladewallet.io/), or [MetaMask](https://metamask.io/) wallets, check out the easy-to-implement wallet integration SDKs/tutorials found below. In addition, dApp integration tools for account creation and management, such as [Magic Link](https://magic.link/), make it easy for your users to create an account on Hedera and authenticate themselves in no time.
**[HashPack](https://www.hashpack.app/)** HashConnect
Maintainer: Community
License: MIT
**[DOCUMENTATION](https://www.hashpack.app/hashconnect)**
**[Magic Link](https://magic.link)** Wallet SDK
Maintainer: Community
License: MIT
**[DOCUMENTATION](https://magic.link/docs/auth/blockchains/hedera)**
**[MetaMask](https://metamask.io/)** Integration
Maintainer: Community
License: MIT
**[TUTORIAL](https://docs.hedera.com/hedera/tutorials/more-tutorials/develop-a-hedera-dapp-integrated-with-walletconnect)**
[Kabila](https://www.kabila.app/wallet) WalletConnect
Maintainer: Community
License: Apache 2.0
**[TUTORIAL](https://github.com/Kabila-Tech/hedera-wallet-connect)**
### Decentralized Identity SDKs
Build decentralized identity directly into your Hedera-powered application. Manage [DID Documents](https://www.w3.org/TR/did-core/) & a [Verifiable Credentials](https://www.w3.org/TR/vc-data-model/) registry, abiding by W3C standards, using the Hedera Consensus Service.
Maintainer: Hedera
License: Apache 2.0
[GITHUB](https://github.com/hashgraph/did-sdk-java)
Maintainer: Hedera
License: Apache 2.0
[GITHUB](https://github.com/hashgraph/did-sdk-js)
Maintainer: Hedera
License: Apache 2.0
[GITHUB](https://github.com/hashgraph/did-sdk-python)
### Serverless SDKs
Build a Hedera-powered application using your own serverless REST client.
Maintainer: Hedera REST API
License: Apache 2.0
[DOCUMENTATION](https://docs.trust.enterprises/)
[GITHUB](https://github.com/trust-enterprises/hedera-rest-api)
Maintainer: Hedera REST API
License: Apache 2.0
[DOCUMENTATION](https://docs.trust.enterprises/laravel/working-with-laravel)
[GITHUB](https://github.com/trust-enterprises/hedera-laravel)
Want to help contribute or have a project you'd like to see, here? Get in touch in [discord](http://hedera.com/discord) or add a pull request.
# Accounts and HBAR
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/accounts-and-hbar
# Delete an allowance
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/accounts-and-hbar/adjust-an-allowance
A transaction that deletes one or more non-fungible approved allowances from an owner's account. This operation will remove the allowances granted to one or more specific non-fungible token serial numbers. Each owner account listed as wiping an allowance must sign the transaction.
The total number of NFT serial number deletions within the transaction body cannot exceed 20.
#### **Fungible and HBAR allowance deletion:**
HBAR and fungible token allowances can be removed by setting the amount to zero in `CryptoApproveAllowance`.
#### **Transaction Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for the base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your transaction fee cost
#### **Transaction Signing Requirements**
* The transaction must be signed by the owner's account
* The transaction must be signed by the transaction fee-paying account if different than the owner's account
* If the owner's account and transaction fee-paying account are the same, only one signature is required
**Reference:** [HIP-336](https://github.com/hashgraph/hedera-improvement-proposal/blob/master/HIP/hip-336.md)
### Methods
| **Method** | **Type** | **Description** |
| -------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| `deleteAllTokenNftAllowances(, )` | NFT ID,
AccountId
| Removes the NFT allowance from the spender account. |
```java Java theme={null}
//Create the transaction
AccountAllowanceDeleteTransaction transaction = new AccountAllowanceDeleteTransaction()
.deleteAllTokenNftAllowances(nftId , ownerAccountId);
//Sign the transaction with the owner account key
TransactionResponse txResponse = transaction.freezeWith(client).sign(ownerAccountKey).execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//v2.12.0+
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = new AccountAllowanceDeleteTransaction()
.deleteAllTokenNftAllowances(nftId , ownerAccountId);
//Sign the transaction with the owner account key
const signTx = await transaction.sign(ownerAccountKey);
//Sign the transaction with the client operator private key and submit to a Hedera network
const txResponse = await signTx.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus.toString());
//v2.13.0+
```
```go Go theme={null}
//Create the transaction
transaction := hedera.NewAccountAllowanceDeleteTransaction().
DeleteAllTokenNftAllowances(nftId , ownerAccountId)
if err != nil {
panic(err)
}
//Sign the transaction with the owner account private key and submit to the network
txResponse, err := transaction.Sign(ownerAccountKey).Execute(client)
//Request the receipt of the transaction
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction consensus status
transactionStatus := receipt.Status
println("The transaction consensus status is ", transactionStatus)
//v2.13.1+
```
```rust Rust theme={null}
// Create the transaction
let transaction = AccountAllowanceDeleteTransaction::new()
.delete_all_token_nft_allowances(nft_id, owner_account_id);
// Sign the transaction with the owner account key
let tx_response = transaction
.freeze_with(&client)?
.sign(owner_account_key)
.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
# Approve an allowance
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/accounts-and-hbar/approve-an-allowance
A transaction that allows a token owner to delegate a token spender to spend the specified token amount on behalf of the token owner. A Hedera account owner can provide an allowance for HBAR, non-fungible, and fungible tokens.
The **owner** is the Hedera account that owns the tokens and grants the token allowance to the spender. The **spender** is the account that spends tokens, authorized by the owner, from the owner's account. The spender pays for the transaction fees when transferring tokens from the owner's account to another recipient. This means that the transaction fee payer for the `TransferTransaction` is required to set the spender account ID as the transaction fee payer. If the spender account ID is not set as the transaction fee payer, the system will error with `SPENDER_DOES_NOT_HAVE_ALLOWANCE`.
The maximum number of token approvals for the `AccountAllowanceApproveTransaction` cannot exceed 20. Note that each NFT serial number counts as a single approval. An `AccountAllowanceApproveTransaction` granting 20 NFT serial numbers to a spender will use all of the approvals permitted for the transaction.
A single NFT serial number can only be granted to one spender at a time. If an approval assigns a previously approved NFT serial number to a new user, the old user will have their approval removed.
Each owner account is limited to granting 100 allowances. This limit spans HBAR, fungible token allowances, and non-fungible token `approved_for_all` grants. No limit exists on the number of NFT serial number approvals an owner may grant.
The number of allowances set on an account will increase the auto-renewal fee for the account. Conversely, removing allowances will decrease the auto-renewal fee for the account.
To decrease the allowance for a given spender, you must set the amount to the value you would like to authorize the account for. If the spender account was authorized to spend 25 HBAR and the owner wants to modify their allowance to 5 HBAR, the owner would submit the `AccountAllowanceApproveTransaction` for 5 HBAR.
Only when a spender is set on an explicit NFT ID of a token, do we return the spender ID in `TokenNftInfoQuery` for the respective NFT. If `approveTokenNftAllowanceAllSerials` is used to approve all NFTs for a given token class, and no NFT ID is specified; we will not return a spender ID for all the serial numbers of that token.
**Transaction Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for the base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your transaction fee cost
**Transaction Signing Requirements**
* Must be signed by the owner's account
* Must be signed by the transaction fee payer if different then the owner account
* If the owner and transaction fee payer key are the same only one signature is required
**Reference:** [HIP-336](https://github.com/hashgraph/hedera-improvement-proposal/blob/master/HIP/hip-336.md)
## Constructor
| Constructor | **Description** |
| ------------------------------------------ | --------------------------------------------------------- |
| `new AccountAllowanceApproveTransaction()` | Initializes the AccountAllowanceApproveTransaction object |
## Transaction Properties
| **Method** | **Type** | Requirement |
| --------------------------------------------------------------------------------- | ----------------------------------- | ----------- |
| `approveHbarAllowance()` | AccountId, AccountId, Hbar | Optional |
| `approveTokenAllowance()` | TokenId, AccountId, AccountId, long | Optional |
| `approveTokenNftAllowance()` | NftId, AccountId, AccountId | Optional |
| `approveTokenNftAllowanceAllSerials()` | TokenId, AccountId, AccountId | Optional |
| `setHighVolume()` | boolean | Optional |
## Get Transaction Values
| **Method** | **Type** | **Description** |
| ------------------------ | ------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| `getHbarApprovals()` | List\ | Returns the HBAR allowances |
| `getTokenApprovals()` | List\ | Returns the fungible token allowances |
| `getTokenNftApprovals()` | List\ | Returns the NFT allowances |
| `getHighVolume()` | boolean | Returns whether this transaction uses [high-volume throttles](/hedera/core-concepts/high-volume-entity-creation) |
This transaction supports [high-volume entity creation](/hedera/core-concepts/high-volume-entity-creation)
(HIP-1313). Setting `setHighVolume(true)` routes the transaction through dedicated
high-volume throttle capacity with variable-rate pricing. Always pair this with
`setMaxTransactionFee()` to cap your costs.
```java Java theme={null}
//Create the transaction
AccountAllowanceApproveTransaction transaction = new AccountAllowanceApproveTransaction()
.approveHbarAllowance(ownerAccount, spenderAccountId, Hbar.from(1));
//Sign the transaction with the owner account key and the transaction fee payer key (client)
TransactionResponse txResponse = transaction.freezeWith(client).sign(ownerAccountKey).execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//v2.12.0+
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = new AccountAllowanceApproveTransaction()
.approveHbarAllowance(ownerAccount, spenderAccountId, Hbar.from(1));
//Sign the transaction with the owner account key
const signTx = await transaction.sign(ownerAccountKey);
//Sign the transaction with the client operator private key and submit to a Hedera network
const txResponse = await signTx.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus.toString());
//v2.13.0
```
```go Go theme={null}
//Create the transaction
transaction := hedera.NewAccountAllowanceApproveTransaction().
ApproveHbarAllowance(ownerAccount, spenderAccountId, Hbar.fromTinybars(1))
FreezeWith(client)
if err != nil {
panic(err)
}
//Sign the transaction with the owner account private key
txResponse, err := transaction.Sign(ownerAccountKey).Execute(client)
//Request the receipt of the transaction
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction consensus status
transactionStatus := receipt.Status
println("The transaction consensus status is ", transactionStatus)
//v2.13.1+
```
```rust Rust theme={null}
// Create the transaction
let transaction = AccountAllowanceApproveTransaction::new()
.approve_hbar_allowance(owner_account, spender_account_id, Hbar::from(1));
// Sign the transaction with the owner account key and the transaction fee payer key (client)
let tx_response = transaction
.freeze_with(&client)?
.sign(owner_account_key)
.execute(&client)
.await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
# Create an account
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/accounts-and-hbar/create-an-account
## Create an account using the account create API
A transaction that creates a Hedera account. A Hedera account is required to interact with any of the Hedera network services as you need an account to pay for all associated transaction/query fees. You can visit the [Hedera Developer Portal](https://portal.hedera.com/) to create a previewnet or testnet account. You can also use third-party wallets to generate free [mainnet accounts](/hedera/networks/mainnet/mainnet-access). To process an account create transaction, you will need an existing account to pay for the transaction fee. To obtain the new account ID, request the [receipt](/hedera/sdks-and-apis/sdks/transactions/get-a-transaction-receipt) of the transaction.
When creating a **new account** using the `AccountCreateTransaction()` API you will need an existing account to pay for the associated transaction fee.
***
## Transaction Fees and Signing
* The sender pays for the token association fee and the rent for the first auto-renewal period.
* See the transaction and query [fees](/hedera/networks/mainnet/fees) table for the base transaction fee.
* Use the [Hedera fee estimator](https://hedera.com/fees) to estimate your transaction fee cost.
* The account paying for the transaction fee is required to sign the transaction.
***
## Account Properties
For a complete list of account properties, see the [accounts overview](/hedera/sdks-and-apis/sdks/accounts-and-hbar).
***
## Maximum Auto-Associations and Fees
Accounts have a property, `maxAutoAssociations`, and the property's value determines the maximum number of automatic token associations allowed.
| Property Value | Description |
| :------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `0` | Automatic **token** associations or **token airdrops** are not allowed, and the account must be manually associated with a token. This also applies if the value is less than or equal to `usedAutoAssociations`. |
| `-1` | Unlimited automatic token associations are allowed, and this is the default for accounts created via [auto account creation](../../../core-concepts/accounts/auto-account-creation) and for accounts that began as hollow accounts and are now complete. Accounts with `-1` can receive new tokens without manually associating them. The sender still pays the `maxAutoAssociations` fee and initial rent for each association. |
| `> 0` | If the value is a positive number (number greater than 0), the number of automatic token associations an account can have is limited to that number. |
The sender pays the `maxAutoAssociations` fee and the rent for the first auto-renewal period for the association. This is in addition to the typical transfer fees. This ensures the receiver can receive tokens without association and makes it a smoother transfer process.
**Reference**: [HIP-904](https://hips.hedera.com/hip/hip-904)
#### Methods
| Method | Type | Requirement |
| ------------------------------------------------- | ---------- | ----------- |
| `setKey()` | Key | Required |
| `setAlias()` | EvmAddress | Optional |
| `setInitialBalance()` | HBar | Optional |
| `setReceiverSignatureRequired()` | boolean | Optional |
| `setMaxAutomaticTokenAssociations()` | int | Optional |
| `setStakedAccountId()` | AccountId | Optional |
| `setStakedNodeId()` | long | Optional |
| `setDeclineStakingReward()` | boolean | Optional |
| `setAccountMemo()` | String | Optional |
| `setAutoRenewPeriod()` | Duration | Disabled |
**Account Alias**
If an alias is set during account creation, it becomes [immutable](/hedera/support-and-community/glossary#immutability), meaning it cannot be changed. If you plan to update or rotate keys in the future, do not set the alias at the time of initial account creation. The alias can be set after finalizing all key updates.
***
## Constructor
| Constructor | Description |
| -------------------------------- | ----------------------------------------------- |
| `new AccountCreateTransaction()` | Initializes the AccountCreateTransaction object |
## Transaction Properties
| **Method** | **Type** | Requirement |
| ------------------------------------------------- | --------- | ----------- |
| `setKey()` | Key | Required |
| `setInitialBalance()` | Hbar | Optional |
| `setReceiverSignatureRequired()` | boolean | Optional |
| `setAutoRenewPeriod()` | Duration | Optional |
| `setAccountMemo()` | String | Optional |
| `setMaxAutomaticTokenAssociations()` | int | Optional |
| `setStakedAccountId()` | AccountId | Optional |
| `setStakedNodeId()` | long | Optional |
| `setDeclineStakingReward()` | boolean | Optional |
| `setHighVolume()` | boolean | Optional |
This transaction supports [high-volume entity creation](/hedera/core-concepts/high-volume-entity-creation)
(HIP-1313). Setting `setHighVolume(true)` routes the transaction through dedicated
high-volume throttle capacity with variable-rate pricing. Always pair this with
`setMaxTransactionFee()` to cap your costs.
```javascript JavaScript theme={null}
//Create new ECDSA key
const ecdsaPublicKey = PrivateKey.generateECDSA().publicKey
//Create the transaction
const transaction = new AccountCreateTransaction()
.setKeyWithAlias(ecdsaPublicKey)
// DO NOT set an alias with your key if you plan to update/rotate keys in the future, Use .setKeyWithoutAlias instead
// .setKeyWithoutAlias(ecdsaPublicKey)
.setInitialBalance(new Hbar(1));
//Sign the transaction with the client operator private key and submit to a Hedera network
const txResponse = await transaction.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the account ID
const newAccountId = receipt.accountId;
console.log("The new account ID is " + newAccountId);
//v2.0.5
```
```java Java theme={null}
//Create new ECDSA key
PublicKey ecdsaPublicKey = PrivateKey.generateECDSA().getPublicKey();
//Create the transaction
AccountCreateTransaction transaction = new AccountCreateTransaction()
.setKeyWithAlias(ecdsaPublicKey)
// DO NOT set an alias with your key if you plan to update/rotate keys in the future, Use .setKeyWithoutAlias instead
// .setKeyWithoutAlias(ecdsaPublicKey)
.setInitialBalance(new Hbar(1));
//Sign the transaction with the client operator private key and submit to a Hedera network
TransactionResponse txResponse = transaction.execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the account ID
AccountId newAccountId = receipt.accountId;
System.out.println("The new account ID is " + newAccountId);
```
```go Go theme={null}
//Create new ECDSA key
ecdsaPrivateKey, _ := hedera.PrivateKeyGenerateECDSA()
ecdsaPublicKey := ecdsaPrivateKey.PublicKey()
//Create the transaction
transaction := hedera.NewAccountCreateTransaction().
SetKeyWithAlias(ecdsaPublicKey).
// DO NOT set an alias with your key if you plan to update/rotate keys in the future, Use .SetKeyWithoutAlias instead
// SetKeyWithoutAlias(ecdsaPublicKey).
SetInitialBalance(hedera.NewHbar(1))
//Sign the transaction with the client operator private key and submit to a Hedera network
txResponse, err := transaction.Execute(client)
//Request the receipt of the transaction
receipt, err := txResponse.GetReceipt(client)
//Get the account ID
newAccountId := *receipt.AccountID
fmt.Printf("The new account ID is %v\n", newAccountId)
```
```rust Rust theme={null}
// Create new ECDSA key
let ecdsa_public_key = PrivateKey::generate_ecdsa().public_key();
// Create the transaction
let transaction = AccountCreateTransaction::new()
.key_with_alias(ecdsa_public_key)
// DO NOT set an alias with your key if you plan to update/rotate keys in the future, Use .key_without_alias instead
// .key_without_alias(ecdsa_public_key)
.initial_balance(Hbar::from(1));
// Sign the transaction with the client operator private key and submit to a Hedera network
let tx_response = transaction
.execute(&client)
.await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the account ID
let new_account_id = receipt.account_id.unwrap();
println!("The new account ID is {}", new_account_id);
// v0.34.0
```
## Get Transaction Values
| Method | Type | Description |
| -------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------- |
| `getKey()` | Key | Returns the public key on the account |
| `getInitialBalance()` | Hbar | Returns the initial balance of the account |
| `getAutoRenewPeriod()` | Duration | Returns the auto renew period on the account |
| `getDeclineStakingReward()` | boolean | Returns whether or not the account declined rewards |
| `getStakedNodeId()` | long | Returns the node ID |
| `getStakedAccountId()` | AccountId | Returns the node account ID |
| `getReceiverSignatureRequired()` | boolean | Returns whether the receiver signature is required or not |
| **Method** | **Type** | Description |
| --- | --- | --- |
| `getKey()` | Key | Returns the public key on the account |
| `getInitialBalance()` | Hbar | Returns the initial balance of the account |
| `getAutoRenewPeriod()` | Duration | Returns the auto renew period on the account |
| `getDeclineStakingReward()` | boolean | Returns whether or not the account declined rewards |
| `getStakedNodeId()` | long | Returns the node ID |
| `getStakedAccountId()` | AccountId | Returns the node account ID |
| `getReceiverSignatureRequired()` | boolean | Returns whether the receiver signature is required or not |
| `getHighVolume()` | boolean | Returns whether this transaction uses [high-volume throttles](/hedera/core-concepts/high-volume-entity-creation) |
This transaction supports [high-volume entity creation](/hedera/core-concepts/high-volume-entity-creation) (HIP-1313). Setting `setHighVolume(true)` routes the transaction through dedicated high-volume throttle capacity with variable-rate pricing. Always pair this with `setMaxTransactionFee()` to cap your costs.
#### **Account Alias**
If an alias is set during account creation, it becomes [immutable](/hedera/support-and-community/glossary#immutable), meaning it cannot be changed. If you plan to update or rotate keys in the future, do not set the alias at the time of initial account creation. The alias can be set after finalizing all key updates.
```javascript JavaScript theme={null}
//Create an account with 1 HBAR
const transaction = new AccountCreateTransaction()
// The only _required_ property here is `key`
.setKeyWithAlias(newPublicKey)
// Do NOT set an alias if you need to rotate keys in the future. Use .setKeyWithoutAlias instead
// .setKeyWithoutAlias(newPublicKey)
.setInitialBalance(new Hbar(1));
//Return the key on the account
const accountKey = transaction.getKey();
```
```java Java theme={null}
//Create an account with 1 hbar
AccountCreateTransaction transaction = new AccountCreateTransaction()
// The only _required_ property here is `key`
.setKeyWithAlias(newPublicKey)
// DO NOT set an alias with your key if you plan to update/rotate keys in the future, Use .setKeyWithoutAlias instead
// .setKeyWithoutAlias(newPublicKey)
.setInitialBalance(new Hbar(1));
//Return the key on the account
Key accountKey = transaction.getKey();
```
```go Go theme={null}
//Create an account with 1 hbar
AccountCreateTransaction := hedera.NewAccountCreateTransaction().
SetKeyWithAlias(newPublicKey).
// DO NOT set an alias with your key if you plan to update/rotate keys in the future, Use .SetKeyWithoutAlias instead
// SetKeyWithoutAlias(newPublicKey).
SetInitialBalance(hedera.NewHbar(1))
//Return the key on the account
accountKey, err := AccountCreateTransaction.GetKey()
```
# Delete an account
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/accounts-and-hbar/delete-an-account
A transaction that deletes an existing account from the Hedera network. Before deleting an account, the existing HBAR must be transferred to another account. Submitting a transaction to delete an account without assigning a beneficiary via `setTransferAccountId()` will result in a `ACCOUNT_ID_DOES_NOT_EXIST` error. Transfers cannot be made into a deleted account. A record of the deleted account will remain in the ledger until it expires. The expiration of a deleted account can be extended. The account that is being deleted is required to sign the transaction.
**Note**: The `setTransferAccountId()` method is required, regardless of whether the account has a zero balance.
**Transaction Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for the base transaction fee.
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your transaction fee cost.
**Transaction Signing Requirements**
* The account that is being deleted is required to sign the transaction.
### Methods
| Method | Type | Description | Requirement |
|---|
setAccountId(\) | AccountId | The ID of the account to delete. | Required |
setTransferAccountId(\) | AccountId | The ID of the account to transfer the remaining funds to. | Required |
```java Java theme={null}
//Create the transaction to delete an account
AccountDeleteTransaction transaction = new AccountDeleteTransaction()
.setAccountId(accountId)
.setTransferAccountId(OPERATOR_ID);
//Freeze the transaction for signing, sign with the private key of the account that will be deleted, sign with the operator key and submit to a Hedera network
TransactionResponse txResponse = transaction.freezeWith(client).sign(newKey).execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
```
```javascript JavaScript theme={null}
//Create the transaction to delete an account
const transaction = await new AccountDeleteTransaction()
.setAccountId(accountId)
.setTransferAccountId(OPERATOR_ID)
.freezeWith(client);
//Sign the transaction with the account key
const signTx = await transaction.sign(accountKey);
//Sign with the client operator private key and submit to a Hedera network
const txResponse = await signTx.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus);
//2.0.5
```
```java Go theme={null}
//Create the transaction to delete an account, freeze the transaction for signing
transaction, err := hedera.NewAccountDeleteTransaction().
SetAccountID(newAccountID).
SetTransferAccountID(operatorAccountID).
FreezeWith(client)
if err != nil {
panic(err)
}
//Sign with the private key of the account that will be deleted, sign with the operator key and submit to a Hedera network
txResponse, err := transaction.Sign(accountKey).Execute(client)
if err != nil {
panic(err)
}
//Request the receipt of the transaction
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction consensus status
transactionStatus := receipt.Status
fmt.Printf("The transaction consensus status is %v\n", transactionStatus)
//v2.0.0
```
```rust Rust theme={null}
// Create the transaction to delete an account
let transaction = AccountDeleteTransaction::new()
.account_id(account_id)
.transfer_account_id(operator_id);
// Freeze the transaction for signing, sign with the private key of the account that will be deleted
let tx_response = transaction
.freeze_with(&client)?
.sign(account_key)
.execute(&client)
.await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
## Get transaction values
| Method | Type | Description |
|---|
getAccountId(\) | AccountId | The account to delete |
getTransferAccountId(\) | AccountId | The account to transfer the remaining funds to |
```java Java theme={null}
//Create the transaction to delete an account
AccountDeleteTransaction transaction = new AccountDeleteTransaction()
.setAccountId(newAccountId)
.setTransferAccountId(OPERATOR_ID);
//Get the account ID from the transaction
AccountId transactionAccountId = transaction.getAccountId()
System.out.println("The account to be deleted in this transaction is " +transactionAccountId)
//v2.0.0
```
```java JavaScript theme={null}
//Create the transaction to delete an account
const transaction = new AccountDeleteTransaction()
.setAccountId(newAccountId)
.setTransferAccountId(OPERATOR_ID);
//Get the account ID from the transaction
const transactionAccountId = transaction.getAccountId()
console.log("The account to be deleted in this transaction is " +transactionAccountId)
```
```java JavaScript theme={null}
//Create the transaction to delete an account
transaction, err := hedera.NewAccountDeleteTransaction().
SetAccountID(newAccountID).
SetTransferAccountID(operatorAccountID)
//Get the account ID from the transaction
transactionAccountId := transaction.GetAccountID()
//v2.0.0
```
# Network Response Messages
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/accounts-and-hbar/errors
Network response messages and their descriptions.
| **Errors** | **Description** |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `ACCOUNT_ID_DOES_NOT_EXIST` | The account id passed has not yet been created. |
| `ACCOUNT_UPDATE_FAILED` | The update of the account failed |
| `ACCOUNT_DELETED` | The account has been marked as deleted |
| `INVALID_ACCOUNT_AMOUNTS` | The crypto transfer credit and debit do not sum equal to 0 |
| `INVALID_INITIAL_BALANCE` | Attempt to set the negative initial balance |
| `INVALID_RECEIVE_RECORD_THRESHOLD` | Attempt to set negative receive record threshold |
| `INVALID_SEND_RECORD_THRESHOLD` | Attempt to set negative send record threshold |
| `SETTING_NEGATIVE_ACCOUNT_BALANCE` | Attempting to set negative balance value for the crypto account |
| `TRANSFER_LIST_SIZE_LIMIT_EXCEEDED` | Exceeded the number of accounts (both from and to) allowed for crypto transfer list |
| `TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT` | Transfer Account should not be same as Account to be deleted |
| `NO_REMAINING_AUTOMATIC_ASSOCIATIONS` | The account has reached the limit on the automatic associations count. |
| `EXISTING_AUTOMATIC_ASSOCIATIONS_EXCEED_GIVEN_LIMIT` | Already existing automatic associations are more than the new maximum automatic associations. |
| `REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT` | Cannot set the number of automatic associations for an account more than the maximum allowed token associations tokens.maxPerAccount |
# Get account balance
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/accounts-and-hbar/get-account-balance
A query that returns the account balance for the specified account. Requesting an account balance is currently free of charge. Queries do not change the state of the account or require network consensus. The information is returned from a single node processing the query.
In Services release 0.50, returning token balance from the consensus node was deprecated with HIP-367. This query returns token information by requesting the information from the Hedera Mirror Node APIs via [/api/v1/accounts/\{id}/tokens](https://mainnet.mirrornode.hedera.com/api/v1/docs/#/accounts/listTokenRelationshipByAccountId). Token symbol is not returned in the response.
#### **DEPRECATION NOTICE: `AccountBalanceQuery`**
The `AccountBalanceQuery` is deprecated and will be completely removed in **July 2026**. This is the only SDK method presented on this page and it will no longer function after this date.
A gradual throttle reduction begins in **May 2026**. To avoid rate limiting and future service disruptions, you must migrate to the Mirror Node REST API.
📚 **For the full migration guide, read:** [Migrating from AccountBalanceQuery: What You Need to Know](https://hedera.com/blog/migrating-from-accountbalancequery-what-you-need-to-know)
#### **Recommend Using Mirror Node REST API**
For obtaining account balance and historical balance information, consider using the Mirror Node REST API endpoint [**List Account Balances**](https://docs.hedera.com/api-reference/balances/list-account-balances) which offers several advantages:
* **Cost-effective and scalable:** [Mirror node providers](/hedera/core-concepts/mirror-nodes/hedera-mirror-node#mainnet) offer paid plans with a large number of queries included. The Hedera-hosted mirror node offers free queries with specific throttles for testing. While account balance queries via SDK are currently free, this is subject to change in the future.
* **Performance:** Mirror nodes don't burden consensus nodes, allowing them to focus on processing transactions and providing efficient access to historical data without impacting network performance.
* **Historical data:** Mirror nodes store complete transaction history and balance snapshots - ideal for analytics, auditing, and monitoring past activity.
📚 **For more details on querying data, read:** [Querying Data on Hedera: SDK vs Mirror Node REST API](https://hedera.com/blog/querying-data-on-hedera-sdk-vs-mirror-node-rest-api/)
**Query Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for the base transaction fee.
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your query fee cost.
**Query Signing Requirements**
* The client operator private key is required to sign the query request.
### Methods
| Method | Type | Description |
|---|
setAccountId(\) | AccountID | The account ID to return the current balance for. |
setContractId(\) | ContractID | The contract ID to return the current balance for. |
```java Java theme={null}
//Create the account balance query
AccountBalanceQuery query = new AccountBalanceQuery()
.setAccountId(accountId);
//Sign with client operator private key and submit the query to a Hedera network
AccountBalance accountBalance = query.execute(client);
//Print the balance of hbars
System.out.println("The hbar account balance for this account is " +accountBalance.hbars);
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the account balance query
const query = new AccountBalanceQuery()
.setAccountId(accountId);
//Submit the query to a Hedera network
const accountBalance = await query.execute(client);
//Print the balance of hbars
console.log("The hbar account balance for this account is " +accountBalance.hbars);
//v2.0.7
```
```go Go theme={null}
//Create the account balance query
query := hedera.NewAccountBalanceQuery().
SetAccountID(newAccountId)
//Sign with client operator private key and submit the query to a Hedera network
accountBalance, err := query.Execute(client)
if err != nil {
panic(err)
}
//Print the balance of hbars
fmt.Println("The hbar account balance for this account is ", accountBalance.Hbars.String())
//v2.0.0
```
```rust Rust theme={null}
// Create the query
let query = AccountBalanceQuery::new()
.account_id(account_id);
// Sign with client operator private key and submit to a Hedera network
let account_balance = query.execute(&client).await?;
println!("The account balance is {:?}", account_balance.hbars);
// v0.34.0
```
# Get account info
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/accounts-and-hbar/get-account-info
A query that returns the current state of the account. This query **does not** include the list of records associated with the account. Anyone on the network can request account info for a given account. Queries do not change the state of the account or require network consensus. The information is returned from a single node processing the query.
In Services release 0.50, returning token balance information from the consensus node was deprecated with HIP-367. This query now returns token information by requesting the information from the Hedera Mirror Node APIs via [/api/v1/accounts/\{id}/tokens](https://mainnet.mirrornode.hedera.com/api/v1/docs/#/accounts/listTokenRelationshipByAccountId). Token symbol is not returned in the response.
**Account Properties**
#### **Recommend Using Mirror Node REST API**
For obtaining account information and historical data, consider using the Mirror Node REST API endpoint [**Get Account by Alias, ID, or EVM Address**](https://docs.hedera.com/api-reference/accounts/get-account-by-alias-id-or-evm-address) which offers several advantages:
* **Cost-effective and scalable:** [Mirror node providers](/hedera/core-concepts/mirror-nodes/hedera-mirror-node#mainnet) offer paid plans with a large number of queries included. The Hedera-hosted mirror node offers free queries with specific throttles for testing. While some SDK queries are currently free, these are subject to change in the future.
* **Performance:** Mirror nodes don't burden consensus nodes, allowing them to focus on processing transactions and providing efficient access to historical data without impacting network performance.
* **Historical data:** Mirror nodes store complete transaction history and balance snapshots - ideal for analytics, auditing, and monitoring past activity.
📚 ***For more details, please read our [blog post on querying data](https://hedera.com/blog/querying-data-on-hedera-sdk-vs-mirror-node-rest-api).***
**Query Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for the base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your query fee cost
**Query Signing Requirements**
* The client operator private key is required to sign the query request.
### Methods
| Method | Type | Requirement |
|---|
setAccountId(\) | AccountId | Required |
\.accountId | AccountId | Optional |
\.contractAccountId | String | Optional |
\.isDeleted | boolean | Optional |
\.key | Key | Optional |
\.balance | HBAR | Optional |
\.isReceiverSignatureRequired | boolean | Optional |
\.ownedNfts | long | Optional |
\.maxAutomaticTokenAssociations | int | Optional |
\.accountMemo | String | Optional |
\.expirationTime | Instant | Optional |
\.autoRenewPeriod | Duration | Optional |
\.ledgerId | LedgerId | Optional |
\.ethereumNonce | long | Optional |
\.stakingInfo | StakingInfo | Optional |
\.tokenRelationships | Map\ | Optional |
| | |
```java Java theme={null}
//Create the account info query
AccountInfoQuery query = new AccountInfoQuery()
.setAccountId(newAccountId);
//Submit the query to a Hedera network
AccountInfo accountInfo = query.execute(client);
//Print the account key to the console
System.out.println(accountInfo);
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the account info query
const query = new AccountInfoQuery()
.setAccountId(newAccountId);
//Sign with client operator private key and submit the query to a Hedera network
const accountInfo = await query.execute(client);
//Print the account info to the console
console.log(accountInfo);
//v2.0.0
```
```go Go theme={null}
//Create the account info query
query := hedera.NewAccountInfoQuery().
SetAccountID(newAccountId)
//Sign with client operator private key and submit the query to a Hedera network
accountInfo, err := query.Execute(client)
if err != nil {
panic(err)
}
//Print the account info to the console
fmt.Println(accountInfo)
//v2.0.0
```
```rust Rust theme={null}
// Create the account info query
let query = AccountInfoQuery::new()
.account_id(new_account_id);
// Submit the query to a Hedera network
let account_info = query.execute(&client).await?;
// Print the account info to the console
println!("{:?}", account_info);
// v0.34.0
```
# Transfer cryptocurrency
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/accounts-and-hbar/transfer-cryptocurrency
A transaction that transfers HBAR and tokens between Hedera accounts. You can enter multiple transfers in a single transaction. The net value of HBAR between the sending accounts and receiving accounts must equal zero.
For a CryptoTransferTransactionBody:
* Max of 10 balance adjustments in its HBAR transfer list.
* Max of 10 fungible token balance adjustments across all its token transfer list.
* Max of 10 NFT ownership changes across all its token transfer list.
* Max of 20 balance adjustments or NFT ownership changes implied by a transaction (including custom fees).
* If you are transferring a token with custom fees, only two levels of nesting fees are allowed.
* The sending account is responsible to pay for the custom token fees.
**Transaction Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for the base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your transaction fee cost
**Spender Account Allowances**
An account can have [another account](/hedera/sdks-and-apis/sdks/accounts-and-hbar/approve-an-allowance) spend tokens on its behalf. If the delegated spender account is transacting tokens from the owner account that authorized the allowance, the owner account needs to be specified in the transfer transaction by calling one of the following:
* `addApprovedHbarTransfer()`
* `addApprovedTokenTransfer()`
* `addApprovedNftTransfer()`
* `addApprovedTokenTransferWithDecimals()`
The debiting account is the owner's account when using this feature.
**Note**: The allowance spender must pay the fee for the transaction.
**Transaction Signing Requirements**
* The accounts the tokens are being debited from are required to sign the transaction
* If an authorized spender account is spending on behalf of the account that owns the tokens then the spending account is required to sign
* The transaction fee-paying account is required to sign the transaction
## Constructor
| **Constructor** | **Description** |
| --------------------------- | ------------------------------------------ |
| `new TransferTransaction()` | Initializes the TransferTransaction object |
## Transaction Properties
| **Method** | **Type** | **Requirement** |
| ----------------------------------------------------------------------------------- | ----------------------------- | --------------- |
| `addHbarTransfer()` | AccountId, Hbar | Required |
| `addTokenTransfer()` | TokenId, AccountId, long | Optional |
| `addNftTransfer()` | NftId, AccountId, AccountId | Optional |
| `addTokenTransferWithDecimals()` | TokenId, AccountId, long, int | Optional |
| `addApprovedHbarTransfer()` | AccountId, Hbar | Optional |
| `addApprovedTokenTransfer()` | TokenId, AccountId, long | Optional |
| `addApprovedNftTransfer()` | NftId, AccountId, AccountId | Optional |
| `addApprovedTokenTransferWithDecimals()` | TokenId, AccountId, long, int | Optional |
| `setHighVolume()` | boolean | Optional |
This transaction supports [high-volume entity creation](/hedera/core-concepts/high-volume-entity-creation)
(HIP-1313) when the transfer **auto-creates new accounts**. Setting `setHighVolume(true)`
routes the account-creation portion of the transfer through dedicated high-volume throttle
capacity with variable-rate pricing. The transfer portion itself uses standard throttles
regardless of this flag. Always pair this with `setMaxTransactionFee()` to cap your costs.
```java Java theme={null}
// Create a transaction to transfer 1 HBAR
TransferTransaction transaction = new TransferTransaction()
.addHbarTransfer(OPERATOR_ID, new Hbar(-1))
.addHbarTransfer(newAccountId, evmAddress, new Hbar(1));
//Submit the transaction to a Hedera network
TransactionResponse txResponse = transaction.execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//Version 2.0.0
```
```javascript JavaScript theme={null}
// Create a transaction to transfer 1 HBAR
const transaction = new TransferTransaction()
.addHbarTransfer(OPERATOR_ID, new Hbar(-1))
.addHbarTransfer(newAccountId, evmAddress, new Hbar(1));
//Submit the transaction to a Hedera network
const txResponse = await transaction.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus.toString());
//v2.0.0
```
```go Go theme={null}
// Create a transaction to transfer 1 HBAR
transaction := hedera.NewTransferTransaction().
AddHbarTransfer(client.GetOperatorAccountID(), hedera.NewHbar(-1)).
AddHbarTransfer(hedera.AccountID{Account: 3}, hedera.NewHbar(1))
//Submit the transaction to a Hedera network
txResponse, err := transaction.Execute(client)
if err != nil {
panic(err)
}
//Request the receipt of the transaction
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction consensus status
transactionStatus := receipt.Status
fmt.Printf("The transaction consensus status is %v\n", transactionReceipt.Status)
//Version 2.0.0
```
```rust Rust theme={null}
// Create the transfer transaction
let transaction = TransferTransaction::new()
.hbar_transfer(account_id, Hbar::from(-10))
.hbar_transfer(recipient_id, Hbar::from(10));
// Freeze the transaction for signing, sign with the private key of the account that is sending hbars
let tx_response = transaction
.freeze_with(&client)?
.sign(account_key)
.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
## Get Transaction Values
| **Method** | **Type** | **Description** |
| ------------------------ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `getHbarTransfers()` | Map\ | Returns the HBAR transfers |
| `getTokenTransfers()` | Map\> | Returns the token transfers |
| `getTokenNftTransfers()` | Map\> | Returns the NFT transfers |
| `getHighVolume()` | boolean | Returns whether this transaction uses [high-volume throttles](/hedera/core-concepts/high-volume-entity-creation) |
```java Java theme={null}
// Create a transaction
CryptoTransferTransaction transaction = new CryptoTransferTransaction()
.addSender(OPERATOR_ID, new Hbar(1))
.addRecipient(newAccountId, new Hbar(1));
//Get transfers
List transfers = transaction.getTransfers();
//v2.0.0
```
```javascript JavaScript theme={null}
// Create a transaction
const transaction = new CryptoTransferTransaction()
.addSender(OPERATOR_ID, new Hbar(1))
.addRecipient(newAccountId, new Hbar(1));
//Get transfers
const transfers = transaction.getTransfers();
//v2.0.0
```
```go Go theme={null}
// Create a transaction
transaction := hedera.NewTransferTransaction().
AddHbarTransfer(client.GetOperatorAccountID(), hedera.NewHbar(-1)).
AddHbarTransfer(hedera.AccountID{Account: 3}, hedera.NewHbar(1))
//Get transfers
transfers := transaction.GetTransfers()
//v2.0.0
```
# Update an account
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/accounts-and-hbar/update-an-account
A transaction that updates the properties of an existing account. The network will store the latest updates on the account. If you would like to retrieve the state of an account in the past, you can query a mirror node.
**Account Properties**
**Transaction Fees**
* The sender pays for the token association fee and the rent for the first auto-renewal period.
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for the base transaction fee.
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate the cost of your transaction fee.
**Transaction Signing Requirements**
* The account key(s) are required to sign the transaction.
* If you are updating the keys on the account, the OLD KEY and NEW KEY must sign.
* If either is a key list, the key list keys are all required to sign.
* If either is a threshold key, the threshold value is required to sign.
* If you do not have the required signatures, the network will throw an `INVALID_SIGNATURE` error.
#### Maximum Auto-Associations and Fees
Accounts have a property, `maxAutoAssociations`, and the property's value determines the maximum number of automatic token associations allowed.
| Property Value | Description |
| :------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `0` | Automatic token associations or token airdrops are not allowed, and the account must be manually associated with a token. This also applies if the value is less than or equal to `usedAutoAssociations`. |
| `-1` | Unlimited automatic token associations are allowed, and this is the default for accounts created via [auto account creation](../../../core-concepts/accounts/auto-account-creation) and for accounts that began as hollow accounts and are now complete. Accounts with `-1` can receive new tokens without manually associating them. The sender still pays the `maxAutoAssociations` fee and initial rent for each association. |
| `> 0` | If the value is a positive number (number greater than 0), the number of automatic token associations an account can have is limited to that number. |
The sender pays the `maxAutoAssociations` fee and the rent for the first auto-renewal period for the association. This is in addition to the typical transfer fees. This ensures the receiver can receive tokens without association and makes it a smoother transfer process.
Reference: [HIP-904](https://hips.hedera.com/hip/hip-904)
### Methods
| Method | Type | Requirement |
| ------------------------------------------------- | --------- | ----------- |
| `setAccountId()` | AccountId | Required |
| `setKey()` | Key | Optional |
| `setReceiverSignatureRequired()` | Boolean | Optional |
| `setMaxAutomaticTokenAssociations()` | int | Optional |
| `setAccountMemo()` | String | Optional |
| `setAutoRenewPeriod()` | Duration | Optional |
| `setStakedAccountId()` | AccountId | Optional |
| `setStakedNodeId()` | long | Optional |
| `setDeclineStakingReward()` | boolean | Optional |
| `setExpirationTime()` | Instant | Disabled |
```java Java theme={null}
//Create the transaction to update the key on the account
AccountUpdateTransaction transaction = new AccountUpdateTransaction()
.setAccountId(accountId)
.setKey(updateKey);
//Sign the transaction with the old key and new key, submit to a Hedera network
TransactionResponse txResponse = transaction.freezeWith(client).sign(oldKey).sign(newKey).execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//Version 2.0.0
```
```javascript JavaScript theme={null}
//Create the transaction to update the key on the account
const transaction = await new AccountUpdateTransaction()
.setAccountId(accountId)
.setKey(updateKey)
.freezeWith(client);
//Sign the transaction with the old key and new key
const signTx = await (await transaction.sign(oldKey)).sign(newKey);
//SIgn the transaction with the client operator private key and submit to a Hedera network
const txResponse = await signTx.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus.toString());
//v2.0.5
```
```go Go theme={null}
//Create the transaction to update the key on the account
transaction, err := hedera.NewAccountUpdateTransaction().
SetAccountID(newAccountId).
SetKey(updateKey.PublicKey()).
FreezeWith(client)
if err != nil {
panic(err)
}
//Sign the transaction with the old key and new key, submit to a Hedera network
txResponse, err := transaction.Sign(newKey).Sign(updateKey).Execute(client)
//Request the receipt of the transaction
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction consensus status
transactionStatus := receipt.Status
println("The transaction consensus status is ", transactionStatus)
//Version 2.0.0
```
```rust Rust theme={null}
// Create the transaction to update the key on the account
let transaction = AccountUpdateTransaction::new()
.account_id(account_id)
.key(update_key);
// Sign the transaction with the old key and new key
let tx_response = transaction
.freeze_with(&client)?
.sign(old_key)
.sign(new_key)
.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
## Get transaction values
Return the properties of an account create transaction.
| Method | Type | Description |
| -------------------------------- | --------- | --------------------------------------------------------- |
| `getKey()` | Key | Returns the public key on the account |
| `getInitialBalance()` | Hbar | Returns the initial balance of the account |
| `getReceiverSignatureRequired()` | boolean | Returns whether the receiver signature is required or not |
| `getExpirationTime()` | Instant | Returns the expiration time |
| `getAccountMemo()` | String | Returns the account memo |
| `getDeclineStakingReward()` | boolean | Returns whether or not the account is declining rewards |
| `getStakedNodeId()` | long | Returns the node ID the account is staked to |
| `getStakedAccountId()` | AccountId | Returns the account ID the node is staked to |
| `getAutoRenewPeriod()` | Duration | Returns the auto renew period on the account |
```java Java theme={null}
//Create a transaction
AccountUpdateTransaction transaction = new AccountUpdateTransaction()
.setAccountId(accountId)
.setKey(newKeyUpdate);
//Get the key on the account
Key accountKey = transaction.getKey();
//v2.0.0
```
```javascript JavaScript theme={null}
//Create a transaction
const transaction = new AccountUpdateTransaction()
.setAccountId(accountId)
.setKey(newKeyUpdate);
//Get the key of an account
const accountKey = transaction.getKey();
//v2.0.0
```
```go Go theme={null}
//Create the transaction
transaction, err := hedera.NewAccountUpdateTransaction().
SetAccountID(newAccountId).
SetKey(updateKey.PublicKey())
//Get the key of an account
accountKey := transaction.GetKey()
//v2.0.0
```
# Network Address Book
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/address-book
The address book contains the node ID and node address information to communicate with Hedera node(s) in a specific network. There are two ways you can get the address book for a network.
* You can submit a `FileContentsQuery()` to a consensus node for file `0.0.101` or `0.0.102`
* You can also query the Hedera mirror node using the `AddressBookQuery()`
```java Java theme={null}
//Create the query
FileContentsQuery fileQuery = new FileContentsQuery()
.setFileId( FileId.fromString("0.0.102"));
//Sign with the operator private key and submit to a Hedera network
ByteString contents = fileQuery.execute(client);
System.out.println(contents.toStringUtf8());
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the query
const fileQuery = new FileContentsQuery()
.setFileId( FileId.fromString("102"));
//Sign with the operator private key and submit to a Hedera network
const contents = await fileQuery.execute(client);
console.log(contents.toString())
//v2.0.7
```
```go Go theme={null}
//Create the query
fileQuery := hedera.NewFileContentsQuery().
SetFileID(hedera.FileIDForAddressBook())
//Sign with the operator private key and submit to a Hedera network
contents, err := fileQuery.Execute(client)
if err != nil {
panic(err)
}
fmt.Println(string(contents))
//v2.0.0
```
```rust Rust theme={null}
// Create the query
let file_query = FileContentsQuery::new()
.file_id(FileId::from_str("0.0.102"));
// Sign with the operator private key and submit to a Hedera network
let contents = file_query.execute(&client).await?;
println!("{:?}", String::from_utf8(contents)?);
// v0.34.0
```
```java Java theme={null}
//Mirror node address book query
NodeAddressBook addressBook = new AddressBookQuery()
.setFileId(FileId.ADDRESS_BOOK)
.execute(client);
System.out.println(addressBook);
//SDK Version: 2.10.0-beta.1
```
```javascript JavaScript theme={null}
//Mirror node address book query
const addressBook = new AddressBookQuery()
.setFileId(FileId.ADDRESS_BOOK)
.execute(client);
console.log(addressBook);
//SDK Version: 2.10.0
```
```go Go theme={null}
//Mirror node address book
addressBook, err := hedera.NewAddressBookQuery().
SetFileID(hedera.FileIDForAddressBook()).
Execute(client)
//Print address book to console
fmt.Print(addressBook)
//SDK Version: 2.10.0
```
```rust Rust theme={null}
// Mirror node address book query
let address_book = NodeAddressBookQuery::new()
.execute(&client)
.await?;
println!("{:?}", address_book);
// v0.34.0
```
#### Sample Output:
```txt theme={null}
35.231.208.1480.0.3"308201a2300d06092a864886f70d01010105000382018f003082018a02820181009f1f8a121c2fd6c76fd508d3e429f0c64bcb44c82a70573552aadcad071569e721958f5a5d09f9587ffafcfbe5341a2f0114acae346ef3c90213d3436ebb27f4350c990c5c8c3f8e1e36707bc08d42560823e3f24e09a03ad0955a5098019629dd04b27b251dce055f3ddcb0a41d66f0941b0b87cdfe3498d46038ab5df06f62a5ade08598573a88c8f5860dc1492a6e186485a9b13250e6d17b80cd39c5c819109e73ca732db23ef8baa776ec85ce0091becb2edefbaa5ed3e5dbfbd1f885a4fa881af3f144a8a565853533d89393592086b2d1d362e45bfe1fb45683aba6c640979ad6b46877184726c6ebd58b2eae85c7cfe3fbabef5f6cced850034b3847206c2d678c361876026b8d351e002af5e0ffe6f5b1f295fdc2f469caa2d2381ea0b48ca987cc2c8e635e8b19ce5e172a93761a8d490a9a4518d7255880a14d77b7ba774892b92a40bb81362e34fc6d5178d9b30112934205cb77fb9a282427394564a8554ea47286a47f86239e75c94789ce98c99844782462944f613167d7b502030100012:`ffd6ada74a3a34a904bea47603086f8bef3b6be18abed44c4d40e12fb130b97bd6b855aec5d0b90b0b8c7354d5f3b0e4B
35.199.15.1770.0.4"308201a2300d06092a864886f70d01010105000382018f003082018a0282018100c557af579fa83501be899b28907765bfdfcd52ab432b0195a1f1ecd86fc00ab6c5509b0fdd97edd3cb5cea56a295f312abb550831dbf963f450118b4fcc6e22cf4676200ce9cc8edfbbf558dc69f024264ad7d3dab23bed2133c274e6934489155db1087f90370905c64185a6211dc742fb9a6909d82186947b277463dfb3ff0acd47eff12ead1f6972ef2c1203793c45e77575be4fa110c7e40fa8db9c6187d113f4704014179071abf59be7d2b0de82de4215dc25506b1c9c26e4917401c997506e377e6bf03b688727e7940fad69c5e0da3cd5cbd2be777350aea2d0d47e97a448c84be6ce134d64bee0985c29162f4c1e567cca93d06a3c1be8abce35b557fb77f4fe671a66dec790756d0e8818165f2bacaa891aae7ac7437fc7175b6eb6deb7472378751bb6bf9b0e1483f9668e9fdbd5604c39b14d9e2bedeec846a980d704d171e7ba4b7fcd1a30d945ca12f47a325d9398aa18f97066054d4d15fc8994e2debe73e9271d548683f61ea44fb25071e3518a78ed3eb37e71a0691f2670203010001(2:`f0d94accf6dff372874c9dbd8d7992eb317af5001ca4196aba265809cb3d200ba961a5438c3a5ed05c83bdf9cd115d22B
35.225.201.1950.0.5"308201a2300d06092a864886f70d01010105000382018f003082018a02820181009ba457b73305f04a91cc46b1b965c4e841751abc8b1415a0badfd1f32c2482386a22725eb7ec74dea21e50617d648ea5ac393741ab01b8efb321239b8d4fdb1dfbeb9e3f39aa46580dd045d18ca44d002c37ddb527cce4ddc32bfc73419671f4ca4464a3f2a84fc85c71acf0e5a89626df69a81474ed16529f801a8afa97e435c4e04a964a357527288843e58f0a05cf5153ee4507b2c68b3d7fb54ae6a95a959c87a12f630e95c7b1b3c3695e858662417926d76c16983faf61225038745907e9cf13d67c2acd503ca451c85933ac4118acc279801cb968349903145ced27629dd08916317093587a77c2205cfa52543b53c3b6ea15b84e3d2c30c1ed752a4633c36b25b9893ea02ad562eb9b7868b3b4f47f4a25e356064962ac7b25e582944f00d30798a262f9214d8c5e74d0a8376cc2d6ba64e18f5e4a40afac625062d2ca23cd2800708321d3834314f0e5844859232673a32e70ae0d711e310581bcdb14e87134694c6e0930f46b37b96d49a64573947331e7e507d9e56de5e6146f2f0203010001(2:`ca678ebcbd3dc8648f7ed03fb59f0e21af67513eaee51318e6b549be5ace906edc1ffa26d93a57acec9be77f40eaeed7B
35.247.109.1350.0.6"308201a2300d06092a864886f70d01010105000382018f003082018a0282018100c42ccac5fbc691fbbebda87ffd1e75bdcd8922494cf44fdbccee49788521c378bf77db0934ec0d2183d7c51db66f864c11ab7de1ac3c4cfdc1f093a2d6f37e2b34cbe4c8131f9683ad42878c83d3554c645aa167bcfb064a83dc45c5b1158499f9d92587fff7abcd5f221cd8150548413000fa6e5659089b1dfd65766ea78eaedfca6b45455fd8ab5984dbe35e5795d2c635ea7974d43e8eae4febffe492e707b48b1b0fc6481ae9e09d39133009b7d26402e6e52e5e91b2b380d88f0be7fb4b303e70219785057aa94ce924c4926e916569286e86b3ba651ca2a0a63df4f6907fefe3483d93b4ce1d4d03c7142111375b2c2c51d4eb839e37af530b2cbd6f50d4cb36e27937170d9cddac0ace2cc24b804b0a27351cf830b76525e26dfb9dbf49a056624a76862494e7263d0d70cebae952943e55842f5cad13fcf60a2e6dcf7a1d533f3a5bb54ec21918c76e525ba29146675831e17e36c61fe85498828d09b762015412b2e527849baec1cffc77de4c294c550811e598ff24da15a34569dd0203010001(2:`2471f3fe8140681fe91913d2cc063f065e4490ae62ff5d548a5abe131d2af96cbe3ac25bbe24366ca4f8f0e76cf945f3B
35.235.65.510.0.7"308201a2300d06092a864886f70d01010105000382018f003082018a0282018100902f0490a9b7f5d2cd1c0d96c6a6990f573b5f0eb5bdbba39661ef023092419344669969a68a4c7071d329990fb1792e9001cb5598ea71c2d6676824320ee4cabf1dd357ae7f2adbedc1b1b0a9d95623779b4c4c7b47c4787a16ee7188c7217177624a9264ab39c41f7ff0b45a89bda40c4ad07c4d596d5f09d7056bcb5a35f44f95a59c266e09892dcbe46ad51f2d2b3e991a8f6658e1f2cb94c773eb44c44e892d1e55c1076f1608319ee657e40f192967543ab42ab222386d17586e253748dabd025e50b50ae6050720e239d64ee6fb4507c0614dd4be7afdb1330890ff3a6e176527c3116af129a9ac5e336d9f601e7127a6d7d820ad2f902dac9b248668a1bab08d10342ea69a7097132ff7120cc64fcde7840c656ba1732ba95e9c36751175e4ec3d84a7e0d28842b41bbbbd6f28e46c3a6633e1827965c55820d50dae2b0465cc0d42e195b9d1532e6225eb998d6a49079a8a1cd4d0175de3c87f97614847b3cbb17aa34be820b7b3ad98ac3faef993a6778974782c0c4ae3fabbcc430203010001(2:`f357873d4114a1aef03adc6ba69efaf2690e227abc16a6fc6e5049a63fbd9688004b14e463c20e38436a3a24d3182dd8B
34.106.247.650.0.8"308201a2300d06092a864886f70d01010105000382018f003082018a028201810091d7dfff78f4efbe5890450c5bc9e3534bffadad93fb7afb15bc7bcf67d3d3b413bd99940dd82564ada04ab2e4edf0a1c0b8fb7e1a8092e9138e960be2cc68b5b97f57d281c5872e97a479fc848363160e3863b57b33e4869b185ace5e36bd43ae5fa678c9eb66f1f4014786826b2f8fa7e0060f4405c0a8f9da7205ff4683a243fa0f315f1afbb4a4d140d02234e4473fb92fcb38f3eb28c60cf7cbfb64e069c18086e4dd61938920ae0fd7c193e6e104e65b817ed9398e232237fdf08322c9cec09d4099272a7c015d22b4dcc969f6ea1f518902105df60092b55a41b4f32b957b57d84e5b223905e8698951733ea9f2e2461ec0d6522ee816d5850facfeb412cff9b99943a87dc0d046447ce93b97e16d73b96b4263962f81fcf9458e57577c780a6f1615aa7a12326738e269bb731f89e891622e577ea54420bf0ca46be6fc4f71cf2681ac0252aa885e13be672cd284590427dcd137cf311625e8bee3b08fdcaaf465b387ce7cb33816f2c14a6b99ac7d734318cfc59b7ed939bafef8790203010001(2:`4931a78202d55f10b31575785c3f439db6819bd11003df7bc2ce92e29a517b7c21880deb4c01795744b576cd43b8498dB
34.125.23.490.0.9"308201a2300d06092a864886f70d01010105000382018f003082018a0282018100c6e18c8fbf4cd4eb104542cb20aaaa252d95f052f1086d581c44ad737bf6676c0c3f789af5265b8afb79b50912da84e0afcf7547cb1fff08d0527017eb6dc5cdf83b51969d44336a6387cd70b94bf4c9baf2029840e5f4f863d7081f0fa81e0863adedb8b89a5dac2bb552d6e7b9fba222ac28c57075538fc957992942d341fa2876e6b507e9ce7ed572e8cfda5defa364fdf8d8e23829a4ccbb478f11eee3b32ab85e072951c5d9420115fba327073494f43b5f6bebf84152e356e7b16ba764b7a3b52cb2734640163be1465e6d1fa4c6e6f66684a635c9a556aa7100dbe645df8f4c423ae45a08cb35b4bc187886e2299b5c0210a5fba3b9449f483ef94ed922e1e98c113be166b89c73582243135d442306abe5a71b77018ff335d6dd79542697b168238b96727fd1339b5f82a3b6a597d976037ae2506456c8b34e9fbf3bc32410441c4bfc8eba58597254efebfaa78809a5c8854729a5ba78ece19fc8407dd8894a6bc7844037d878cace6c152c2e89e8a64b068a6c237e09993be806890203010001(2 :`64e098615bf405f7ed5a4013446b89c488cfcd6bb25a4a676dc77eea11d33d702682f0a69a8030e8c5777d0e42203799B
```
# Build Your Hedera Client
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/client
## 1. Configure your Hedera Network
Build your client to interact with any of the Hedera network nodes. Mainnet, testnet, and previewnet are the three Hedera networks you can submit transactions and queries to.
For a predefined network (preview, testnet, and mainnet), the mirror node client is configured to the corresponding network mirror node. The default mainnet mirror node connection is to the [whitelisted mirror node](/hedera/core-concepts/mirror-nodes/hedera-mirror-node#mainnet).
To access the ***public mainnet mirror node***, use `setMirrorNetwork()` and enter `mainnet.mirrornode.hedera.com:433` for the endpoint. The gRPC API requires TLS. The following SDK versions are compatible with TLS:
* **Java:** v2.3.0+
* **JavaScript**: v2.4.0+
* **Go:** v2.4.0+
| | |
|---|
| Method | Type | Description |
Client.forPreviewnet() | | Constructs a Hedera client pre-configured for Previewnet access |
Client.forTestnet() | | Constructs a Hedera client pre-configured for Testnet access |
Client.forMainnet() | | Constructs a Hedera client pre-configured for Mainnet access |
Client.forNetwork(\) | Map\ | Construct a client given a set of nodes. It is the responsibility of the caller to ensure that all nodes in the map are part of the same Hedera network. Failure to do so will result in undefined behavior. |
Client.fromConfig(\) | String | Configure a client from the given JSON string describing a ClientConfiguration object |
Client.fromConfig(\) | Reader | Configure a client from the given JSON reader |
Client.fromConfigFile(\) | File | Configure a client based on a JSON file. |
Client.fromConfigFile(\) | String | Configure a client based on a JSON file at the given path. |
Client.forName(\) | String | Provide the name of the network.
mainnet
testnet
previewnet |
Client.\.setMirrorNetwork(\) | List\ | Define a specific mirror network node(s) ip:port in string format |
Client.\.getMirrorNetwork() | List\ | Return the mirror network node(s) ip:port in string format |
Client.setTransportSecurity() | boolean | Set if transport security should be used. If transport security is enabled all connections to nodes will use TLS, and the server's certificate hash will be compared to the hash stored in the node address book for the given network. |
Client.setNetworkUpdatePeriod() | Duration | Client automatically updates the network via a mirror node query at regular intervals. You can set the interval at which the address book is updated. |
Client.setNetworkFromAddressBook(\) | AddressBook | Client can be set from a NodeAddressBook. |
Client.setLedgerId(\) | LedgerId | The ID of the network.
LedgerId.MAINNET
LedgerId.TESTNET
LedgerId.PREVIEWNET |
Client.getLedgerId() | LedgerId | Get the ledger ID |
Client.setVerifyCertificates() | boolean | Set if server certificates should be verified against an existing address book. |
```java Java theme={null}
// From a pre-configured network
Client client = Client.forTestnet();
//For a specified network
Map nodes = new HashMap<>();
nodes.put("34.94.106.61:50211" ,AccountId.fromString("0.0.10"));
Client.forNetwork(nodes);
//v2.0.0
```
```javascript JavaScript theme={null}
// From a pre-configured network
const client = Client.forTestnet();
//For a specified network
const nodes = {"34.94.106.61:50211": new AccountId(10)}
const client = Client.forNetwork(nodes);
//v2.0.7
```
```go Go theme={null}
// From a pre-configured network
client := hedera.ClientForTestnet()
//For a specified network
node := map[string]AccountID{
"34.94.106.61:50211": {Account: 10}
}
client := Client.forNetwork(nodes)
//v2.0.0
```
```rust Rust theme={null}
// From a pre-configured network
let client = Client::for_testnet();
// For a specified network
let nodes = HashMap::from([
("34.94.106.61:50211".to_string(), AccountId::from(10))
]);
let client = Client::for_network(nodes);
// v0.34.0
```
## 2. Define the operator account ID and private key
The operator is the account that will, by default, pay the transaction fee for transactions and queries built with this client. The operator account ID is used to generate the default transaction ID for all transactions executed with this client. The operator private key is used to sign all transactions executed by this client.
| Method | Type |
| ------------------------------------------------------------------------------ | ----------------------------------------------------- |
| `Client..setOperator()` | AccountId, PrivateKey |
| `Client..setOperatorWith()` | AccountId, PrivateKey, Function\ |
### From an account ID and private key
```java theme={null}
// Operator account ID and private key from string value
AccountId OPERATOR_ID = AccountId.fromString("0.0.96928");
Ed25519PrivateKey OPERATOR_KEY = PrivateKey.fromString("302e020100300506032b657004220420b9c3ebac81a72aafa5490cc78111643d016d311e60869436fbb91c7330796928");
// Pre-configured client for test network (testnet)
Client client = Client.forTestnet()
//Set the operator with the account ID and private key
client.setOperator(OPERATOR_ID, OPERATOR_KEY);
```
```javascript JavaScript theme={null}
// Your account ID and private key from string value
const OPERATOR_ID = AccountId.fromString("0.0.96928");
const OPERATOR_KEY = PrivateKey.fromString("302e020100300506032b657004220420b9c3ebac81a72aafa5490cc78111643d016d311e60869436fbb91c7330796928");
// Pre-configured client for test network (testnet)
const client = Client.forTestnet()
//Set the operator with the account ID and private key
client.setOperator(OPERATOR_ID, OPERATOR_KEY);
```
```go Go theme={null}
// Operator account ID and private key from string value
operatorAccountID, err := hedera.AccountIDFromString("0.0.96928")
if err != nil {
panic(err)
}
operatorKey, err := hedera.PrivateKeyFromString("302e020100300506032b65700422042012a4a4add3d885bd61d7ce5cff88c5ef2d510651add00a7f64cb90de33596928")
if err != nil {
panic(err)
}
// Pre-configured client for test network (testnet)
client := hedera.ClientForTestnet()
//Set the operator with the operator ID and operator key
client.SetOperator(operatorAccountID, operatorKey)
```
```rust Rust theme={null}
// Operator account ID and private key from string value
let my_account_id = AccountId::from_str("0.0.96928")?;
let my_private_key = PrivateKey::from_str("302e020100300506032b657004220420b9c3ebac81a72aafa5490cc78111643d016d311e60869436fbb91c7330796928")?;
// Pre-configured client for test network (testnet)
let mut client = Client::for_testnet();
// Set the operator with the account ID and private key
client.set_operator(my_account_id, my_private_key);
// v0.34.0
```
### From a .env file
The .env file is created in the root directory of the SDK. The `.env` file stores account ID and the associated private key information to reference throughout your code. You will need to import the relevant dotenv module to your project files. The sample .env file may look something like this:
**.env**
```
OPERATOR_ID=0.0.941
OPERATOR_KEY=302e020100300506032b65700422042012a4a4add3d885bd61d7ce5cff88c5ef2d510651add00a7f64cb90de3359bc5e
```
```java Java theme={null}
//Grab the account ID and private key of the operator account from the .env file
AccountId OPERATOR_ID = AccountId.fromString(Objects.requireNonNull(Dotenv.load().get("OPERATOR_ID")));
Ed25519PrivateKey OPERATOR_KEY = Ed25519PrivateKey.fromString(Objects.requireNonNull(Dotenv.load().get("OPERATOR_KEY")));
// Pre-configured client for test network (testnet)
Client client = Client.forTestnet()
//Set the operator with the account ID and private key
client.setOperator(OPERATOR_ID, OPERATOR_KEY);
```
```javascript JavaScript theme={null}
//Grab the account ID and private key of the operator account from the .env file
const operatorId = process.env.OPERATOR_ID;
const operatorKey = process.env.OPERATOR_KEY;
// Pre-configured client for test network (testnet)
const client = Client.forTestnet()
//Set the operator with the account ID and private key
client.setOperator(operatorId, operatorKey);
```
```go Go theme={null}
err := godotenv.Load(".env")
if err != nil {
panic(fmt.Errorf("Unable to load environment variables from demo.env file. Error:n%v\n", err))
}
//Get the operator account ID and private key
OPERATOR_ID := os.Getenv("OPERATOR_ID")
OPERATOR_KEY := os.Getenv("OPERATOR_KEY")
myAccountID, err := hedera.AccountIDFromString(OPERATOR_ID)
if err != nil {
panic(err)
}
operatorKey, err := hedera.PrivateKeyFromString(OPERATOR_KEY)
if err != nil {
panic(err)
}
```
```rust Rust theme={null}
err := dotenv::dotenv().ok();
if err.is_err() {
panic!("Unable to load environment variables from demo.env file. Error:n{:?}", err);
}
// Get the operator account ID and private key
let my_account_id = AccountId::from_str(std::env::var("OPERATOR_ID").expect("OPERATOR_ID environment variable not set")).expect("Invalid OPERATOR_ID format");
let my_private_key = PrivateKey::from_str(std::env::var("OPERATOR_KEY").expect("OPERATOR_KEY environment variable not set")).expect("Invalid OPERATOR_KEY format");
```
## 3. Additional client modifications
The **max transaction fee** and **max query payment** are both set to 100\_000\_000 tinybar (1 HBAR). This amount can be modified by using **`setDefaultMaxTransactionFee()`**and **`setDefaultMaxQueryPayment()`**`.`
| Method | Type | Description |
|---|
Client.\.SetDefaultRegenerateTransactionId(\) | boolean | Whether or not to regenerate the transaction IDs |
Client.\.getDefaultRegenerateTransactionId(\) | boolean | Get the default regenerate transaction ID boolean value |
Client.\.setDefaultMaxTransactionFee(\) | Hbar | The maximum transaction fee the client is willing to pay |
Client.\.getDefaultMaxTransactionFee() | Hbar | Get the default max transaction fee that is set |
Client\.setDefaultMaxQueryPayment(\) | Hbar | The maximum query payment the client will pay. Default: 1 hbar |
Client\.getDefaultMaxQueryPayment() | Hbar | Get the default max query payment |
Client.\.setNetwork(\) | Map\ | Replace all nodes in this Client with a new set of nodes (e.g. for an Address Book update)
|
Client.\.getNetwork() | Map\ | Get the network nodes |
Client.\.setRequestTimeout(\) | Duration | The period of time a transaction or query request will retry from a "busy" network response |
Client.\.getRequestTimeout() | Duration | Get the period of time a transaction or query request will retry from a "busy" network response |
Client.\.setMinBackoff(\) | Duration | The minimum amount of time to wait between retries. When retrying, the delay will start at this time and increase exponentially until it reaches the maxBackoff |
Client.\.getMinBackoff() | Duration | Get the minimum amount of time to wait between retries |
Client.\.setMaxBackoff(\) | Duration | The maximum amount of time to wait between retries. Every retry attempt will increase the wait time exponentially until it reaches this time. |
Client.\.getMaxBackoff() | Duration | Get the maximum amount of time to wait between retries |
Client.\.setAutoValidateChecksums(\) | boolean | Validate checksums |
Client.\.setCloseTimeout(\) | Duration | Timeout for closing either a single node when setting a new network, or closing the entire network |
Client.\.setMaxNodeAttempts(\) | int | Set the max number of times a node can return a bad gRPC status before we remove it from the list |
Client.\.getMaxNodeAttempts() | int | Get the max node attempts set |
Client.\.setMinNodeReadmitTime(\) | Duration | The min time to wait before attempting to readmit nodes |
Client.\.getMinNodeReadmitTime() | Duration | Get the minimum node readmit time |
Client.\.setMaxNodeReadmitTime(\) | Duration | The max time to wait before attempting to readmit nodes |
Client.\.getMaxNodeReadmitTime() | Duration | Get the max node readmit time |
```java Java theme={null}
// For test network (testnet)
Client client = Client.forTestnet()
//Set your account as the client's operator
client.setOperator(operatorId, operatorKey);
//Set the default maximum transaction fee (in Hbar)
client.setDefaultMaxTransactionFee(new Hbar(10));
//Set the maximum payment for queries (in Hbar)
client.setDefaultMaxQueryPayment(new Hbar(5));
//v2.0.0
```
```javascript JavaScript theme={null}
// For test network (testnet)
const client = Client.forTestnet()
//Set your account as the client's operator
client.setOperator(operatorId, operatorKey);
//Set the default maximum transaction fee (in Hbar)
client.setDefaultMaxTransactionFee(new Hbar(10));
//Set the maximum payment for queries (in Hbar)
client.setDefaultMaxQueryPayment(new Hbar(5));
//v2.0.0
```
```go Go theme={null}
// For test network (testnet)
client := hedera.ClientForTestnet()
//Set your account as the client's operator
client.SetOperator(operatorId, operatorKey)
// Set default max transaction fee
client.SetDefaultMaxTransactionFee(hedera.HbarFrom(10, hedera.HbarUnits.Hbar))
// Set max query payment
client.setDefaultMaxQueryPayment(hedera.HbarFrom(5, hedera.HbarUnits.Hbar))
```
```rust Rust theme={null}
// For test network (testnet)
let mut client = Client::for_testnet();
// Set your account as the client's operator
client.set_operator(my_account_id, my_private_key);
// Set the default maximum transaction fee (in Hbar)
client.set_default_max_transaction_fee(Hbar::from(10));
// Set the maximum payment for queries (in Hbar)
client.set_default_max_query_payment(Hbar::from(5));
// v0.34.0
```
# Consensus Service
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/consensus-service
# Create a topic
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/consensus-service/create-a-topic
A transaction that creates a new topic recognized by the Hedera network. The newly generated topic can be referenced by its `topicId`. The `topicId` is used to identify a unique topic to submit messages to. You can obtain the new topic ID by requesting the receipt of the transaction. All messages within a topic are sequenced with respect to one another and are provided a unique sequence number.
**Note**
With the Consensus Node Release [v0.60](/hedera/networks/release-notes/services#release-v0.60), you can set an auto renew account ID without the requirement of setting an admin key on the topic.
#### Private topic
You can also create a private topic where only authorized parties can submit messages to that topic. To create a private topic you would need to set the `submitKey` property of the transaction. The `submitKey` value is then shared with the authorized parties and is required to successfully submit messages to the private topic.
#### Topic Properties
| Field | Description |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Admin Key** | Access control for updateTopic/deleteTopic. If no adminKey is specified, anyone can increase the topic's expirationTime with updateTopic, but they cannot use deleteTopic. However, if an adminKey is specified, both updateTopic and deleteTopic can be used. |
| **Submit Key** | Access control for submitMessage. No access control will be performed specified, allowing all message submissions. |
| **Topic Memo** | Store the new topic with a short publicly visible memo. (100 bytes) |
| **Auto Renew Account** | At the topic's expirationTime, the optional account can be used to extend the lifetime up to a maximum of the autoRenewPeriod or duration/amount that all funds on the account can extend (whichever is the smaller).
Currently, rent is not enforced for topics so no auto-renew payments will be made.
Note: If the developer does not explicitly set autoRenewAccount, the SDK will automatically default to using the transaction fee payer account ID for the auto renew account. This is beneficial in the event an admin key is not set.
|
| **Auto Renew Period** | The initial lifetime of the topic and the amount of time to attempt to extend the topic's lifetime by automatically at the topic's expirationTime. Currently, rent is not enforced for topics so auto-renew payments will not be made.
NOTE: The minimum period of time is approximately 30 days (2592000 seconds) and the maximum period of time is approximately 92 days (8000001 seconds). Any other value outside of this range will return the following error: AUTORENEW\_DURATION\_NOT\_IN\_RANGE.
|
| **Fee Schedule Key** | (Optional) A key that controls updates and deletions of topic fees. **Must be set at creation; cannot be added later via `updateTopic`**. |
| **Fee Exempt Keys** | (Optional) A list of keys that, if used to sign a message submission, allow the sender to bypass fees. **Can be updated later via `updateTopic`**. |
| **Custom Fees** | (Optional) A fee structure applied to message submissions for revenue generation. Can be updated later via updateTopic, but must be signed by the Fee Schedule Key.
Defines a fixed fee required for each message submission to the topic. This fee can be set in HBAR or HTS fungible tokens and applies when messages are submitted.
|
**Transaction Signing Requirements:**
* If an **Admin Key** is specified, the Admin Key must sign the transaction.
* If no **Admin Key** is specified, the topic is immutable.
* If an **Auto Renew Account** is specified, that account must also sign this transaction.
* If a **Fee Schedule Key** is specified, the Fee Schedule Key must sign the transaction.
* If a Fee Exempt Key List is specified, it contains a list of public keys that are exempt from paying fees when submitting messages to the topic. These keys do not need to sign the transaction.
**Transaction Fees**
* Each **transaction** incurs a **standard Hedera network fee** based on network resource usage.
* If a **custom fee** is set for a topic, users submitting messages must pay this fee in **HBAR or HTS tokens**.
* The **Fee Schedule Key** allows authorized users to update fee structures. If set, it must sign transactions modifying fees.
* Fee exemptions can be granted using the **Fee Exempt Key List**.
* Use the [Hedera Fee Estimator](https://hedera.com/fees) to estimate standard network fees.
#### Methods
| **Method** | **Type** | **Requirements** |
| --------------------------------------- | --------------------- | ---------------- |
| `setAdminKey()` | Key | Optional |
| `setSubmitKey()` | Key | Optional |
| `setTopicMemo()` | String | Optional |
| `setAutoRenewAccountId()` | AccountId | Optional |
| `setAutoRenewPeriod()` | Duration | Optional |
| `setFeeScheduleKey()` | Key | Optional |
| `setFeeExemptKeys()` | List\ | Optional |
| `setCustomFees()` | List\ | Optional |
| `addCustomFee()` | CustomFixedFee | Optional |
| `addFeeExemptKey()` | Key | Optional |
| `setHighVolume()` | boolean | Optional |
```java Java theme={null}
//Create the transaction
TopicCreateTransaction transaction = new TopicCreateTransaction()
.setFeeScheduleKey(feeScheduleKey)
.setFeeExemptKeys(feeExemptKeys)
.setCustomFees(customFees);
//Sign with the client operator private key and submit the transaction to a Hedera network
TransactionResponse txResponse = transaction.execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the topic ID
TopicId newTopicId = receipt.topicId;
System.out.println("The new topic ID is " + newTopicId);
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = new TopicCreateTransaction()
.setFeeScheduleKey(feeScheduleKey)
.setFeeExemptKeys(feeExemptKeys)
.setCustomFees(customFees);
//Sign with the client operator private key and submit the transaction to a Hedera network
const txResponse = await transaction.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the topic ID
const newTopicId = receipt.topicId;
console.log("The new topic ID is " + newTopicId);
//v2.0.0
```
```go Go theme={null}
//Create the transaction
transaction := hedera.NewTopicCreateTransaction().
.setFeeScheduleKey(feeScheduleKey).
.setFeeExemptKeys(feeExemptKeys).
.setCustomFees(customFees)
//Sign with the client operator private key and submit the transaction to a Hedera network
txResponse, err := transaction.Execute(client)
if err != nil {
panic(err)
}
//Request the receipt of the transaction
transactionReceipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the topic ID
newTopicID := *transactionReceipt.TopicID
fmt.Printf("The new topic ID is %v\n", newTopicID)
//v2.0.0
```
```rust Rust theme={null}
// Create a new topic
let transaction = TopicCreateTransaction::new()
.topic_memo("My topic memo")
.admin_key(admin_key)
.submit_key(submit_key)
.auto_renew_period(Duration::hours(24 * 30)); // 30 days
// Sign with the client operator private key and submit to a Hedera network
let tx_response = transaction.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the topic ID
let topic_id = receipt.topic_id.unwrap();
println!("The new topic ID is {:?}", topic_id);
// v0.34.0
```
## Get transaction values
| **Method** | **Type** | **Requirements** |
| ------------------------- | --------- | ---------------- |
| `getAdminKey(adminKey)` | Key | Optional |
| `getSubmitKey(submitKey)` | Key | Optional |
| `getTopicMemo(memo)` | String | Optional |
| `getAutoRenewAccountId()` | AccountId | Required |
| `getAutoRenewPeriod()` | Duration | Required |
| `getFeeScheduleKey()` | Key | Optional |
| `getFeeExemptKeys()` | List | Optional |
| `getCustomFees()` | List | Optional |
```java Java theme={null}
//Create the transaction
TopicCreateTransaction transaction = new TopicCreateTransaction()
.setFeeScheduleKey(feeScheduleKey);
//Get the fee schedule key from the transaction
Key getFeeScheduleKey = transaction.getFeeScheduleKey();
//V2.0.0
```
```javascript JavaScript theme={null}
const transaction = new TopicCreateTransaction()
.setFeeScheduleKey(feeScheduleKey);
//Get the fee schedule key from the transaction
const feeScheduleKey = transaction.getFeeScheduleKey();
//V2.0.0
```
```java Go theme={null}
transaction := hedera.NewTopicCreateTransaction().
SetFeeScheduleKey(feeScheduleKey)
getFeeScheduleKey := transaction.GetFeeScheduleKey()
//V2.0.0
```
This transaction supports [high-volume entity creation](/hedera/core-concepts/high-volume-entity-creation)
(HIP-1313). Setting `setHighVolume(true)` routes the transaction through dedicated
high-volume throttle capacity with variable-rate pricing. Always pair this with
`setMaxTransactionFee()` to cap your costs.
# Delete a topic
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/consensus-service/delete-a-topic
A transaction that deletes a topic from the Hedera network. Once a topic is deleted, the topic cannot be recovered to receive messages and all submitMessage calls will fail. Older messages can still be accessed, even after the topic is deleted, via the mirror node.
**Transaction Signing Requirements**
* If the adminKey was set upon the creation of the topic, the adminKey is required to sign to successfully delete the topic.
* If no adminKey was set upon the creating of the topic, you cannot delete the topic and will receive an UNAUTHORIZED error.
#### Methods
| Method | Type | Description | Requirement |
|---|
setTopicId(\) | TopicId | The ID of the topic to delete | Required |
```java Java theme={null}
//Create the transaction
TopicDeleteTransaction transaction = new TopicDeleteTransaction()
.setTopicId(newTopicId);
//Sign the transaction with the admin key, sign with the client operator and submit the transaction to a Hedera network, get the transaction ID
TransactionResponse txResponse = transaction.freezeWith(client).sign(adminKey).execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//V2.0.0
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = await new TopicDeleteTransaction()
.setTopicId(newTopicId)
.freezeWith(client);
//Sign the transaction with the admin key
const signTx = await transaction.sign(adminKey);
//Sign with the client operator private key and submit to a Hedera network
const txResponse = await signTx.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus);
//v2.0.5
```
```java Go theme={null}
//Create the transaction and freeze the transaction to prepare for signing
transaction := hedera.NewTopicDeleteTransaction().
SetTopicID(topicID).
FreezeWith(client)
//Sign the transaction with the admin key, sign with the client operator and submit the transaction to a Hedera network, get the transaction ID
txResponse, err := transaction.Sign(adminKey).Execute(client)
if err != nil {
panic(err)
}
//Request the receipt of the transaction
receipt, err = txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction consensus status
transactionStatus := receipt.Status
fmt.Printf("The transaction consensus status is %v\n", transactionStatus)
//v2.0.0
```
```rust Rust theme={null}
// Create the transaction to delete the topic
let transaction = TopicDeleteTransaction::new()
.topic_id(topic_id);
// Sign the transaction with the admin key
let tx_response = transaction
.freeze_with(&client)?
.sign(admin_key)
.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
## Get transaction values
| Method | Type | Description | Requirement |
| ----------------------- | ------- | ----------------------------- | ----------- |
| `getTopicId()` | TopicId | The ID of the topic to delete | Required |
```java Java theme={null}
//Create the transaction
TopicDeleteTransaction transaction = new TopicDeleteTransaction()
.setTopicId(newTopicId);
//Get topic ID
TopicId getTopicId = transaction.getTopicId();
//v2.0.0
```
```java JavaScript theme={null}
//Create the transaction
const transaction = new TopicDeleteTransaction()
.setTopicId(newTopicId);
//Get topic ID
const getTopicId = transaction.getTopicId();
//v2.0.0
```
```java Go theme={null}
//Create the transaction
transaction := hedera.NewTopicDeleteTransaction().
SetTopicID(topicID)
//Get topic ID
getTopicId := transaction.GetTopicID()
//v2.0.0
```
# Network Response
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/consensus-service/errors
Network response messages and their descriptions.
| Network Response Messages | Description |
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `INVALID_TOPIC_ID` | The Topic ID specified is not in the system. |
| `TOPIC_DELETED` | The Topic has been deleted |
| `INVALID_TOPIC_EXPIRATION_TIME` | The expiration time set for the topic is not valid |
| `INVALID_TOPIC_ADMIN_KEY` | The `adminKey` associated with the topic is not correct |
| `INVALID_TOPIC_SUBMIT_KEY` | The `submitKey` associated with the topic is not correct |
| `UNAUTHORIZED` | An attempted operation was not authorized (ie - a deleteTopic for a topic with no `adminKey`) |
| `INVALID_TOPIC_MESSAGE` | A `ConsensusService` message is empty |
| `INVALID_AUTORENEW_ACCOUNT` | The `autoRenewAccount` specified is not a valid, active account. |
| `AUTORENEW_ACCOUNT_NOT_ALLOWED` | An admin key was not specified on the topic, so there must not be an autorenew account. |
| `AUTORENEW_ACCOUNT_SIGNATURE_MISSING` | The `autoRenewAccount` didn't sign the transaction. |
| `INVALID_CHUNK_NUMBER` | Chunk number must be from 1 to total (chunks) inclusive |
| `InvalidChunkTransactionId` | For every chunk, the payer account that is part of initialTransactionID must match the Payer Account of this transaction. The entire initialTransactionID should match the transactionID of the first chunk, but this is not checked or enforced by Hedera except when the chunk number is 1. |
| `TopicExpired` | The topic has expired, was not automatically renewed, and is in a 7 day grace period before the topic will be deleted unrecoverably. This error response code will not be returned until autoRenew functionality is supported by HAPI. |
| `MAX_ENTRIES_FOR_FEE_EXEMPT_KEY_LIST_EXCEEDED` | The provided fee exempt key list size exceeded the limit. |
| `FEE_EXEMPT_KEY_LIST_CONTAINS_DUPLICATED_KEYS` | The provided fee exempt key list contains duplicated keys. |
| **`INVALID_KEY_IN_FEE_EXEMPT_KEY_LIST`** | The provided fee exempt key list contains an invalid key. |
| **`INVALID_FEE_SCHEDULE_KEY`** | The provided fee schedule key contains an invalid key. |
| **`FEE_SCHEDULE_KEY_CANNOT_BE_UPDATED`** | If a fee schedule key is not set when creating a topic, it cannot be added on update. |
| **`FEE_SCHEDULE_KEY_NOT_SET`** | If the topic's custom fees are updated, the topic must have a fee schedule key. |
| **`MAX_CUSTOM_FEE_LIMIT_EXCEEDED`** | The fee amount exceeds the amount that the payer is willing to pay. |
| **`NO_VALID_MAX_CUSTOM_FEE`** | There are no corresponding custom fees. |
| **`INVALID_MAX_CUSTOM_FEES`** | The provided list contains invalid max custom fees. |
| **`DUPLICATE_DENOMINATION_IN_MAX_CUSTOM_FEE_LIST`** | The provided max custom fee list contains fees with duplicate denominations. |
| **`DUPLICATE_ACCOUNT_ID_IN_MAX_CUSTOM_FEE_LIST`** | The provided max custom fee list contains fees with duplicate account IDs. |
| **`MAX_CUSTOM_FEES_IS_NOT_SUPPORTED`** | Max custom fees list is not supported for this operation. |
# Get topic info
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/consensus-service/get-topic-info
Topic info returns the following values for a topic. Queries do not change the state of the topic or require network consensus. The information is returned from a single node processing the query.
**Topic Info Response:**
| **Field** | **Description** |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Topic ID** | The ID of the topic |
| **Admin Key** | Access control for update/delete of the topic. Null if there is no key. |
| **Submit Key** | Access control for ConsensusService.submitMessage. Null if there is no key. |
| **Sequence Number** | Current sequence number (starting at 1 for the first submitMessage) of messages on the topic. |
| **Running Hash** | SHA-384 running hash |
| **Expiration Time** | Effective consensus timestamp at (and after) which submitMessage calls will no longer succeed on the topic and the topic will expire and be marked as deleted. |
| **Topic Memo** | Short publicly visible memo about the topic. No guarantee of uniqueness. |
| **Auto Renew Period** | The lifetime of the topic and the amount of time to extend the topic's lifetime by |
| **Auto Renew Account** | Null if there is no autoRenewAccount. |
| **Ledger ID** | The ID of the network the response came from. See [HIP-198](https://hips.hedera.com/hip/hip-198). |
| **Fee Schedule Key** | The key that is authorized to modify the fee structure for submitting messages to this topic. If present, this key must be used to update the topic's fee settings. If absent, the topic's fee structure cannot be changed. |
| **Fee Exempt Key** | A list of accounts that do not have to pay a fee when submitting messages to the topic. If this field is present, it means certain accounts are allowed to submit messages for free. If absent, no exemptions exist. |
| **Fee Schedule** | The current fee structure that applies to message submissions for this topic. It specifies the amount charged per message, which can be denominated in HBAR or a chosen fungible token. If this field is present, the topic enforces fees for message submissions; if absent, message submission is free. |
**Query Signing Requirements**
* The client operator private key is required to sign the query request
**Query Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for the base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your query fee cost
| Method | Type | Requirement |
|---|
setTopicId(\) | TopicId | Required |
\.adminKey | Key | Optional |
\.submitKey | Key | Optional |
\.topicId | TopicId | Optional |
\.sequenceNumber | long | Optional |
\.runningHash | ByteString | Optional |
\.memo | String | Optional |
\.ledgerId | LedgerId | Optional |
\.expirationTime | Instant | Optional |
\.autoRenewAccount | AccountId | Optional |
\.autoRenewPeriod | Instant | Optional |
```java Java theme={null}
//Create the account info query
TopicInfoQuery query = new TopicInfoQuery()
.setTopicId(newTopicId);
//Submit the query to a Hedera network
TopicInfo info = query.execute(client);
//Retrieve additional HIP-991 fields
Key feeScheduleKey = info.getFeeScheduleKey();
List customFees = info.getCustomFees();
List feeExemptKeys = info.getFeeExemptKeyList();
//Print the account key to the console
System.out.println(info);
System.out.println("Fee Schedule Key: " + feeScheduleKey);
System.out.println("Custom Fees: " + customFees);
System.out.println("Fee Exempt Key List: " + feeExemptKeys);
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the account info query
const query = new TopicInfoQuery()
.setTopicId(newTopicId);
//Submit the query to a Hedera network
const info = await query.execute(client);
//Retrieve additional HIP-991 fields
const feeScheduleKey = info.feeScheduleKey;
const customFees = info.customFees;
const feeExemptKeys = info.feeExemptKeyList;
//Print the account key to the console
console.log(info);
console.log("Fee Schedule Key:", feeScheduleKey);
console.log("Custom Fees:", customFees);
console.log("Fee Exempt Key List:", feeExemptKeys);
//v2.0.0
```
```go Go theme={null}
//Create the account info query
query, err := hedera.NewTopicInfoQuery().
SetTopicID(topicID)
//Submit the query to a Hedera network
info, err := query.Execute(client)
if err != nil {
panic(err)
}
//Retrieve additional HIP-991 fields
feeScheduleKey := info.GetFeeScheduleKey()
customFees := info.GetCustomFees()
feeExemptKeys := info.GetFeeExemptKeyList()
//Print the account key to the console
println(info)
fmt.Println("Fee Schedule Key:", feeScheduleKey)
fmt.Println("Custom Fees:", customFees)
fmt.Println("Fee Exempt Key List:", feeExemptKeys)
//v2.0.0
```
```rust Rust theme={null}
// Create the topic info query
let query = TopicInfoQuery::new()
.topic_id(topic_id);
// Submit the query to a Hedera network
let topic_info = query.execute(&client).await?;
// Print the topic info to the console
println!("{:?}", topic_info);
// v0.34.0
```
# Get topic messages
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/consensus-service/get-topic-message
Subscribe to a topic ID's messages from a mirror node. You will receive all messages for the specified topic or within the defined start and end time.
**Query Fees**
* The SDK uses the [Hedera Consensus Service gRPC APIs](/hedera/sdks-and-apis/hedera-consensus-service-api) provided by the mirror node to perform this function for free.
### Methods
| Method | Type | Description | Requirement |
| ---------------------------- | ------------------ | --------------------------------------------------- | ----------- |
| `setTopicId()` | TopicId | The topic ID to subscribe to | Required |
| `setStartTime()` | Instant | The time to start subscribing to a topic's messages | Optional |
| `setEndTime()` | Instant | The time to stop subscribing to a topic's messages | Optional |
| `setLimit()` | long | The number of messages to return | Optional |
| `subscribe( | Required |
```java Java theme={null}
//Create the query
new TopicMessageQuery()
.setTopicId(newTopicId)
.subscribe(client, topicMessage -> {
System.out.println("at " + topicMessage.consensusTimestamp + " ( seq = " + topicMessage.sequenceNumber + " ) received topic message of " + topicMessage.contents.length + " bytes");
});
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the query
new TopicMessageQuery()
.setTopicId(topicId)
.setStartTime(0)
.subscribe(
client,
(message) => console.log(Buffer.from(message.contents, "utf8").toString())
);
//v2.0.0
```
```java Go theme={null}
//Create the query
_, err = hedera.NewTopicMessageQuery().
SetTopicID(topicID).
Subscribe(client, func(message hedera.TopicMessage) {
if string(message.Contents) == content {
wait = false
}
})
if err != nil {
panic(err)
}
//v2.0.0
```
# Submit a message
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/consensus-service/submit-a-message
A transaction that submits a topic message to the Hedera network. To access the messages submitted to a topic ID, subscribe to the topic via a mirror node. The mirror node will publish the ordered messages to subscribers. Once the transaction is successfully executed, the receipt of the transaction will include the topic's updated sequence number and topic running hash.
## **Max Chunks**
The **max chunks** setting defines the maximum number of chunks into which a given message can be split. The default value is **20 chunks**, meaning a message can consist of up to 20 chunks by default. This value can be modified using the `setMaxChunks` method.
#### **Max Chunk Size**
🚨 **NOTE:** Max size of an HCS message: 1024 bytes (1 kb).
The **max chunk size** refers to the maximum size (in bytes) of each individual chunk of a message. By default, the max chunk size is **1024 bytes (1 KB)**. This value can be modified using the `setChunkSize` method.
## **Custom Fee Payment**
If a topic has custom fees enabled, users submitting messages must pay the required fee in **HBAR or HTS fungible tokens**. If `setCustomFees` is not specified in the transaction, the user would need to pay any fee associated with that topic ID. The transaction will only fail if the user does not have sufficient assets to cover the fee.
**Recommendation:** To avoid unexpected fees, it is strongly recommended to use `setCustomFees` when submitting a message. This ensures that only the intended fee structure is applied, providing a safeguard against unintended charges.
```java theme={null}
TopicMessageSubmitTransaction()
.setTopicId()
.setMessage()
.setCustomFees() // Ensure this covers the required amount
.execute(client);
```
## **Transaction Signing Requirements**
* Anyone can submit a message to a public topic.
* The `submitKey` is required to sign the transaction for a private topic.
## **Transaction Fees**
* Each transaction incurs a standard Hedera network fee based on network resource usage.
* If a custom fee is set for a topic, users submitting messages must pay this fee in HBAR or HTS tokens.
* The Fee Schedule Key allows authorized users to update fee structures. If set, it must sign transactions modifying fees.
* If the topic has custom fees, the sender must have sufficient balance to cover the fees unless they are exempt via the Fee Exempt Key List. It is recommended to use `setCustomFees` on the `TopicMessageSubmitTransaction` to ensure the expected fee structure is applied and avoid unexpected transaction failures due to insufficient funds.
* If you submit a message to a topic with a custom fee, the cost changes from the baseline $0.0001 USD to roughly $0.05 USD per `TopicMessageSubmitTransaction`.
* Use the [query fees table](/hedera/networks/mainnet/fees#consensus-service) for the base transaction fee and the [Hedera Fee Estimator](https://hedera.com/fees) to estimate standard network fees.
## Methods
| Method |
Type |
Description |
Requirement |
setTopicId(\)
|
TopicId |
The topic ID to submit the message to |
Required |
setMessage(\)
|
String |
The message in a String format |
Optional |
setMessage(\)
|
byte \[ ] |
The message in a byte array format |
Optional |
setMessage(\)
|
ByteString |
The message in a ByteString format |
Optional |
setChunkSize()
|
int |
The max size of individual chunk for a given message. Default: 1024
bytes
|
Optional |
setMaxChunks()
|
int |
The max number of chunks a given message can be split into. Default: 20
|
Optional |
setCustomFeeLimits()
|
List\ |
The maximum custom fees the sender is willing to pay |
Optional |
addCustomFeeLimit()
|
CustomFeeLimit |
Adds a custom fee limit |
Optional |
```java Java highlight={18} theme={null}
//Create the transaction
TopicMessageSubmitTransaction transaction = new TopicMessageSubmitTransaction()
.setTopicId(newTopicId)
.setMessage("hello, HCS! ")
.setMaxCustomFees(maxCustomFees); // Set max custom fees if applicable
//Sign with the client operator key and submit transaction to a Hedera network, get transaction ID
TransactionResponse txResponse = transaction.execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//v2.0.0
```
```javascript JavaScript theme={null}
// Create the transaction
const transaction = await new TopicMessageSubmitTransaction()
.setTopicId(newTopicId)
.setMessage("Hello, HCS!")
.setMaxCustomFees(maxCustomFees); // Set max custom fees if applicable
// Execute transaction
const txResponse = await transaction.execute(client);
// Request the receipt
const receipt = await txResponse.getReceipt(client);
// Get the transaction consensus status
console.log("Transaction Status:", receipt.status);
//v2.0.0
```
```java Go theme={null}
//Create the transaction
transaction := hedera.NewTopicSubmitTransaction().
SetTopicID(topicID).
SetMessage([]byte(content)).
SetMaxCustomFees(maxCustomFees) // Set max custom fees if applicable
//Sign with the client operator private key and submit the transaction to a Hedera network
txResponse, err := transaction.Execute(client)
if err != nil {
panic(err)
}
//Request the receipt of the transaction
transactionReceipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction consensus status
transactionStatus := receipt.Status
fmt.Printf("The transaction consensus status is %v\n", transactionStatus)
//v2.0.0
```
```rust Rust theme={null}
// Create the transaction
let transaction = TopicMessageSubmitTransaction::new()
.topic_id(topic_id)
.message("Hello, HCS!")
.max_custom_fees(max_custom_fees); // Set max custom fees if applicable
// Sign with the client operator key and submit to a Hedera network
let tx_response = transaction.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
## Get transaction values
| Method | Type | Description |
| ---------------------- | ---------- | ------------------------------------------------ |
| `getTopicId()` | TopicId | The topic ID to submit the message to |
| `getMessage()` | ByteString | The message being submitted |
| `getCustomFeeLimits()` | Fee\[] | Extract the custom fee limits of the transaction |
```java Java theme={null}
//Create the transaction
TopicMessageSubmitTransaction transaction = new TopicMessageSubmitTransaction()
.setTopicId(newTopicId)
.setMessage("hello, HCS! ");
//Get the transaction message
ByteString getMessage = transaction.getMessage();
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = await new TopicMessageSubmitTransaction()
.setTopicId(newTopicId)
.setMessage("hello, HCS! ");
//Get the transaction message
const getMessage = transaction.getMessage();
//v2.0.0
```
```go Go theme={null}
//Create the transaction
transaction := hedera.NewTopicSubmitTransaction().
SetTopicID(topicID).
SetMessage([]byte(content))
//Get the transaction message
getMessage := transaction.GetMessage()
//v2.0.0
```
# Update a topic
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/consensus-service/update-a-topic
A transaction that updates the properties of an existing topic. This includes the topic memo, admin key, submit key, auto-renew account, auto-renew period and fee-related fields.
#### Topic Properties
| Field | Description |
|---|
| Topic ID | Update the topic ID |
| Admin Key | Set a new admin key that authorizes update topic and delete topic transactions. |
| Submit Key | Set a new submit key for a topic that authorizes sending messages to this topic. |
| Topic Memo | Set a new short publicly visible memo on the new topic and is stored with the topic. (100 bytes) |
| Auto Renew Account | Set a new auto-renew account ID for this topic. Currently, rent is not enforced for topics so auto-renew payments will not be made. |
| Auto Renew Period | Set a new auto-renew period for this topic. Currently, rent is not enforced for topics so auto-renew payments will not be made.
NOTE: The minimum period of time is approximately 30 days (2592000 seconds) and the maximum period of time is approximately 92 days (8000001 seconds). Any other value outside of this range will return the following error: AUTORENEW\_DURATION\_NOT\_IN\_RANGE. |
| Fee Schedule Key | (Optional) A key that controls updates and deletions of topic fees. Must be set at creation; cannot be added later via updateTopic. |
| Fee Exempt Keys | (Optional) A list of keys that, if used to sign a message submission, allow the sender to bypass fees. Can be updated later via updateTopic. |
| Custom Fees | (Optional) A fee structure applied to message submissions for revenue generation. Can be updated later via updateTopic, but must be signed by the Fee Schedule Key. Defines a fixed fee required for each message submission to the topic. This fee can be set in HBAR or HTS fungible tokens and applies when messages are submitted. |
**Transaction Signing Requirements**
* If an admin key is updated, the transaction must be signed by the pre-update admin key and post-update admin key.
* If the admin key was set during the creation of the topic, the admin key must sign the transaction to update any of the topic's properties.
* If no `adminKey` was defined during the creation of the topic, you can only extend the expirationTime.
* If a `TopicUpdateTransaction` updates the fee schedule, the Fee Schedule Key must sign the transaction. If the Fee Schedule Key is being updated, both the existing (old) and the new Fee Schedule Key must sign the transaction.
**Transaction Fees**
* Each **transaction** incurs a **standard Hedera network fee** based on network resource usage.
* If a **custom fee** is set for a topic, users submitting messages must pay this fee in **HBAR or HTS tokens**.
* The **Fee Schedule Key** allows authorized users to update fee structures. If set, it must sign transactions modifying fees.
* Fee exemptions can be granted using the **Fee Exempt Key List**.
* Use the [Hedera Fee Estimator](https://hedera.com/fees) to estimate standard network fees.
#### Methods
| Method | Type | Requirements |
|---|
setTopicId(\) | TopicId | Required |
setAdminKey(\) | Key | Optional |
setSubmitKey(\) | Key | Optional |
setExpirationTime(\) | Instant | Optional |
setTopicMemo(\) | String | Optional |
setAutoRenewAccountId(\) | AccountId | Optional |
setAutoRenewPeriod(\) | Duration | Optional |
setFeeScheduleKey() | Key | Optional |
setFeeExemptKeys() | List\ | Optional |
setCustomFees() | List\ | Optional |
addCustomFee() | CustomFixedFee | Optional |
addFeeExemptKey() | Key | Optional |
clearAdminKey() | | Optional |
clearSubmitKey() | | Optional |
clearTopicMemo() | | Optional |
clearAutoRenewAccountId() | | Optional |
```java Java theme={null}
// Update a topic to set new custom fees
TopicUpdateTransaction transaction = new TopicUpdateTransaction()
.setTopicId(topicId) // Set the topic ID to update
.setCustomFees(newCustomFees) // Set the new list of custom fees
.freezeWith(client) // Freeze the transaction
// Sign with the Fee Schedule Key to authorize fee changes
.sign(feeScheduleKey);
// Submit the transaction to the Hedera network
TransactionResponse txResponse = transaction.execute(client);
// Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
// Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " + transactionStatus);
// v2.0.0
```
```javascript JavaScript theme={null}
// Update a topic with new custom fees
const transaction = await new TopicUpdateTransaction()
.setTopicId(topicId)
.setCustomFees(newCustomFees)
.freezeWith(client)
.sign(feeScheduleKey);
// Sign with the Fee Schedule Key to authorize fee changes
const signTx = await transaction.sign(feeScheduleKey);
// Submit the transaction to the Hedera network
const txResponse = await signTx.execute(client);
// Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus);
//v2.0.0
```
```java Go theme={null}
//Create the transaction
transaction := hedera.NewTopicUpdateTransaction().
SetTopicId(topicId).
SetFeeScheduleKey(newFeeScheduleKey).
SetFeeExemptKeys(newFeeExemptKeys).
SetCustomFees(newCustomFees)
// Sign with the Fee Schedule Key to authorize fee changes
txResponse, err := transaction.Sign(feeScheduleKey).Execute(client)
if err != nil {
panic(err)
}
// Request the receipt of the transaction
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
// Get the transaction consensus status
transactionStatus := receipt.Status
fmt.Printf("Transaction Status: %v\n", transactionStatus)
//v2.0.0
```
```rust Rust theme={null}
// Create the transaction to update the topic
let transaction = TopicUpdateTransaction::new()
.topic_id(topic_id)
.topic_memo("Updated topic memo")
.admin_key(new_admin_key)
.submit_key(new_submit_key)
.auto_renew_period(Duration::hours(24 * 30)); // 30 days
// Sign the transaction with the admin key
let tx_response = transaction
.freeze_with(&client)?
.sign(admin_key)
.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
## Get transaction values
| Method | Type | Requirements |
|---|
getTopicId() | TopicId | Required |
getAdminKey() | Key | Optional |
getSubmitKey() | Key | Optional |
getTopicMemo() | String | Optional |
getAutoRenewAccountId() | AccountId | Required |
getAutoRenewPeriod() | Duration | Required |
getFeeScheduleKey() | Key | Optional |
getFeeExemptKeys() | List | Optional |
getCustomFees() | List | Optional |
```java Java theme={null}
//Create a transaction to add a submit key
TopicUpdateTransaction transaction = new TopicUpdateTransaction()
.setSubmitKey(submitKey);
//Get submit key
transaction.getSubmitKey()
//v2.0.0
```
```javascript JavaScript theme={null}
//Create a transaction to add a submit key
const transaction = new TopicUpdateTransaction()
.setSubmitKey(submitKey);
//Get submit key
transaction.getSubmitKey()
//v2.0.0
```
```java Go theme={null}
//Create the transaction
transaction := hedera.NewTopicUpdateTransaction()
SetSubmitKey()
transaction := transaction.GetSubmitKey()
//v2.0.0
```
# Estimating Fees with the SDK
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/fees/fee-estimation
Use FeeEstimateQuery to estimate transaction fees before submission, gate spending, and simulate high-volume pricing.
`FeeEstimateQuery` lets you estimate the cost of a transaction before submitting it. Use it to gate spending against a budget, surface fee previews to users, or simulate execution under high-volume congestion.
The query returns a structured breakdown of node, network, and service fees in tinycents (USD × 10⁻¹⁰). The same calculation runs on the consensus node at execution time, so the estimate reflects what you'll be charged — modulo the live HBAR exchange rate at consensus.
## Basic Usage
Freeze the transaction first, then pass it to `FeeEstimateQuery`. Either call the query directly or use the `estimateFee()` convenience method on the transaction.
```java Java theme={null}
// Freeze the transaction first — the body must be finalized before estimating
var transaction = new AccountCreateTransaction()
.setKeyWithoutAlias(newKey)
.setInitialBalance(new Hbar(1))
.freezeWith(client);
// Option 1: FeeEstimateQuery
FeeEstimateResponse response = new FeeEstimateQuery()
.setTransaction(transaction)
.setMode(FeeEstimateMode.INTRINSIC) // optional — INTRINSIC is the default
.execute(client);
// or option 2: Convenience method
// FeeEstimateResponse response = transaction.estimateFee().execute(client);
```
```javascript JavaScript theme={null}
const transaction = await new AccountCreateTransaction()
.setKeyWithoutAlias(newKey)
.setInitialBalance(new Hbar(1))
.freezeWith(client);
const response = await new FeeEstimateQuery()
.setTransaction(transaction)
.setMode(FeeEstimateMode.INTRINSIC)
.execute(client);
// or: const response = await transaction.estimateFee().execute(client);
```
```go Go theme={null}
tx, _ := hiero.NewAccountCreateTransaction().
SetKeyWithoutAlias(newKey.PublicKey()).
SetInitialBalance(hiero.NewHbar(1)).
FreezeWith(client)
response, err := hiero.NewFeeEstimateQuery().
SetTransaction(tx).
SetMode(hiero.FeeEstimateModeIntrinsic).
Execute(client)
// or: response, err := tx.EstimateFee().Execute(client)
```
## Estimation Modes
| Mode | Behavior |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `INTRINSIC` (default) | Estimates based on the transaction's inherent properties (size, signatures, keys). Fast and stateless. |
| `STATE` | Estimates using the mirror node's latest known state (e.g., checks if accounts exist, includes state-dependent extras). Required for high-volume pricing simulation. |
## Response Structure
The response contains a structured breakdown of the fee components.
```json theme={null}
{
"high_volume_multiplier": 1,
"network": { "multiplier": 3, "subtotal": },
"node": {
"base": ,
"extras": [
{
"name": "Signatures",
"included": 1,
"count": 2,
"charged": 1,
"fee_per_unit": ,
"subtotal":
}
]
},
"service": { "base": , "extras": [] },
"total":
}
```
The components total according to:
```text theme={null}
node.subtotal = node.base + sum(node.extras[].subtotal)
network.subtotal = node.subtotal × network.multiplier
total = node.subtotal + network.subtotal + service.subtotal
```
## End-to-End: Estimate, Gate, Execute
A common pattern: estimate the fee, check against a budget, then execute only if the estimate is acceptable.
```java Java theme={null}
var transaction = new AccountCreateTransaction()
.setKeyWithoutAlias(newKey)
.setInitialBalance(new Hbar(1))
.setMaxTransactionFee(new Hbar(10)) // set before freezing
.freezeWith(client);
FeeEstimateResponse estimate = transaction.estimateFee().execute(client);
// Gate on budget — $1.50 = 15,000,000,000 tinycents
if (estimate.getTotal() > 15_000_000_000L) {
throw new RuntimeException("Fee estimate exceeds budget: " + estimate.getTotal());
}
var record = transaction
.execute(client)
.getRecord(client);
```
```javascript JavaScript theme={null}
const transaction = await new AccountCreateTransaction()
.setKeyWithoutAlias(newKey)
.setInitialBalance(new Hbar(1))
.setMaxTransactionFee(new Hbar(10)) // set before freezing
.freezeWith(client);
const estimate = await transaction.estimateFee().execute(client);
if (estimate.total.toBigInt() > 15_000_000_000n) {
throw new Error(`Fee estimate exceeds budget: ${estimate.total}`);
}
const record = await (await transaction.execute(client)).getRecord(client);
```
```go Go theme={null}
tx, _ := hiero.NewAccountCreateTransaction().
SetKeyWithoutAlias(newKey.PublicKey()).
SetInitialBalance(hiero.NewHbar(1)).
SetMaxTransactionFee(hiero.NewHbar(10)). // set before freezing
FreezeWith(client)
estimate, _ := tx.EstimateFee().Execute(client)
if estimate.Total > 15_000_000_000 {
panic(fmt.Sprintf("fee estimate exceeds budget: %d", estimate.Total))
}
resp, _ := tx.Execute(client)
record, _ := resp.GetRecord(client)
```
## High-Volume Pricing Simulation
For entity-creation transactions opted into the high-volume lane via `setHighVolume(true)`, the network may apply a fee multiplier under congestion. To simulate this before submitting, use `setHighVolumeThrottle()` on `FeeEstimateQuery` with `STATE` mode.
```java Java theme={null}
FeeEstimateResponse hvResponse = new FeeEstimateQuery()
.setTransaction(
new AccountCreateTransaction()
.setKeyWithoutAlias(newKey)
.setHighVolume(true)
.freezeWith(client)
)
.setMode(FeeEstimateMode.STATE)
.setHighVolumeThrottle(5000) // simulate 50% utilization
.execute(client);
// high_volume_multiplier uses 1-based scale: 1 = 1×, 4 = 4×
System.out.printf("Multiplier at 50%% load: %dx%n", hvResponse.getHighVolumeMultiplier());
```
```javascript JavaScript theme={null}
const hvResponse = await new FeeEstimateQuery()
.setTransaction(
new AccountCreateTransaction()
.setKeyWithoutAlias(newKey)
.setHighVolume(true)
.freezeWith(client)
)
.setMode(FeeEstimateMode.STATE)
.setHighVolumeThrottle(5000)
.execute(client);
console.log(`Multiplier at 50% load: ${hvResponse.highVolumeMultiplier}x`);
```
```go Go theme={null}
tx, _ := hiero.NewAccountCreateTransaction().
SetKeyWithoutAlias(newKey.PublicKey()).
SetHighVolume(true).
FreezeWith(client)
hvResponse, _ := hiero.NewFeeEstimateQuery().
SetTransaction(tx).
SetMode(hiero.FeeEstimateModeState).
SetHighVolumeThrottle(5000).
Execute(client)
fmt.Printf("Multiplier at 50%% load: %dx\n", hvResponse.HighVolumeMultiplier)
```
## Developer Notes
* **Freeze before estimating.** Call `freezeWith(client)` before `FeeEstimateQuery` — the transaction body must be finalized for the estimate to reflect your actual transaction.
* **Estimates are in tinycents; execution fees are in tinybars.** The response uses tinycents (USD × 10⁻¹⁰). The fee charged on execution is in tinybars (HBAR × 10⁻⁸), converted at the live exchange rate at consensus time.
* **Set `maxTransactionFee` with headroom.** Add 10–20% above the estimate — exchange rates shift between estimation and execution.
* **`high_volume_multiplier` scale differs from `TransactionRecord`.** The estimate response uses a 1-based scale (1 = 1×, 4 = 4×). `TransactionRecord.highVolumePricingMultiplier` after execution uses a 1000-based scale (1000 = 1×, 4000 = 4×). Both represent the same multiplier.
## SDK Versions
`FeeEstimateQuery` is available in:
* **Java**: v2.71.0+
* **Go**: v2.79.0+
* **JavaScript** (`@hiero-ledger/sdk`): v2.83.0+
## Related
The base-fee-plus-extras model that fee estimation calculates against.
The underlying REST endpoint backing `FeeEstimateQuery`.
The HIP defining the fee model.
The HIP defining the high-volume lane and congestion multiplier.
# File Service
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/file-service
# Append to a file
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/file-service/append-to-a-file
A transaction that appends new file content to the end of an existing file. The contents of the file can be viewed by submitting a FileContentsQuery request.
**Transaction Signing Requirements**
* The key on the file is required to sign the transaction if different than the client operator account key
**Transaction Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your transaction fee cost
| **Constructor** | **Description** |
| ------------------------- | -------------------------------------------- |
| `FileAppendTransaction()` | Initializes the FileAppendTransaction object |
```java theme={null}
new FileAppendTransaction()
```
The default max transaction fee (1 hbar) is not enough to create a file. Use `setMaxTransactionFee()`to change the default max transaction fee from 1 hbar to 2 hbars. The default chunk size is 2,048 bytes.
### Methods
| **Method** | **Type** | **Description** | **Requirement** |
| ------------------------------ | --------- | ---------------------------- | --------------- |
| `setFileId()` | FileId | The ID of the file to append | Required |
| `setContents()` | String | The content in String format | Optional |
| `setContents()` | byte \[ ] | The content in byte format | Optional |
| `setChunkSize()` | int | The chunk size | Optional |
| `setMaxChunkSize()` | int | The max chunk size | Optional |
| `setHighVolume()` | boolean | The high-volume flag | Optional |
```java Java theme={null}
//Create the transaction
FileAppendTransaction transaction = new FileAppendTransaction()
.setFileId(newFileId)
.setContents("The appended contents");
//Change the default max transaction fee to 2 hbars
FileCreateTransaction modifyMaxTransactionFee = transaction.setMaxTransactionFee(new Hbar(2));
//Prepare transaction for signing, sign with the key on the file, sign with the client operator key and submit to a Hedera network
TransactionResponse txResponse = modifyMaxTransactionFee.freezeWith(client).sign(key).execute(client);
//Request the receipt
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = await new FileAppendTransaction()
.setFileId(newFileId)
.setContents("The appended contents")
.setMaxTransactionFee(new Hbar(2))
.freezeWith(client);
//Sign with the file private key
const signTx = await transaction.sign(fileKey);
//Sign with the client operator key and submit to a Hedera network
const txResponse = await signTx.execute(client);
//Request the receipt
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus);
//v2.0.5
```
```java Go theme={null}
//Create the transaction
transaction2 := hedera.NewFileAppendTransaction().
SetFileID(newFileId).
SetContents([]byte("The appended contents"))
//Change the default max transaction fee to 2 hbars
modifyMaxTransactionFee := transaction.SetMaxTransactionFee(hedera.HbarFrom(2, hedera.HbarUnits.Hbar))
//Prepare transaction for signing,
freezeTransaction, err := modifyMaxTransactionFee.FreezeWith(client)
if err != nil {
panic(err)
}
//Sign with the key on the file, sign with the client operator key and submit to a Hedera network
txResponse2 err := freezeTransaction.Sign(fileKey).Execute(client)
if err != nil {
panic(err)
}
//Request the receipt
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction consensus status
transactionStatus := receipt.Status
fmt.Println("The transaction consensus status is ", transactionStatus)
//v2.0.0
```
```rust Rust theme={null}
// Create the transaction
let transaction = FileAppendTransaction::new()
.file_id(file_id)
.contents("The appended contents")
.max_transaction_fee(Hbar::new(2));
// Sign with the file key and submit to a Hedera network
let tx_response = transaction
.freeze_with(&client)?
.sign(file_key)
.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
## Get transaction values
| **Method** | **Type** | **Description** | **Requirement** |
| --------------- | -------- | ------------------------------ | --------------- |
| `getFileId()` | FileId | The file ID in the transaction | Optional |
| `getContents()` | String | The content in the transaction | Optional |
```java Java theme={null}
//Create the transaction
FileAppendTransaction transaction = new FileAppendTransaction()
.setFileId(newFileId)
.setContents("The appended contents");
//Get the contents
ByteString getContents = transaction.getContents();
//v2.0.0
```
```java JavaScript theme={null}
//Create the transaction
const transaction = new FileAppendTransaction()
.setFileId(newFileId)
.setContents("The appended contents");
//Get the contents
const getContents = transaction.getContents();
```
```java Go theme={null}
//Create the transaction
transaction2 := hedera.NewFileAppendTransaction().
SetFileID(newFileId).
SetContents([]byte("The appended contents"))
//Get the contents
getContents2 := transaction2.GetContents()
//v2.0.0
```
This transaction supports [high-volume entity creation](/hedera/core-concepts/high-volume-entity-creation)
(HIP-1313). Setting `setHighVolume(true)` routes the transaction through dedicated
high-volume throttle capacity with variable-rate pricing. Always pair this with
`setMaxTransactionFee()` to cap your costs.
# Create a file
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/file-service/create-a-file
A transaction that creates a new file on a Hedera network. The file is referenced by its file ID which can be obtained from the receipt or record once the transaction reaches consensus on a Hedera network. The file does not have a file name. If the file is too big to create with a single `FileCreateTransaction()`, the file can be appended with the remaining content multiple times using the `FileAppendTransaction()`.
The maximum file size is 1,024 kB.
**Transaction Signing Requirements**
* The key on the file is required to sign the transaction if different than the client operator account key
**Transaction Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your transaction fee cost
#### File Properties
| **Field** | **Description** |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Key(s)** | Set the keys which must sign any transactions modifying this file (the owner(s) of the file). All keys must sign to modify the file's contents or keys. No key is required to sign for extending the expiration time (except the one for the operator account paying for the transaction). The network currently requires a file to have at least one key (or key list or threshold key) but this requirement may be lifted in the future. |
| **Contents** | The contents of the file. The file contents can be recovered from requesting the FileContentsQuery. Note that the total size for a given transaction is limited to 6KiB (as of March 2020) by the network; if you exceed this you may receive a TRANSACTION\_OVERSIZE error. |
| **Expiration Time** | Set the instant at which this file will expire, after which its contents will no longer be available. Defaults to 1/4 of a Julian year from the instant was invoked. |
| **Memo** | Short publicly visible memo about the file. No guarantee of uniqueness. (100 characters max) |
### Methods
| **Constructor** | **Description** |
| ----------------------------- | -------------------------------------------- |
| `new FileCreateTransaction()` | Initializes the FileCreateTransaction object |
```java theme={null}
new FileCreateTransaction()
```
The default max transaction fee (1 hbar) is not enough to create a a file. Use `setDefaultMaxTransactionFee()`to change the default max transaction fee from 1 hbar to 2 hbars.
| **Method** | **Type** | **Requirement** |
| ------------------------------------- | ---------- | --------------- |
| `setKeys()` | Key | Required |
| `setContents()` | String | Optional |
| `setContents()` | bytes \[ ] | Optional |
| `setExpirationTime()` | Instant | Optional |
| `setFileMemo()` | String | Optional |
| `setHighVolume()` | boolean | Optional |
```java Java theme={null}
//Create the transaction
FileCreateTransaction transaction = new FileCreateTransaction()
.setKeys(fileKey)
.setContents(fileContents);
//Change the default max transaction fee to 2 hbars
FileCreateTransaction modifyMaxTransactionFee = transaction.setMaxTransactionFee(new Hbar(2));
//Prepare transaction for signing, sign with the key on the file, sign with the client operator key and submit to a Hedera network
TransactionResponse txResponse = modifyMaxTransactionFee.freezeWith(client).sign(fileKey).execute(client);
//Request the receipt
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the file ID
FileId newFileId = receipt.fileId;
System.out.println("The new file ID is: " + newFileId);
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = await new FileCreateTransaction()
.setKeys([filePublicKey]) //A different key then the client operator key
.setContents("the file contents")
.setMaxTransactionFee(new Hbar(2))
.freezeWith(client);
//Sign with the file private key
const signTx = await transaction.sign(fileKey);
//Sign with the client operator private key and submit to a Hedera network
const submitTx = await signTx.execute(client);
//Request the receipt
const receipt = await submitTx.getReceipt(client);
//Get the file ID
const newFileId = receipt.fileId;
console.log("The new file ID is: " + newFileId);
//v2.0.7
```
```go Go theme={null}
//Create the transaction
transaction := hedera.NewFileCreateTransaction().
SetKeys(filePublicKey).
SetContents([]byte("Hello, World"))
//Change the default max transaction fee to 2 hbars
modifyMaxTransactionFee := transaction.SetMaxTransactionFee(hedera.HbarFrom(2, hedera.HbarUnits.Hbar))
//Prepare transaction for signing,
freezeTransaction, err := modifyMaxTransactionFee.FreezeWith(client)
if err != nil {
panic(err)
}
//Sign with the key on the file, sign with the client operator key and submit to a Hedera network
txResponse, err := freezeTransaction.Sign(fileKey).Execute(client)
if err != nil {
panic(err)
}
//Request the receipt
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the file ID
newFileId := *receipt.FileID
fmt.Printf("The new file ID is %v\n", newFileId)
//v2.0.0
```
```rust Rust theme={null}
// Create a new file
let transaction = FileCreateTransaction::new()
.keys([file_key])
.contents("Hello, Hedera!")
.file_memo("My file memo")
.max_transaction_fee(Hbar::new(2));
// Sign with the client operator private key and submit to a Hedera network
let tx_response = transaction.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the file ID
let file_id = receipt.file_id.unwrap();
println!("The new file ID is {:?}", file_id);
// v0.34.0
```
## Get transaction values
| **Method** | **Type** | **Requirement** |
| --------------------- | ---------- | --------------- |
| `getKeys()` | Key | Optional |
| `getContents()` | ByteString | Optional |
| `getExpirationTime()` | Instant | Optional |
| `getFileMemo()` | String | Optional |
```java Java theme={null}
//Create the transaction
FileCreateTransaction transaction = new FileCreateTransaction()
.setKeys(key)
.setContents(fileContents);
//Get the file contents
ByteString getContents = transaction.getContents();
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = new FileCreateTransaction()
.setKeys(key)
.setContents(fileContents);
//Get the file contents
const getContents = transaction.getContents();
```
```java Go theme={null}
//Create the transaction
transaction := hedera.NewFileCreateTransaction().
SetKeys(filePublicKey).
SetContents([]byte("Hello, World"))
//Get the file contents
getContents := transaction.GetContents()
```
This transaction supports [high-volume entity creation](/hedera/core-concepts/high-volume-entity-creation)
(HIP-1313). Setting `setHighVolume(true)` routes the transaction through dedicated
high-volume throttle capacity with variable-rate pricing. Always pair this with
`setMaxTransactionFee()` to cap your costs.
# Delete a file
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/file-service/delete-a-file
A transaction that deletes a file from a Hedera network. When deleted, a file's contents are truncated to zero length and it can no longer be updated or appended to, or its expiration time extended. When you request the contents or info of a deleted file, the network will return FILE\_DELETED.
**Transaction Signing Requirements**
* The key(s) on the file are required to sign the transaction
* If you do not sign with the key(s) on the file, you will receive an INVALID\_SIGNATURE network error
**Transaction Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your transaction fee cost
| Constructor | Description |
| ----------------------------- | -------------------------------------------- |
| `new FileDeleteTransaction()` | Initializes the FileDeleteTransaction object |
```java theme={null}
new FileDeleteTransaction()
```
### Methods
| Method | Type | Description |
| --------------------- | ------ | -------------------------------------------- |
| `setFileId()` | FileId | The ID of the file to delete in x.y.z format |
```java Java theme={null}
//Create the transaction
FileDeleteTransaction transaction = new FileDeleteTransaction()
.setFileId(newFileId);
//Modify the default max transaction fee to from 1 to 2 hbars
FileDeleteTransaction modifyMaxTransactionFee = transaction.setMaxTransactionFee(new Hbar(2));
//Prepare transaction for signing, sign with the key on the file, sign with the client operator key and submit to a Hedera network
TransactionResponse txResponse = modifyMaxTransactionFee.freezeWith(client).sign(key).execute(client);
//Request the receipt
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " + transactionStatus);
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = await new FileDeleteTransaction()
.setFileId(fileId)
.setMaxTransactionFee(new Hbar(2))
.freezeWith(client);
//Sign with the file private key
const signTx = await transaction.sign(fileKey);
//Sign with the client operator private key and submit to a Hedera network
const submitTx = await signTx.execute(client);
//Request the receipt
const receipt = await submitTx.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status " +transactionStatus3.toString());
//v2.0.5
```
```java Go theme={null}
//Create the transaction
transaction := hedera.NewFileDeleteTransaction().
SetFileID(fileId)
//Modify the default max transaction fee to from 1 to 2 hbars
modifyMaxTransactionFee := transaction.SetMaxTransactionFee(hedera.HbarFrom(2, hedera.HbarUnits.Hbar))
//Prepare the transaction for signing
freezeTransaction, err := modifyMaxTransactionFee.FreezeWith(client)
if err != nil {
panic(err)
}
//Sign with the key on the file, sign with the client operator key and submit to a Hedera network
txResponse, err := freezeTransaction.Sign(fileKey).Execute(client)
if err != nil {
panic(err)
}
//Request the receipt
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction status
transactionStatus := receipt.Status
fmt.Println("The transaction consensus status is ", transactionStatus)
//v2.0.0
```
```rust Rust theme={null}
// Create the transaction
let transaction = FileDeleteTransaction::new()
.file_id(file_id)
.max_transaction_fee(Hbar::new(2));
// Sign with the file key and submit to a Hedera network
let tx_response = transaction
.freeze_with(&client)?
.sign(file_key)
.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
## Get transaction values
| Method | Type | Description |
| --------------------- | ------ | ------------------------------------ |
| `getFileId()` | FileId | The ID of the file to delete (x.z.y) |
```java Java theme={null}
//Create the transaction
FileDeleteTransaction transaction = new FileDeleteTransaction()
.setFileId(newFileId);
//Get the file ID
FileId getFileId = transaction.getFileId();
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = new FileDeleteTransaction()
.setFileId(newFileId);
//Get the file ID
FileId getFileId = transaction.getFileId();
```
```java Go theme={null}
//Create the transaction
transaction := hedera.NewFileDeleteTransaction().
SetFileID(fileId)
//Get the file ID
getFileId := transaction.GetFileID()
```
```rust Rust theme={null}
// Create the transaction
let transaction = FileDeleteTransaction::new()
.file_id(file_id);
// Get the file ID
let file_id = transaction.get_file_id();
// v0.34.0
```
# Network Response Messages
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/file-service/errors
Network response messages and their descriptions.
| Network Response | Description |
| --------------------------------------- | ------------------------------------------------------------------------ |
| `FEE_SCHEDULE_FILE_PART_UPLOADED` | Fee Schedule Proto File Part uploaded |
| `FILE_CONTENT_EMPT` | The contents of file are provided as empty. |
| `FILE_DELETED` | the file has been marked as deleted |
| `FILE_SYSTEM_EXCEPTION` | Unexpected exception thrown by file system functions |
| `FILE_UPLOADED_PROTO_INVALID` | Fee Schedule Proto uploaded but not valid (append or update is required) |
| `FILE_UPLOADED_PROTO_NOT_SAVED_TO_DISK` | Fee Schedule Proto uploaded but not valid (append or update is required) |
| `INVALID_EXCHANGE_RATE_FILE` | Failed to update exchange rate file |
| `INVALID_FEE_FILE` | Failed to update fee file |
| `INVALID_FILE_ID` | The file id is invalid or does not exist |
| `INVALID_FILE_WACL` | File WACL keys are invalid |
| `MAX_FILE_SIZE_EXCEEDED` | File size exceeded the currently allowable limit |
| `NO_WACL_KEY` | WriteAccess Control Keys are not provided for the file |
# Get file contents
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/file-service/get-file-contents
A query to get the contents of a file. Queries do not change the state of the file or require network consensus. The information is returned from a single node processing the query.
**Query Signing Requirements**
* The client operator private key is required to sign the query request
**Query Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for the base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your query fee cost
| Constructor | Description |
| ------------------------- | -------------------------------------- |
| `new FileContentsQuery()` | Initializes a FileContentsQuery object |
```java theme={null}
new FileContentsQuery()
```
### Methods
| Method | Type | Description |
| --------------------- | ------ | ---------------------------------------------- |
| `setFileId()` | FileId | The ID of the file to get contents for (x.z.y) |
```java Java theme={null}
//Create the query
FileContentsQuery query = new FileContentsQuery()
.setFileId(newFileId);
//Sign with client operator private key and submit the query to a Hedera network
ByteString contents = query.execute(client);
//Change to Utf-8 encoding
String contentsToUtf8 = contents.toStringUtf8();
System.out.println(contentsToUtf8);
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the query
const query = new FileContentsQuery()
.setFileId(newFileId);
//Sign with client operator private key and submit the query to a Hedera network
const contents = await query.execute(client);
console.log(contents.toString());
//v2.0.7
```
```java Go theme={null}
//Create the query
query := hedera.NewFileContentsQuery().
SetFileID(newFileId)
//Sign with client operator private key and submit the query to a Hedera network
contents, err := query.Execute(client)
fmt.Println(string(contents))
//v2.0.0
```
```rust Rust theme={null}
// Create the query
let query = FileContentsQuery::new()
.file_id(file_id);
// Submit the query to a Hedera network
let contents = query.execute(&client).await?;
// Print the contents to the console
println!("File contents: {:?}", String::from_utf8_lossy(&contents));
// v0.34.0
```
## Get query values
| Method | Type | Description |
| ------------- | ------ | ---------------------------------------------- |
| `getFileId()` | FileId | The ID of the file to get contents for (x.z.y) |
```java Java theme={null}
//Create the query
FileContentsQuery query = new FileContentsQuery()
.setFileId(newFileId);
//Get file ID
FileId getFileId = query.getFileId();
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the query
const query = new FileContentsQuery()
.setFileId(newFileId);
//Get file ID
const getFileId = query.getFileId();
```
```java Go theme={null}
//Create the query
query := hedera.NewFileContentsQuery().
SetFileID(newFileId)
//Get file ID
getFileId := query.GetFileID()
//v2.0.0
```
```rust Rust theme={null}
// Create the query
let query = FileContentsQuery::new()
.file_id(file_id);
// Get the file ID
let file_id = query.get_file_id();
// v0.34.0
```
# Get file info
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/file-service/get-file-info
A query that returns the current state of a file. Queries do not change the state of the file or require network consensus. The information is returned from a single node processing the query.
**Query Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for the base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your query fee cost
**File Info Response**
| **Field** | Description |
| ------------------- | ------------------------------------------------------------------------------------------------- |
| **File ID** | The Hedera ID of the file |
| **Key(s)** | The current admin key(s) on the account |
| **Size** | The number of bytes in the file contents |
| **Expiration Time** | The current time at which the file is set to expire |
| **Deleted** | Whether or not the file has been deleted |
| **Ledger ID** | The ID of the network the response came from. See [HIP-198](https://hips.hedera.com/hip/hip-198). |
| **Memo** | A short description, if any |
\
**Query Signing Requirements**
* The client operator account paying for the query fees is required to sign
| Constructor | Description |
| --------------------- | ------------------------------------ |
| `new FileInfoQuery()` | Initializes the FileInfoQuery object |
```java theme={null}
new FileInfoQuery()
```
### Methods
| Method | Type | Description |
| --------------------- | ------ | ------------------------------------------------- |
| `setFileId()` | FileId | The ID of the file to get information for (x.y.z) |
```java Java theme={null}
//Create the query
FileInfoQuery query = new FileInfoQuery()
.setFileId(fileId);
//Sign the query with the client operator private key and submit to a Hedera network
FileInfo getInfo = query.execute(client);
System.out.println("File info response: " +getInfo);
```
```javascript JavaScript theme={null}
//Create the query
const query = new FileInfoQuery()
.setFileId(fileId);
//Sign the query with the client operator private key and submit to a Hedera network
const getInfo = await query.execute(client);
console.log("File info response: " + getInfo);
```
```java Go theme={null}
//Create the query
query := hedera.NewFileInfoQuery().
SetFileID(newFileId)
//Sign the query with the client operator private key and submit to a Hedera network
getInfo, err := query.Execute(client)
fmt.Println(getInfo)
```
```rust Rust theme={null}
// Create the query
let query = FileInfoQuery::new()
.file_id(file_id);
// Submit the query to a Hedera network
let file_info = query.execute(&client).await?;
// Print the file info to the console
println!("File info: {:?}", file_info);
// v0.34.0
```
**Sample Output:**
```
FileInfo{
fileId=0.0.104926,
size=26,
expirationTime=2021-02-10T17:48:15Z,
deleted=false,
keys=[ 302a300506032b6570032100100059296cc51f5d362a3859d3c3c74c6a480cffad9d669a10c1d447ce56e5bf
]
}
```
## Get query values
| Method | Type | Description |
| ------------- | ------ | ---------------------------------------------- |
| `getFileId()` | FileId | The ID of the file to get contents for (x.z.y) |
```java Java theme={null}
//Create the query
FileInfoQuery query = new FileInfoQuery()
.setFileId(fileId);
//Get file ID
FileId getFileId = query.getFileId();
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the query
const query = new FileInfoQuery()
.setFileId(fileId);
//Get file ID
const getFileId = query.getFileId();
//v2.0.0
```
```java Go theme={null}
//Create the query
query := hedera.NewFileContentsQuery().
SetFileID(newFileId)
//Get file ID
getFileId := query.GetFileID()
//v2.0.0
```
```rust Rust theme={null}
// Create the query
let query = FileInfoQuery::new()
.file_id(file_id);
// Get the file ID
let file_id = query.get_file_id();
// v0.34.0
```
# Update a file
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/file-service/update-a-file
A transaction that updates the state of an existing file on a Hedera network. Once the transaction has been processed, the network will be updated with the new field values of the file. If you need to access a previous state of the file, you can query a mirror node.
**Transaction Signing Requirements**
* The key or keys on the file are required to sign this transaction to modify the file properties
* If you are updating the keys on the file, you must sign with the old key and the new key
* If you do not sign with the key(s) on the file, you will receive an `INVALID_SIGNATURE` network error
**Transaction Fees**
* Please see the transaction and query [fees](/hedera/networks/mainnet/fees#transaction-and-query-fees) table for base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your transaction fee cost
#### File Properties
| Field | Description |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Key(s)** | Update the keys which must sign any transactions modifying this file. All keys must sign to modify the file's contents or keys. No key is required to sign for extending the expiration time (except the one for the operator account paying for the transaction). The network currently requires a file to have at least one key (or key list or threshold key) but this requirement may be lifted in the future. |
| **Contents** | The content to update the files with. |
| **Expiration Time** | If set, update the expiration time of the file. Must be in the future (may only be used to extend the expiration). To make a file inaccessible use FileDeleteTransaction. |
| **Memo** | Short publicly visible memo about the file. No guarantee of uniqueness. (100 characters max) |
| Constructor | Description |
| ----------------------------- | -------------------------------------------- |
| `new FileUpdateTransaction()` | Initializes the FileUpdateTransaction object |
```java theme={null}
new FileUpdateTransaction()
```
### Methods
**Note:** The total size for a given transaction is limited to 6KiB. If you exceed this value you will need to submit a FileUpdateTransaction that is less than 6KiB and then submit a FileAppendTransaction to add the remaining content to the file.
| Method | Type | Requirement |
| --------------------------------- | --------- | ----------- |
| `setFileId()` | FileId | Required |
| `setKey()` | Key | Optional |
| `setContents()` | byte \[ ] | Optional |
| `setContents()` | String | Optional |
| `setExpirationTime()` | Instant | Optional |
| `setFileMemo()` | String | Optional |
```java Java theme={null}
//Create the transaction
FileUpdateTransaction transaction = new FileUpdateTransaction()
.setFileId(fileId)
.setKeys(newKey);
//Modify the max transaction fee
FileUpdateTransaction txFee = transaction.setMaxTransactionFee(new Hbar(3));
//Freeze the transaction, sign with the original key, sign with the new key, sign with the client operator key and submit the transaction to a Hedera network
TransactionResponse txResponse = txFee.freezeWith(client).sign(fileKey).sign(newKey).execute(client);
//Get the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = await new FileUpdateTransaction()
.setFileId(fileId)
.setContents("The new contents")
.setMaxTransactionFee(new Hbar(2))
.freezeWith(client);
//Sign with the file private key
const signTx = await transaction.sign(fileKey);
//Sign with the client operator private key and submit to a Hedera network
const submitTx = await signTx.execute(client);
//Request the receipt
const receipt = await submitTx.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status " +transactionStatus3.toString());
//v2.0.5
```
```java Go theme={null}
//Create the transaction
transaction := hedera.NewFileUpdateTransaction().
SetFileID(fileId).
SetKeys(newKey)
//Modify the max transaction fee
modifyMaxTransactionFee := transaction.SetMaxTransactionFee(hedera.HbarFrom(2, hedera.HbarUnits.Hbar))
//Prepare the transaction for signing
freezeTransaction, err := modifyMaxTransactionFee.FreezeWith(client)
if err != nil {
panic(err)
}
//Sign with the key on the file, sign with the client operator key and submit to a Hedera network
txResponse, err := freezeTransaction.Sign(fileKey).Sign(newKey).Execute(client)
if err != nil {
panic(err)
}
//Request the receipt
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction status
transactionStatus := receipt.Status
fmt.Println("The transaction consensus status is ", transactionStatus)
//v2.0.0
```
```rust Rust theme={null}
// Create the transaction
let transaction = FileUpdateTransaction::new()
.file_id(file_id)
.keys([new_key])
.contents("The new contents")
.file_memo("Updated file memo")
.max_transaction_fee(Hbar::new(2));
// Sign with the file key and new key
let tx_response = transaction
.freeze_with(&client)?
.sign(file_key)
.sign(new_key)
.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction consensus status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
## Get transaction values
| Method | Type | Requirement |
| --------------------- | ---------- | ----------- |
| `getFileId()` | FileId | Optional |
| `getKey()` | Key | Optional |
| `setContents()` | ByteString | Optional |
| `getExpirationTime()` | Instant | Optional |
| `getFileMemo()` | String | Optional |
```java Java theme={null}
//Create the transaction
FileUpdateTransaction transaction = new FileUpdateTransaction()
.setFileId(fileId)
.setKeys(newKey);
//Get the contents of a file
Key getKey = transaction.getKey();
//v2.0.0
```
```java JavaScript theme={null}
//Create the transaction
const transaction = new FileUpdateTransaction()
.setFileId(newFileId);
//Get the contents of a file
const getKey = transaction.getKey();
```
```java Go theme={null}
//Create the transaction
transaction := hedera.NewFileUpdateTransaction().
SetFileID(fileId).
SetKeys(newKey)
//Get the contents of a file
getKey := transaction.GetKeys()
//v2.0.0
```
```rust Rust theme={null}
// Create the transaction
let transaction = FileUpdateTransaction::new()
.file_id(file_id)
.keys([new_key]);
// Get the key
let key = transaction.get_key();
// v0.34.0
```
# General Network Response Messages
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/general-errors
General network response messages and their descriptions.
| Error | Description |
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AUTORENEW_DURATION_NOT_IN_RANGE` | The duration is not a subset of \[MINIMUM\_AUTORENEW\_DURATION, MAXIMUM\_AUTORENEW\_DURATION] |
| `ACCOUNT_IS_NOT_GENESIS_ACCOUNT` | Special Account Operations should be performed by only Genesis account, return this code if it is not Genesis Account |
| `BATCH_LIST_EMPTY (388)` | The list of batch transactions is empty |
| `BATCH_LIST_CONTAINS_DUPLICATES (389)` | The list of batch transactions contains duplicated transactions |
| `BATCH_TRANSACTION_IN_BLACKLIST (390)` | The transaction has been blacklisted |
| `BATCH_KEY_SET_ON_NON_INNER_TRANSACTION (393)` | There is a batch key set on an outer (non-inner) transaction |
| `DUPLICATE_TRANSACTION` | This transaction ID is a duplicate of one that was submitted to this node or reached consensus in the last 180 seconds (receipt period) |
| `ENTITY_NOT_ALLOWED_TO_DELETE` | Entities with Entity ID below 1000 are not allowed to be deleted |
| `EMPTY_QUERY_BODY` | The query body is empty |
| `EMPTY_TRANSACTION_BODY` | Transaction body provided is empty |
| `FAIL_INVALID` | There was a system error and the transaction failed because of invalid request parameters. |
| `FREEZE_TRANSACTION_BODY_NOT_FOUND` | FreezeTransactionBody does not exist |
| `INNER_TRANSACTION_FAILED (391)` | An inner transaction within the batch failed |
| `INSUFFICIENT_PAYER_BALANCE` | The payer account has insufficient cryptocurrency to pay the transaction fee |
| `INSUFFICIENT_TX_FEE` | The fee provided in the transaction is insufficient for this type of transaction |
| `INVALID_BATCH_KEY (394)` | Batch key submitted with the transaction is not valid. |
| `INVALID_FEE_SUBMITTED` | Invalid fee submitted |
| `INVALID_FREEZE_TRANSACTION_BODY` | FreezeTransactionBody is invalid |
| `INVALID_NODE_ACCOUNT` | Node Account provided does not match the node account of the node the transaction was submitted to. |
| `INVALID_PAYER_SIGNATURE` | Payer signature is invalid |
| `INVALID_RECEIVING_NODE_ACCOUNT` | In Query validation, an account with +ve(amount) value should be Receiving node account, the receiver account should be only one account in the list |
| `INVALID_RENEWAL_PERIOD` | Auto-renewal period is not a positive number of seconds |
| `INVALID_TRANSACTION` | For any error not handled by specific error codes listed below |
| `INVALID_TRANSACTION_BODY` | Invalid transaction body provided |
| `INVALID_TRANSACTION_ID` | The transaction id is not valid |
| `INVALID_TRANSACTION_DURATION` | Valid transaction duration is a positive non zero number that does not exceed 120 seconds |
| `INVALID_TRANSACTION_START` | Transaction start time is greater than the current consensus time |
| `INVALID_SIGNATURE` | The transaction signature is not valid |
| `OK` | The transaction passed the precheck validations. |
| `MEMO_TOO_LONG` | Transaction memo size exceeded 100 bytes |
| `MISSING_QUERY_HEADER` | Header is missing in Query request |
| `NOT_SUPPORTED` | The API is not currently supported |
| `PAYER_ACCOUNT_NOT_FOUND` | Payer account does not exist. |
| `PAYER_ACCOUNT_UNAUTHORIZED` | The fee payer account doesn't have permission to submit such Transaction |
| `PLATFORM_NOT_ACTIVE` | The platform node is either disconnected or lagging behind |
| `PLATFORM_TRANSACTION_NOT_CREATED` | Transaction not created by platform due to large backlog |
| `RECEIPT_NOT_FOUND` | Receipt for given transaction id does not exist |
| `RECORD_NOT_FOUND` | Record for given transaction id does not exist |
| `SUCCESS` | The transaction succeeded |
| `TRANSACTION_EXPIRED` | Pre-Check error when TransactionValidStart + transactionValidDuration is less than current consensus time. |
| `TRANSACTION_OVERSIZE` | The size of the Transaction is greater than transactionMaxBytes |
| `TRANSACTION_TOO_MANY_LAYERS` | The Transaction has more than 50 levels |
| `UNKNOWN` | This node has submitted this transaction to the network. Status of the transaction is currently unknown. |
## Keys
| Error | Description |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `BAD_ENCODING` | Unsupported algorithm/encoding used for keys in the transaction |
| `INVALID_KEY_ENCODING` | Provided key encoding was not supported by the system |
| `INVALID_SIGNATURE_COUNT_MISMATCHING_KEY` | The number of key (KeyList, or ThresholdKey) does not match that of signature (SignatureList, or ThresholdKeySignature). e.g. if a keyList has 3 base keys, then the corresponding signatureList should also have 3 base signatures. |
| `INVALIDSIGNATURE_TYPE_MISMATCHING` | The type of key (base ed25519 key, KeyList, or ThresholdKey) does not match the type of signature (base ed25519 signature, SignatureList, or ThresholdKeySignature) |
| `KEY_NOT_PROVIDED` | The keys were not provided in the request. |
| `KEY_PREFIX_MISMATCH` | One public key matches more than one prefixes on the signature map |
| `KEY_REQUIRED` | Key not provided in the transaction body |
# HBAR
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/hbars
| **Constructor** | **Type** | **Description** |
| -------------------- | -------- | --------------------------- |
| `new Hbar()` | Hbar | Initializes the Hbar object |
```java theme={null}
new Hbar()
```
## HBAR from:
Construct ***HBAR*** from different representations.
| **Method** | **Type** | **Description** |
| ------------------------------- | ---------------------------- | --------------------------------------------------------------- |
| `Hbar.from()` | long / BigDecimal | Returns an Hbar whose value is equal to the specified value |
| `Hbar.from()` | long / BigDecimal , HbarUnit | Returns an Hbar representing the value in the given units |
| `Hbar.fromString()` | CharSequence | Converts the provided string into an amount of hbars |
| `Hbar.fromString()` | CharSequence, HbarUnit | Converts the provided string into an amount of hbars |
| `Hbar.fromTinybars()` | long | Returns an Hbar converted from the specified number of tinybars |
```java Java theme={null}
//10 HBAR
new Hbar(10);
//10 HBAR from hbar value
Hbar.from(10);
//100 tinybars from HBAR convert to unit
Hbar.from(100, HbarUnit.TINYBAR);
// 10 HBAR converted from string value
Hbar.fromString("10");
//100 tinybars from string value
Hbar.fromString("10", HbarUnit.TINYBAR);
// v2.0.0+
```
```javascript JavaScript theme={null}
// 10 HBAR
new Hbar(10);
//10 HBAR
Hbar.from(10);
//100 tinybars
Hbar.from(100, HbarUnit.TINYBAR);
// 10 HBAR converted from string value
Hbar.fromString("10");
//100 tinybars from string value
Hbar.fromString("100", HbarUnit.TINYBAR);
```
```go Go theme={null}
//100 HBAR
hedera.NewHbar(10)
//100 tinybars
hedera.HbarFrom(10, hedera.HbarUnits.Tinybar)
// v2.0.0+
```
```rust Rust theme={null}
// 10 HBAR
Hbar::new(10);
// 10 HBAR from hbar value
Hbar::from(10);
// 100 tinybars from HBAR convert to unit
Hbar::from_tinybars(100);
// 10 HBAR converted from string value
Hbar::from_str("10")?;
// v0.34.0
```
### HBAR to:
Convert ***HBAR*** to a different unit/format.
| **Method** | **Type** | **Description** |
| ------------------ | -------- | ------------------------------------------------------------------- |
| `to()` | HbarUnit | Specify the unit of hbar to convert to. Use `As` for Go. |
| `toString()` | HbarUnit | String value of the hbar unit to convert to. Use `String()` for Go. |
| `toTinybars()` | Long | Hbar value converted to tinybars |
```java Java theme={null}
//10 HBAR converted to tinybars
new Hbar(10).to(HbarUnit.TINYBAR);
//10 HBAR converted to tinybars
new Hbar(10).toString(HbarUnit.TINYBAR);
//10 HBAR converted to tinybars
new Hbar(10).toTinybars();
// v2.0.0+
```
```javascript JavaScript theme={null}
//10 HBAR converted to tinybars
new Hbar(10).to(HbarUnit.TINYBAR);
//10 HBAR converted to tinybars
new Hbar(10).toString(HbarUnit.TINYBAR);
//10 HBAR converted to tinybars
new Hbar(10).toTinybars();
```
```go Go theme={null}
//10 HBAR converted to tinybars
hedera.NewHbar(10).As(hedera.HbarUnits.Tinybar)
//10 HBAR to string format
hedera.NewHbar(10).String()
//10 HBAR converted to tinybars
hedera.NewHbar(10).AsTinybar()
// v2.0.0+
```
```rust Rust theme={null}
// 10 HBAR converted to tinybars
Hbar::new(10).to(HbarUnit::Tinybar);
// 10 HBAR converted to tinybars
Hbar::new(10).to_tinybars();
// v0.34.0
```
## **HBAR** constants:
Provided constant values of ***HBAR***.
| **Method** | **Type** | **Description** |
| ----------- | -------- | -------------------------------------------------------------------------- |
| `Hbar.MAX` | Hbar | A constant value of the maximum number of hbars (50\_000\_000\_000 hbars) |
| `Hbar.MIN` | Hbar | A constant value of the minimum number of hbars (-50\_000\_000\_000 hbars) |
| `Hbar.ZERO` | Hbar | A constant value of zero hbars |
```java Java theme={null}
//The maximum number of hbars
Hbar hbarMax = Hbar.MAX;
//The minimum number of hbars
Hbar hbarMin = Hbar.MIN;
//A constant value of zero hbars
Hbar hbarZero = Hbar.ZERO;
// v2.0.0+
```
```javascript JavaScript theme={null}
//The maximum number of hbars
const hbarMax = Hbar.MAX;
//The minimum number of hbars
const hbarMin = Hbar.MIN;
//A constant value of zero hbars
const hbarZero = Hbar.ZERO;
```
```go Go theme={null}
//The maximum number of hbars
hbarMax := hedera.MaxHbar
//The minimum number of hbars
hbarMin := hedera.MinHbar
//A constant value of zero hbars
hbarZero := hedera.ZeroHbar
// v2.0.0+
```
```rust Rust theme={null}
// The maximum number of hbars
let hbar_max = Hbar::MAX;
// The minimum number of hbars
let hbar_min = Hbar::MIN;
// A constant value of zero hbars
let hbar_zero = Hbar::ZERO;
// v0.34.0
```
## **HBAR** units
Modify the ***HBAR*** representation to one of the ***HBAR*** denominations.
| **Function** | **Description** |
| ------------------- | ----------------------------------------------------------------------- |
| `HbarUnit.TINYBAR` | The atomic (smallest) unit of hbar, used natively by the Hedera network |
| `HbarUnit.MICROBAR` | Equivalent to 100 tinybar or 1⁄1,000,000 hbar. |
| `HbarUnit.MILLIBAR` | Equivalent to 100,000 tinybar or 1⁄1,000 hbar |
| `HbarUnit.HBAR` | The base unit of hbar, equivalent to 100 million tinybar. |
| `HbarUnit.KILOBAR` | Equivalent to 1 thousand hbar or 100 billion tinybar.HbarUnit.Megabar |
| `HbarUnit.MEGABAR` | Equivalent to 1 million hbar or 100 trillion tinybar. |
| `HbarUnit.GIGABAR` | Equivalent to 1 billion hbar or 100 quadrillion tinybar. |
```java Java theme={null}
//100 tinybars
Hbar.from(100, HbarUnit.TINYBAR);
// v2.0.0+
```
```javascript JavaScript theme={null}
//100 tinybars
Hbar.from(100, HbarUnit.TINYBAR);
// v2.0.0+
```
```go Go theme={null}
//100 tinybars
hedera.HbarFrom(100, hedera.HbarUnits.Tinybar)
// v2.0.0+
```
## HBAR decimal places
The decimal precision of ***HBAR*** varies across the different Hedera APIs. While HAPI, JSON-RPC Relay, and Hedera Smart Contract Service (EVM) provide 8 decimal places, the **`msg.value`** in JSON-RPC Relay provides 18 decimal places.
| API | Decimal |
|---|
Hedera API (HAPI) (Crypto + SCS Service (msg.value)) | 8 |
| Hedera Smart Contract Service (EVM) | 8 |
| JSON RPC Relay (passed as arguments) | 8 |
JSON RPC Relay (msg.value) | 18 |
***Note:** The JSON-RPC Relay **`msg.value`** uses 18 decimals when it returns HBAR. As a result, the **`gasPrice`** also uses 18 decimal places since it is only utilized from the JSON-RPC Relay.*
# Keys
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/keys
# Create a key list
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/keys/create-a-key-list
Create a key list key structure where all the keys in the list are required to sign transactions that modify accounts, topics, tokens, smart contracts, or files. A key list can contain a [Ed25519](/hedera/sdks-and-apis/sdks/keys/generate-a-new-key-pair#ed25519) or [ECDSA](/hedera/sdks-and-apis/sdks/keys/generate-a-new-key-pair#ecdsa-secp256k1) (secp256k1\_)\_ key type.
If all the keys in the key list key structure do not sign, the transaction will fail and return an "INVALID\_SIGNATURE" error. A key list can have repeated keys. A signature for the repeated key will count as many times as the key is listed in the key list. For example, a key list has three keys. Two of the three public keys in the list are the same. When a user signs a transaction with the repeated key it will account for two out of the three keys required signature.
| | |
|---|
| Method | Type | Description |
KeyList.of(\) | Key | Keys to add to the key list |
```java theme={null}
//Generate 3 keys
PrivateKey key1 = PrivateKey.generate();
PublicKey publicKey1 = key1.getPublicKey();
PrivateKey key2 = PrivateKey.generate();
PublicKey publicKey2 = key2.getPublicKey();
PrivateKey key3 = PrivateKey.generate();
PublicKey publicKey3 = key3.getPublicKey();
//Create a key list where all 3 keys are required to sign
KeyList keyStructure = KeyList.of(key1, key2, key3);
System.println(keyStructure)
//v2.0.0
```
**Sample Output**
```
KeyList{threshold=null,
keys=[302e020100300506032b6570042204201cd556de918842179791d9edd75cdd2b5d34c5c73b0239ec0b34c67eedc020fd, 302e020100300506032b6570042204209ca1ce4463b71c72bba0219c37e18347a5145a9797c6546a6c99e50255c54be3, 302e020100300506032b657004220420982bb43f4947e8376e2f0ebfde086d24323b04d731da29446e5bc399ffbe06e1]
}
```
```java theme={null}
//Generate 3 keys
const key1 = PrivateKey.generate();
const publicKey1 = key1.publicKey;
const key2 = PrivateKey.generate();
const publicKey2 = key2.publicKey;
const key3 = PrivateKey.generate();
const publicKey3 = key3.publicKey;
//Create a list of the keys
const publicKeyList = [];
publicKeyList.push(publicKey1);
publicKeyList.push(publicKey2);
publicKeyList.push(publicKey3);
//Create a key list where all 3 keys are required to sign
const keys = new KeyList(publicKeyList);
//v2.0.13
```
```java theme={null}
//Generate 3 keys
key1, err := hedera.GeneratePrivateKey()
if err != nil {
panic(err)
}
publicKey1, err := key1.PublicKey()
key2, err := hedera.GeneratePrivateKey()
if err != nil {
panic(err)
}
publicKey2, err := key2.PublicKey()
key3, err := hedera.GeneratePrivateKey()
if err != nil {
panic(err)
}
publicKey3, err := key3.PublicKey()
//Create a key list where all 3 keys are required to sign
keys := make([]hedera.PublicKey, 3)
keys[0] = publicKey1
keys[1] = publicKey2
keys[2] = publicKey3
keyStructure := hedera.NewKeyList().AddAllPublicKeys(keys)
fmt.Printf("The key list is %v\n", keyStructure)
//v2.0.0
```
```rust theme={null}
let key_list = KeyList::new()
println!("The key list is {:?}", key_list);
// v0.34.0
```
# Create a threshold key
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/keys/create-a-threshold-key
Create a key structure that requires the defined threshold value to sign. A threshold key can contain a [Ed25519](/hedera/sdks-and-apis/sdks/keys/generate-a-new-key-pair#ed25519) or [ECDSA](/hedera/sdks-and-apis/sdks/keys/generate-a-new-key-pair#ecdsa-secp256k1) (secp256k1\_)\_ key type. You can use either the public key or the private key to create the key structure. If the threshold requirement is not met when signing transactions, the network will return an "INVALID\_SIGNATURE" error.
| **Method** | **Type** | **Description** |
| ----------------------------------------- | -------- | -------------------------------------------------------------------------------------------------- |
| `KeyList.withThreshold()` | int | The number of keys required to sign transactions to modify the account i.e. transfers, update, etc |
```java Java expandable theme={null}
//Generate 3 keys
PrivateKey key1 = PrivateKey.generate();.
PublicKey publicKey1 = key1.getPublicKey();
PrivateKey key2 = PrivateKey.generate();
PublicKey publicKey2 = key2.getPublicKey();
PrivateKey key3 = PrivateKey.generate();
PublicKey publicKey3 = key3.getPublicKey();
PrivateKey[] keys = new PrivateKey[3]; //You can also use the 3 public keys here
keys[0] = key1;
keys[1] = key2;
keys[2] = key3;
//A key structure that requires one of the 3 keys to sign
KeyList thresholdKey = KeyList.withThreshold(1);
//Add the three keys to the thresholdKey
Collections.addAll(thresholdKey, keys);
System.out.println("The 1/3 threshold key structure" +thresholdKey);
//v2.0.0
```
```javascript JavaScript expandable theme={null}
// Generate our key lists
const privateKeyList = [];
const publicKeyList = [];
for (let i = 0; i < 4; i += 1) {
const privateKey = PrivateKey.generate();
const publicKey = privateKey.publicKey;
privateKeyList.push(privateKey);
publicKeyList.push(publicKey);
console.log(`${i}: pub key:${publicKey}`);
console.log(`${i}: priv key:${privateKey}`);
}
// Create our threshold key
const thresholdKey = new KeyList(publicKeyList,1);
console.log("The 1/3 threshold key structure" +thresholdKey);
//2.0.2
```
```go Go expandable theme={null}
//Generate 3 keys
key1, err := hedera.GeneratePrivateKey()
if err != nil {
panic(err)
}
publicKey1 := key1.PublicKey()
key2, err := hedera.GeneratePrivateKey()
if err != nil {
panic(err)
}
publicKey2:= key2.PublicKey()
key3, err := hedera.GeneratePrivateKey()
if err != nil {
panic(err)
}
publicKey3 := key3.PublicKey()
//Create a key list where all 3 keys are required to sign
keys := make([]hedera.PublicKey, 3)
keys[0] = publicKey1
keys[1] = publicKey2
keys[2] = publicKey3
//A key structure that requires one of the 3 keys to sign
thresholdKey := hedera.KeyListWithThreshold(1).
AddAllPublicKeys(keys)
fmt.Printf("The 1/3 threshold key structure %v\n", thresholdKey)
//v2.0.0
```
```rust Rust theme={null}
// Generate 2 keys
let key1 = PrivateKey::generate_ed25519();
let key2 = PrivateKey::generate_ed25519();
// Create a threshold key that requires 1 out of 2 keys to sign
let threshold_key = KeyList {
keys: vec![key1.public_key().into(), key2.public_key().into()],
threshold: Some(1),
};
println!("The 1/2 threshold key structure {:?}", threshold_key);
// v0.34.0
```
**Sample Output:**
```
KeyList{threshold=1,
keys=[
302e020100300506032b657004220420984bd6b4e0cac783654f30c8797655953c6ab432e78bc09a34fbda594c6395ed,
302e020100300506032b657004220420a4a7bd506f33868416d53eff55b3e8a254e17accf6cb37f44975792ededac120,
302e020100300506032b657004220420f8a6f2ba3174391e619a87506fb0b86c6e481809563a797f4f84715d1a471695]
}
```
# Generate a mnemonic phrase
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/keys/generate-a-mnemonic-phrase
Generate a 12 or 24-word mnemonic phrase that can be used to recover the private keys that are associated with it.
| | |
|---|
| Method | Type | Description |
Mnemonic.generate24() | Mnemonic | Generates a 24-word recovery phrase that can be used to recover a private key |
Mnemonic.generate12() | Mnemonic | Generates a 12-word recovery phrase that can be used to recover a private key |
```java Java theme={null}
// 24-word recovery phrase
Mnemonic mnemonic = Mnemonic.generate24();
System.out.println("mnemonic 24 word = " + mnemonic);
//12 word recovery phrase
Mnemonic mnemonic12 = Mnemonic.generate12();
System.out.println("mnemonic 12 word = " + mnemonic12);
//v2.0.0
```
```javascript JavaScript theme={null}
// generate a 24-word mnemonic
const mnemonic = await Mnemonic.generate();
console.log(mnemonic)
```
```java Go theme={null}
//Generate 24 word mnemonic
mnemonic24, err := hedera.GenerateMnemonic()
if err != nil {
panic(err)
}
privateKey, err := mnemonic24.ToPrivateKey( /* passphrase */ "")
if err != nil {
panic(err)
}
publicKey := privateKey.PublicKey()
fmt.Printf("mnemonic = %v\n", mnemonic)
//v2.0.0
```
# Generate a new key pair
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/keys/generate-a-new-key-pair
## ECDSA (secp256k1\_)
Create a new ***ECDSA*** (secp256k1) key pair used to sign transactions and queries on a Hedera network. The private key is kept confidential and is used to sign transactions that modify the state of an account, topic, token, smart contract, or file entity on the network. The public key can be shared with other users on the network.
| **Method** | **Type** | **Description** |
| ---------------------------------------------------------------------- | ---------- | -------------------------------------------------------- |
| `PrivateKey.generateECDSA()` | PrivateKey | Generates an ECSDA private key |
| `PrivateKey.generateECDSA().getPublicKey()` | PublicKey | Derive a public key from this ECDSA private key |
| `PrivateKey.generateECDSA().publicKey()` | PublicKey | Derive a public key from this ECDSA private key |
| `PrivateKey.generateECDSA().publicKey().toAccountId(, )` | long, long | Contructs an account ID from an account alias public key |
```java Java theme={null}
PrivateKey privateKey = PrivateKey.generateECDSA();
PublicKey publicKey = privateKey.getPublicKey();
System.out.println("private key = " + privateKey);
System.out.println("public key = " + publicKey);
```
```javascript JavaScript theme={null}
const privateKey = await PrivateKey.generateECDSAAsync();
const publicKey = privateKey.publicKey;
console.log("private key = " + privateKey);
console.log("public key = " + publicKey);
```
```go Go theme={null}
privateKey, err := hedera.GenerateEcdsaPrivateKey()
if err != nil {
panic(err)
}
publicKey := privateKey.PublicKey()
fmt.Printf("private key = %v\n", privateKey)
fmt.Printf("public key = %v\n", publicKey)
```
```rust Rust theme={null}
// Generate ED25519 key pair
let private_key = PrivateKey::generate_ed25519()?;
let public_key = private_key.public_key();
println!("private key = {:?}", private_key);
println!("public key = {:?}", public_key);
// Generate ECDSA key pair
let private_key = PrivateKey::generate_ecdsa()?;
let public_key = private_key.public_key();
println!("private key = {:?}", private_key);
println!("public key = {:?}", public_key);
// v0.34.0
```
**Sample Output:**
```bash theme={null}
private key = 3030020100300706052b8104000a042204205edee337f333dbf6ae3e0b1e1298cbe1fe37faf47b9faed326a3917b0e828891
public key = 302d300706052b8104000a03220002e1f3b3bad1e0d97ed129725efaa4fc0289735a9f355438d2619676f1ff3f30dd
```
## ED25519
Create a new ***ED25519*** key pair used to sign transactions and queries on the Hedera network. The private key is kept confidential and is used to sign transactions that modify the state of an account, topic, token, smart contract, or file entity on the network. The public key can be shared with other users on the network.
| **Method** | **Type** | **Description** |
| ----------------------------------------------------------------------- | ---------- | ------------------------------------------------------------ |
| `PrivateKey.generateED25519()` | PrivateKey | Generates an Ed25519 private key |
| `PrivateKey.generateED25519().getPublicKey()` | PublicKey | Derive a public key from this Ed25519 private key |
| `PrivateKey.generateED25519().publicKey()` | PublicKey | Derive a public key from this Ed25519 private key |
| `PrivateKey.generateED25519().publicKey().toAccountId(,)` | long, long | Contruct an alias account ID from a alias public key address |
| **`[DEPRECATED]`**`PrivateKey.generate()` | PrivateKey | Generates an Ed25519 private key |
```java Java theme={null}
PrivateKey privateKey = PrivateKey.generateED25519();
PublicKey publicKey = privateKey.getPublicKey();
System.out.println("private key = " + privateKey);
System.out.println("public key = " + publicKey);
```
```javascript JavaScript theme={null}
const privateKey = await PrivateKey.generateED25519Async();
const publicKey = privateKey.publicKey;
console.log("private key = " + privateKey);
console.log("public key = " + publicKey);
```
```go Go theme={null}
privateKey, err := hedera.GenerateEd25519PrivateKey()
if err != nil {
panic(err)
}
publicKey := privateKey.PublicKey()
fmt.Printf("private key = %v\n", privateKey)
fmt.Printf("public key = %v\n", publicKey)
```
```rust Rust theme={null}
// Generate ED25519 key pair
let private_key = PrivateKey::generate_ed25519()?;
let public_key = private_key.public_key();
println!("private key = {:?}", private_key);
println!("public key = {:?}", public_key);
// Generate ECDSA key pair
let private_key = PrivateKey::generate_ecdsa()?;
let public_key = private_key.public_key();
println!("private key = {:?}", private_key);
println!("public key = {:?}", public_key);
// v0.34.0
```
**Sample Output:**
```
private key = 302e020100300506032b657004220420b9c3ebac81a72aafa5490cc78111643d016d311e60869436fbb91c73307ed35a
public key = 302a300506032b65700321001a5a62bb9f35990d3fea1a5bb7ef6f1df0a297697adef1e04510c9d4ecc5db3f
```
# Import an existing key
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/keys/import-an-existing-key
Construct keys in another format to a key representation or import keys from a file.
| | |
|---|
| Method | Type | Description |
PrivateKey.fromString(\) | String | Constructs a private key string to PrivateKey |
PublicKey.fromString(\) | String | Constructs a public key string to PublicKey |
PrivateKey.fromStringECDSA(\) | String | Constructs an ECDSA key from a private key string |
PublicKey.fromStringECDSA(\) | String | Constructs an ECDSA public key from a public key string |
PrivateKey.fromBytesECDSA(\) | byte\[ ] | Constructs an ECDSA key from a private key bytes |
PublicKey.fromBytesECDSA(\) | byte\[ ] | Constructs an ECDSA public key from a public key bytes |
PrivateKey.fromStringED25519(\) | String | Constructs an ED25519 key from a private key string |
PublicKey.fromStringED25519(\) | String | Constructs an ED25519 public key from a public key string |
PrivateKey.fromBytesED25519(\) | byte \[ ] | Constructs an ED25519 key from a private key bytes |
PublicKey.fromBytesED25519(\) | byte \[ ] | Constructs an ED25519 public key from a public key bytes |
PrivateKey.fromBytes(\) | byte \[ ] | Constructs a private key from bytes to PrivateKey |
PublicKey.fromBytes(\) | byte \[ ] | Contructs a public key from bytes to PublicKey |
PrivateKey.fromPem(\) | String | Parse a private key from a PEM encoded string |
PrivateKey.fromPem(\) | String, String | Parse a private key from a PEM encoded string. The private key may be encrypted, e.g. if it was generated by OpenSSL. |
PrivateKey.readPem(\) | Reader | Parse a private key from a PEM encoded reader |
PrivateKey.readPem(\) | Reader, String | Parse a private key from a PEM encoded stream. The key may be encrypted, e.g. if it was generated by OpenSSL. |
```java Java theme={null}
//Converts an ECDSA private key string to PrivateKey
PrivateKey privateKey = PrivateKey.fromStringECDSA("3030020100300706052b8104000a042204208776c6b831a1b61ac10dac0304a2843de4716f98b09147a169f41d7b4d48ad5");
//The public key associated with the private key
PublicKey publicKey = PublicKey.fromStringECDSA("3036301006072a8648ce3d020106052b8104000a032200029bba954cd41e8ab9f05a0b3b038b1c2c35b9bc16b4e38bc67a2e5ebab2fe72fb");
```
```javascript JavaScript theme={null}
//Converts an ECDSA private key string to PrivateKey
const privateKey = PrivateKey.fromStringECDSA("3030020100300706052b8104000a042204208776c6b831a1b61ac10dac0304a2843de4716f98b09147a169f41d7b4d48ad5");
//The public key associated with the private key
const publicKey = PublicKey.fromStringECDSA("3036301006072a8648ce3d020106052b8104000a032200029bba954cd41e8ab9f05a0b3b038b1c2c35b9bc16b4e38bc67a2e5ebab2fe72fb");
```
```go Go theme={null}
//Converts an ECDSA private key string to PrivateKey
privateKey, err := hedera.PrivateKeyFromStringECDSA("3030020100300706052b8104000a042204208776c6b831a1b61ac10dac0304a2843de4716f98b09147a169f41d7b4d48ad5")
if err != nil {
panic(err)
}
//The public key associated with the private key
publicKey, err := hedera.PublicKeyFromStringECDSA("3036301006072a8648ce3d020106052b8104000a032200029bba954cd41e8ab9f05a0b3b038b1c2c35b9bc16b4e38bc67a2e5ebab2fe72fb")
if err != nil {
panic(err)
}
```
```rust Rust theme={null}
// Import ECDSA keys from strings
let private_key = PrivateKey::from_str("3030020100300706052b8104000a042204208776c6b831a1b61ac10dac0304a2843de4716f98b09147a169f41d7b4d48ad5");
let public_key = PublicKey::from_str("3036301006072a8648ce3d020106052b8104000a032200029bba954cd41e8ab9f05a0b3b038b1c2c35b9bc16b4e38bc67a2e5ebab2fe72fb");
// Import from PEM
let private_key = PrivateKey::from_pem("-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----");
// With password if encrypted
let private_key = PrivateKey::from_pem_with_password("-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----", "password");
println!("Imported private key: {:?}", private_key);
println!("Imported public key: {:?}", public_key);
// v0.34.0
```
# Recover keys from a mnemonic phrase
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/keys/recover-keys-from-a-mnemonic-phrase
Recover private keys from a mnemonic phrase.
| | |
|---|
| Method | Type | Description |
PrivateKey.fromMnemonic(\) | Mnemonic | Recover a private key from a mnemonic phrase compatible with the iOS and Android wallets |
PrivateKey.fromMnemonic(\) | Mnemonic. String | Recover a private key from a generated mnemonic phrase and a passphrase |
```java Java theme={null}
//Use the mnemonic to recover the private key
PrivateKey privateKey = PrivateKey.fromMnemonic(mnemonic);
PublicKey publicKey = privateKey.publicKey();
//v2.0.0
```
```java JavaScript theme={null}
//Use a recovered mnemonic to recover the private key
const recoveredMnemonic = await Mnemonic.fromString(mnemonic.toString());
const privateKey = await recoveredMnemonic.toPrivateKey();
//v2.0.5
```
```java Go theme={null}
recoveredKey, err := hedera.PrivateKeyFromMnemonic(mnemonic, "")
publicKey := recoveredKey.PublicKey()
//v2.0.0
```
```rust Rust theme={null}
// Recover private key from mnemonic phrase with passphrase
let private_key = PrivateKey::from_mnemonic_with_passphrase(&mnemonic, "passphrase")?;
let public_key = private_key.public_key();
// v0.34.0
```
# Pseudorandom Number Generator
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/pseudorandom-number-generator
A transaction that generates a pseudorandom number. When the pseudorandom number generate transaction executes, its transaction record will contain the 384-bit array of pseudorandom bytes. The transaction has an optional `range` parameter. If the parameter is given and is positive, then the record will contain a 32-bit pseudorandom integer `r`, where `0 <= r < range` instead of containing the 384 pseudorandom bits.
When the `n`th transaction needs a pseudorandom number, it is given the running hash of all records up to and including the record for transaction `n-3`. If it needs 384 bits, then it uses the entire hash. If it needs 256 bits, it uses the first 256 bits of the hash. If it needs a random number `r` that is in the range `0 <= r < range`, then it lets `x` be the first 32 bits of the hash (interpreted as a signed integer).
The choice of using the hash up to transaction `n-3` rather than `n-1` is to ensure the transactions can be processed quickly. Because the thread calculating the hash will have more time to complete it before it is needed. The use of `n-3` rather than `n-1000000` is to make it hard to predict the pseudorandom number in advance.\\
Reference: [HIP-351](https://hips.hedera.com/hip/hip-351)
| Field | Description |
| --------- | ----------------------------------------------------------- |
| **Range** | The specified range to return the pseudorandom number from. |
#### Methods
| Method | Type | Requirement |
| ------------------- | ------- | ----------- |
| `setRange()` | integer | Optional |
| `getRange()` | integer | Optional |
```java Java theme={null}
//Create the transaction with range set
TransactionResponse transaction = new PrngTransaction()
//Set the range
.setRange(250)
.execute(client);
//Get the record
TransactionRecord transactionRecord = transaction.getRecord(client);
//Get the number
int prngNumber = transactionRecord.prngNumber;
System.out.println(prngNumber);
//SDK version 2.17.0
```
```javascript JavaScript theme={null}
//Create the transaction with range set
const transaction = await new PrngTransaction()
//Set the range
.setRange(250)
.execute(client);
//Get the record
const transactionRecord = await transaction.getRecord(client);
//Get the number
const prngNumber = transactionRecord.prngNumber;
console.log(prngNumber);
//SDK version 2.17.0
```
```go Go theme={null}
transaction, err := hedera.NewPrngTransaction().
// Set the range
SetRange(250).
Execute(client)
if err != nil {
println(err.Error(), ": error executing rng transaction")
return
}
transactionRecord, err := createResponse.GetRecord(client)
if err != nil {
println(err.Error(), ": error getting receipt")
return
}
if transactionRecord.PrngNumber != nil {
println(err.Error(), ": error, pseudo-random number is nil")
return
}
println("The pseudorandom number is:", *transactionRecord.PrngNumber)
//Version 2.17.0
```
```rust Rust theme={null}
// Create the transaction with range set
let transaction = PrngTransaction::new()
.range(250)
.execute(&client)
.await?;
// Get the record
let record = transaction.get_record(&client)?;
// Get the number
if let Some(prng_number) = record.prng_number {
println!("The pseudorandom number is: {:?}", prng_number);
} else {
println!("No pseudorandom number returned in the record.");
}
// v2.17.0+
```
# Queries
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/queries
Queries are requests that do not require network consensus. Queries are processed only by the single node the request is sent to. Below is a list of network queries by service.
#### **Recommend Using Mirror Node REST API**
For obtaining token information and historical data, consider using the Mirror Node REST API endpoint [**Get Token Account Balance**](https://docs.hedera.com/api-reference/tokens/list-token-balances) which offers several advantages:
* **Cost-effective and scalable:** [Mirror node providers](/hedera/core-concepts/mirror-nodes/hedera-mirror-node#mainnet) offer paid plans with a large number of queries included. The Hedera-hosted mirror node offers free queries with specific throttles for testing. While some SDK queries are currently free, these are subject to change in the future.
* **Performance:** Mirror nodes don't burden consensus nodes, allowing them to focus on processing transactions and providing efficient access to historical data without impacting network performance.
* **Historical data:** Mirror nodes store complete transaction history, records, and events - ideal for analytics, auditing, and monitoring past activity.
📚 **For more details on querying data, read:** [Querying Data on Hedera: SDK vs Mirror Node REST API](https://hedera.com/blog/querying-data-on-hedera-sdk-vs-mirror-node-rest-api/)
#### **DEPRECATION NOTICE: `AccountBalanceQuery`**
The `AccountBalanceQuery` is deprecated and will be completely removed in **July 2026**. This is the only SDK method presented on this page and it will no longer function after this date.
A gradual throttle reduction begins in **May 2026**. To avoid rate limiting and future service disruptions, you must migrate to the Mirror Node REST API.
📚 **For the full migration guide, read:** [Migrating from AccountBalanceQuery: What You Need to Know](https://hedera.com/blog/migrating-from-accountbalancequery-what-you-need-to-know)
| Cryptocurrency Accounts | Consensus | Tokens | File Service | Smart Contracts | Schedule Service |
| --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [AccountBalanceQuery](/hedera/sdks-and-apis/sdks/accounts-and-hbar/get-account-balance) | [TopicInfoQuery](/hedera/sdks-and-apis/sdks/consensus-service/get-topic-info) | [TokenBalanceQuery](/hedera/sdks-and-apis/sdks/token-service/get-account-token-balance) | [FileContentsQuery](/hedera/sdks-and-apis/sdks/file-service/get-file-contents) | [ContractCallQuery](/hedera/sdks-and-apis/sdks/smart-contracts/get-a-smart-contract-function) | [ScheduleInfoQuery](/hedera/sdks-and-apis/sdks/schedule-transaction/get-schedule-info) |
| [AccountInfoQuery](/hedera/sdks-and-apis/sdks/accounts-and-hbar/get-account-info) | [TopicMessageQuery](/hedera/sdks-and-apis/sdks/consensus-service/get-topic-message) | [TokenInfoQuery](/hedera/sdks-and-apis/sdks/token-service/get-token-info) | [FileInfoQuery](/hedera/sdks-and-apis/sdks/file-service/get-file-info) | [ContractByteCodeQuery](/hedera/sdks-and-apis/sdks/smart-contracts/get-smart-contract-bytecode) | |
## Get Query Cost
A query that returns the cost of a query prior to submitting the query to the network node for processing. If the cost of the query is greater than the default max query payment (1 HBAR) you can use `setMaxQueryPayment()` to change the default.
| Method | Type | Description |
|---|
getCost(\) | Client | Get the cost of the query in HBAR |
getCost(\) | Client, Duration | The max length of time the SDK will attempt to retry in the event of repeated busy responses from the node(s) |
getCostAsync(\) | Client | Get the cost of a query asynchronously |
```java Java theme={null}
//Create the query request
AccountBalanceQuery query = new AccountBalanceQuery()
.setAccountId(accountId);
//Get the cost of the query
Hbar queryCost = query.getCost(client);
System.out.println("The account balance query cost is " +queryCost);
//v2.0.0
```
```javascript JavaScript theme={null}
//Create the query request
const query = new AccountBalanceQuery()
.setAccountId(accountId);
//Get the cost of the query
const queryCost = await query.getCost(client);
console.log("The account balance query cost is " +queryCost);
//v2.0.0
```
```java Go theme={null}
//Create the query request
query := hedera.NewAccountBalanceQuery().
SetAccountID(newAccountId)
//Get the cost of the query
cost, err := query.GetCost(client)
if err != nil {
panic(err)
}
fmt.Printf("The account balance query cost is: %v\n ", cost.String())
//v2.0.0
```
```rust Rust theme={null}
// Create the query request
let query = AccountBalanceQuery::new()
.account_id(account_id);
// Get the cost of the query
let query_cost = query.get_cost(&client).await?;
println!("The account balance query cost is {:?}", query_cost);
// v0.34.0
```
# Schedule Transaction
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/schedule-transaction
# Create a schedule transaction
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/schedule-transaction/create-a-schedule-transaction
A `ScheduleCreateTransaction` is a consensus node transaction that creates a schedule entity on the Hedera network. The entity ID for a schedule transaction is called a `ScheduleID`. After successfully executing a schedule create transaction, you can retrieve the network assigned `ScheduleID` by requesting the transaction receipt. The receipt also includes the scheduled transaction ID, which can be used to request the record of the scheduled transaction after its successful execution.
When creating a transaction to schedule you do not need to use `.freezeWith(client)` method.
Example:
```java Java theme={null}
TransferTransaction transactionToSchedule = new TransferTransaction()
.addHbarTransfer(newAccountId, Hbar.fromTinybars(-1))
.addHbarTransfer(operatorId, Hbar.fromTinybars(1));
```
Refer to this [page](/hedera/core-concepts/scheduled-transaction#overview) to view the types of transactions that can be scheduled.
### **Schedule Transaction Duplicate**
If two users submit the same `ScheduleCreateTransaction`, the first transaction to reach consensus will create the **schedule ID**.
For example, if User A and User B submit the same scheduled transaction and User A's transaction reaches consensus first, User B's transaction will return the status `IDENTICAL_SCHEDULE_ALREADY_CREATED`. If User B is required to sign the scheduled transaction, they must submit and sign a `ScheduleSignTransaction` to add their signature.
### **Schedule Transaction Deletion**
To retain the ability to delete a schedule transaction, you will need to set the admin key field when creating a schedule transaction. The admin key will be required to sign the `ScheduleDeleteTransaction` to delete the scheduled transaction from the network. If you do not assign an admin key during the creation of the schedule transaction, you will have an immutable schedule transaction.
### **Transaction Signing Requirements**
* The signature of the account paying for the creation of the schedule transaction
* The signature of the payer account responsible for covering the execution fees of the scheduled transaction. For example, if you are scheduling a transfer transaction, the assigned transaction fee payer must provide a signature. If no transaction fee payer account is specified, the schedule's transaction fee payer account will be used by default to cover the execution fees.
* The admin key signature, if set
* You can optionally sign with any of the required signatures for the scheduled transaction. Freeze the schedule transaction and call the `.sign()` method to add signatures in this transaction.
### **Transaction Properties**
| **Field** | **Description** |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Schedulable Transaction Body** | The transaction body of the transaction that is being scheduled. Ex. Transfer Transaction |
| **Admin Key** | A key that can delete the schedule transaction prior to execution or expiration |
| **Payer Account ID** | The account which is going to pay the transaction fees for the execution of the scheduled transaction. If not populated, the account paying for the schedule transaction will be charged (optional). |
| **Expiration Time** | A timestamp for specifying when the transaction should be evaluated for execution and then expire (optional). The maximum allowed value is ***62 days (***[***5356800 seconds***](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-config/src/main/java/com/hedera/node/config/data/SchedulingConfig.java#L35)***)***. |
| **Wait for Expiry** | Set the transaction to execute at the specified expiration time. The default behavior is to execute at the time the minimum number of signatures are received (optional). |
| **Memo** | Publicly visible information about the schedule entity, up to 100 bytes. No guarantee of uniqueness (optional). |
### Methods
| **Method** | **Type** | **Requirement** |
| ---------------------------------------- | ----------- | --------------- |
| `setScheduledTransaction()` | Transaction | Required |
| `setAdminKey()` | Key | Optional |
| `setPayerAccountId()` | AccountId | Optional |
| `setScheduleMemo()` | String | Optional |
| `setExpirationTime(expirationTime)` | Instant | Optional |
| `setWaitForExpiry()` | boolean | Optional |
| `setHighVolume()` | boolean | Optional |
| `getAdminKey()` | Key | Optional |
| `getPayerAccountId()` | AccountId | Optional |
| `getScheduleMemo()` | String | Optional |
| `getHighVolume()` | boolean | Optional |
This transaction supports [high-volume entity creation](/hedera/core-concepts/high-volume-entity-creation)
(HIP-1313). Setting `setHighVolume(true)` routes the transaction through dedicated
high-volume throttle capacity with variable-rate pricing. Always pair this with
`setMaxTransactionFee()` to cap your costs.
```java Java theme={null}
//Create a schedule transaction
ScheduleCreateTransaction transaction = new ScheduleCreateTransaction()
.setScheduledTransaction(transactionToSchedule);
//Sign with the client operator key and submit the transaction to a Hedera network
TransactionResponse txResponse = transaction.execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the schedule ID
ScheduleId scheduleId = receipt.scheduleId;
System.out.println("The schedule ID of the schedule transaction is " +scheduleId);
```
```javascript JavaScript theme={null}
//Create a schedule transaction
const transaction = new ScheduleCreateTransaction()
.setScheduledTransaction(transactionToSchedule);
//Sign with the client operator key and submit the transaction to a Hedera network
const txResponse = await transaction.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the schedule ID
const scheduleId = receipt.scheduleId;
console.log("The schedule ID of the schedule transaction is " +scheduleId);
```
```go Go theme={null}
//Create a schedule transaction
transaction, err := transactionToSchedule.Schedule()
if err != nil {
panic(err)
}
//Sign with the client operator key and submit the transaction to a Hedera network
txResponse, err := transaction.Execute(client)
if err != nil {
panic(err)
}
//Request the receipt of the transaction
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the schedule ID from the receipt
scheduleId := *receipt.ScheduleID
fmt.Printf("The new token ID is %v\n", scheduleId)
```
```rust Rust theme={null}
// Create a schedule transaction
let transaction = ScheduleCreateTransaction::new()
.scheduled_transaction(transaction_to_schedule);
// Sign with the client operator key and submit the transaction to a Hedera network
let tx_response = transaction.execute(&client).await?;
// Request the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the schedule ID
let schedule_id = receipt.schedule_id.unwrap();
println!("The schedule ID of the schedule transaction is {:?}", schedule_id);
// v0.34.0
```
# Delete a schedule transaction
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/schedule-transaction/delete-a-schedule-transaction
A `ScheduleDeleteTransaction` is a consensus node transaction that removes a scheduled transaction from the network. A scheduled transaction can only be deleted if an admin key was set during its creation. If no admin key was set, any attempt to delete it will result in a `SCHEDULE_IS_IMMUTABLE` response from the network. Once successfully deleted, the scheduled transaction will be marked as deleted, and the consensus timestamp of the deletion will be recorded.
**Transaction Signing Requirements**
* The signature of the admin key
**Transaction Properties**
| Field | Description |
| --------------- | ---------------------------------- |
| **Schedule ID** | The ID of the schedule transaction |
## Methods
| Method | Type | Requirement |
|---|
setScheduleId(\) | ScheduleId | Required |
```java Java theme={null}
//Create the transaction and sign with the admin key
ScheduleDeleteTransaction transaction = new ScheduleDeleteTransaction()
.setScheduleId(scheduleId)
.freezeWith(client)
.sign(adminKey);
//Sign with the operator key and submit to a Hedera network
TransactionResponse txResponse = transaction.execute(client);
//Get the transaction receipt
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
```
```javascript JavaScript theme={null}
//Create the transaction and sign with the admin key
const transaction = await new ScheduleDeleteTransaction()
.setScheduleId(scheduleId)
.freezeWith(client)
.sign(adminKey);
//Sign with the operator key and submit to a Hedera network
const txResponse = await transaction.execute(client);
//Get the transaction receipt
const receipt = await txResponse.getReceipt(client);
//Get the transaction status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus);
```
```go Go theme={null}
//Create the transaction and freeze the unsigned transaction
transaction, err := hedera.NewScheduleDeleteTransaction()
SetScheduleID(scheduleId).
FreezeWith(client)
if err != nil {
panic(err)
}
//Sign with the admin key, sign with the client operator private key and submit the transaction to a Hedera network
txResponse, err := transaction.Sign(adminKey).Execute(client)
if err != nil {
panic(err)
}
//Request the receipt of the transaction
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction consensus status
status:= *receipt.Status
fmt.Printf("The transaction consensus status is %v\n", status)
```
```rust Rust theme={null}
// Create the transaction and sign with the admin key
let transaction = ScheduleDeleteTransaction::new()
.schedule_id(schedule_id)
.freeze_with(&client)?
.sign(admin_key);
// Sign with the operator key and submit to a Hedera network
let tx_response = transaction.execute(&client).await?;
// Get the transaction receipt
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
# Get schedule info
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/schedule-transaction/get-schedule-info
`ScheduleInfoQuery` is a consensus node query that returns information about the current state of a schedule transaction on a Hedera network.
**Schedule Info Response**
| Field | Description |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| **Schedule ID** | The ID of the schedule transaction. |
| **Creator Account ID** | The Hedera account that created the schedule transaction in x.y.z format. |
| **Payer Account ID** | The Hedera account paying for the execution of the scheduled transaction in x.y.z format. |
| **Scheduled Transaction Body** | The transaction body of the transaction that is being scheduled by the schedule transaction. |
| **Signatories** | The public keys that have signed the transaction. |
| **Admin Key** | The key that can delete the schedule transaction, if set |
| **Expiration Time** | The date and time the schedule transaction will expire |
| **Executed Time** | The time the schedule transaction was executed. If the schedule transaction has not executed this field will be left null. |
| **Deletion Time** | The consensus time the schedule transaction was deleted. If the schedule transaction was not deleted, this field will be left null. |
| **Memo** | Publicly visible information about the Schedule entity, up to 100 bytes. No guarantee of uniqueness. |
#### **Recommend Using Mirror Node REST API**
For obtaining schedule information and historical data, consider using the Mirror Node REST API endpoint [**Get Schedule by ID**](https://docs.hedera.com/api-reference/schedules/get-schedule-by-id) which offers several advantages:
* **Cost-effective and scalable:** [Mirror node providers](/hedera/core-concepts/mirror-nodes/hedera-mirror-node#mainnet) offer paid plans with a large number of queries included. The Hedera-hosted mirror node offers free queries with specific throttles for testing. While some SDK queries are currently free, these are subject to change in the future.
* **Performance:** Mirror nodes don't burden consensus nodes, allowing them to focus on processing transactions and providing efficient access to historical data without impacting network performance.
* **Historical data:** Mirror nodes store complete transaction history, records, and events - ideal for analytics, auditing, and monitoring past activity.
**Query Signing Requirements**
* The transaction fee payer account key is required to sign
### Methods
| Method | Type | Requirement |
|---|
setScheduleId(\) | ScheduleId | Required |
\.scheduleId | ScheduleId | Optional |
\.scheduledTransactionId | TransactionId | Optional |
\.creatorAccountId | AccountId | Optional |
\.payerAccountId | AccountId | Optional |
\.adminKey | Key | Optional |
\.signatories | Key | Optional |
\.deletedAt | Instant | Optional |
\.expirationAt | Instant | Optional |
\.memo | String | Optional |
\.waitForExpiry | boolean | Optional |
```java Java theme={null}
//Create the query
ScheduleInfoQuery query = new ScheduleInfoQuery()
.setScheduleId(scheduleId);
//Sign with the client operator private key and submit the query request to a node in a Hedera network
ScheduleInfo info = query.execute(client);
```
```javascript JavaScript theme={null}
//Create the query
const query = new ScheduleInfoQuery()
.setScheduleId(scheduleId);
//Sign with the client operator private key and submit the query request to a node in a Hedera network
const info = await query.execute(client);
```
```go Go theme={null}
//Create the query
query := hedera.NewScheduleInfoQuery().
SetScheduleID(scheduleId)
//Sign with the client operator private key and submit to a Hedera network
scheduleInfo, err := query.Execute(client)
if err != nil {
panic(err)
}
```
```rust Rust theme={null}
// Create the query
let query = ScheduleInfoQuery::new()
.schedule_id(schedule_id);
// Sign with the client operator private key and submit the query request to a node in a Hedera network
let info = query.execute(&client).await?;
// Print the schedule info
println!("Schedule ID: {:?}", info.schedule_id);
println!("Creator Account ID: {:?}", info.creator_account_id);
println!("Payer Account ID: {:?}", info.payer_account_id);
println!("Admin Key: {:?}", info.admin_key);
println!("Signatories: {:?}", info.signatories);
println!("Expiration Time: {:?}", info.expiration_time);
println!("Executed Time: {:?}", info.executed_time);
println!("Deleted Time: {:?}", info.deleted_time);
println!("Memo: {:?}", info.memo);
println!("Wait For Expiry: {:?}", info.wait_for_expiry);
// v0.34.0
```
# Network Response Messages
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/schedule-transaction/network-response-messages
| Network Response | Description |
|---|
INVALID\_SCHEDULE\_ID | The Scheduled entity does not exist; or has now expired, been deleted, or been executed |
SCHEDULE\_IS\_IMMUTABLE | The Scheduled entity cannot be modified. Admin key was not set during the creation of the Scheduled entity. |
INVALID\_SCHEDULE\_PAYER\_ID | The provided Scheduled Payer does not exist |
INVALID\_SCHEDULE\_ACCOUNT\_ID | The Schedule Create Transaction TransactionID account does not exist |
NO\_NEW\_VALID\_SIGNATURES | The provided sig map did not contain any new valid signatures from required signers of the scheduled transaction |
UNRESOLVABLE\_REQUIRED\_SIGNERS | The required signers for a scheduled transaction cannot be resolved, for example because they do not exist or have been deleted |
UNPARSEABLE\_SCHEDULED\_TRANSACTION | The bytes allegedly representing a transaction to be scheduled could not be parsed |
UNSCHEDULABLE\_TRANSACTION | ScheduleCreate and ScheduleSign transactions cannot be scheduled |
SOME\_SIGNATURES\_WERE\_INVALID | At least one of the signatures in the provided sig map did not represent a valid signature for any required signer |
TRANSACTION\_ID\_FIELD\_NOT\_ALLOWED | The scheduled and nonce fields in the TransactionID may not be set in a top-level transaction |
IDENTICAL\_SCHEDULE\_ALREADY\_CREATED | A schedule already exists with the same identifying fields of an attempted ScheduleCreate (that is, all fields other than scheduledPayerAccountID) |
SCHEDULE\_ALREADY\_DELETED | A schedule being signed or deleted has already been deleted |
SCHEDULE\_PENDING\_EXPIRATION | A schedule being signed or deleted has passed it's expiration date and is pending execution if needed and then expiration |
SCHEDULE\_FUTURE\_GAS\_LIMIT\_EXCEEDED | The scheduled transaction could not be created because it would cause the gas limit to be violated on the specified expiration time |
SCHEDULE\_FUTURE\_THROTTLE\_EXCEEDED | The scheduled transaction could not be created because it would cause throttles to be violated on the specified expiration time |
SCHEDULE\_EXPIRATION\_TIME\_MUST\_BE\_HIGHER\_THAN\_CONSENSUS\_TIME | The scheduled transaction could not be created because it's expiration\_time was less than or equal to the consensus time |
SCHEDULE\_EXPIRATION\_TIME\_TOO\_FAR\_IN\_FUTURE | The scheduled transaction could not be created because it's expiration time was too far in the future |
SCHEDULE\_EXPIRY\_MUST\_BE\_FUTURE | A scheduled transaction configured to wait for expiry to execute was given an expiry time not strictly after the time at which its creation reached consensus |
SCHEDULE\_EXPIRY\_TOO\_LONG | A scheduled transaction configured to wait for expiry to execute was given an expiry time too far into the future after the time which its creation reached consensus |
SCHEDULE\_EXPIRY\_IS\_BUSY | A scheduled transaction configured to wait for expiry to execute was given at a time which there is already too many transactions scheduled to expire; its creation must be retried with a different expiry time |
# Schedule ID
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/schedule-transaction/schedule-id
The entity ID of a schedule transaction.
A `ScheduleId` is composed of a \.\.\ (eg. 0.0.10).
* **shardNum** represents the shard number (`shardId`). It will default to 0 today, as Hedera only performs in one shard.
* **realmNum** represents the realm number (`realmId`). It will default to 0 today, as realms are not yet supported.
* **scheduleNum** represents the schedule number (`scheduleId`)
Together these values make up your `ScheduleId`. When a `ScheduleId` is requested in a field, be sure enter all three values.
| Constructor | Type | Description |
|---|
new ScheduleId(\,\,\) | long, long, long | Constructs a ScheduleId with 0 for shardNum and realmNum (e.g., 0.0.\) |
### Example
```java theme={null}
ScheduleId scheduleID = new ScheduleId(0,0,10);
System.out.println(scheduleID)
```
```javascript theme={null}
const scheduleID = new ScheduleId(0,0,10);
console.log(scheduleID)
```
```rust theme={null}
// Create a schedule ID
let schedule_id = ScheduleId::new(0, 0, 10);
println!("{:?}", schedule_id);
// v0.34.0
```
# Sign a scheduled transaction
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/schedule-transaction/sign-a-schedule-transaction
A `ScheduleSignTransaction` is a consensus node transaction that adds signatures to a scheduled transaction. When this transaction is successful:
* The signature is added to the scheduled transaction
* A record of the transaction is created
To view the signatures that have been added to a scheduled transaction, you can use a [`ScheduleInfoQuery`](/hedera/sdks-and-apis/sdks/schedule-transaction/get-schedule-info) to query the network. Once the scheduled transaction has received all the required signatures, it will execute immediately, unless it has been configured to execute at a specified expiration time.
**Transaction Signing Requirements**
* The signature of the account paying for the transaction fees
* The signature being applied to the scheduled transaction
**Transaction Properties**
| Field | Description |
| --------------- | -------------------------------------------------------------- |
| **Schedule ID** | The ID of the schedule transaction to submit the signature for |
## Methods
| Method | Type | Requirement |
|---|
setScheduleId(\) | ScheduleId | Required |
```java Java Java theme={null}
//Create the transaction
ScheduleSignTransaction transaction = new ScheduleSignTransaction()
.setScheduleId(scheduleId)
.freezeWith(client)
.sign(privateKeySigner1);
//Sign with the client operator key to pay for the transaction and submit to a Hedera network
TransactionResponse txResponse = transaction.execute(client);
//Get the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
```
```javascript JavaScript theme={null}
//Create the transaction
const transaction = await new ScheduleSignTransaction()
.setScheduleId(scheduleId)
.freezeWith(client)
.sign(privateKeySigner1);
//Sign with the client operator key to pay for the transaction and submit to a Hedera network
const txResponse = await transaction.execute(client);
//Get the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus);
```
```go Go theme={null}
//Create the transaction and freeze the unsigned transaction
transaction, err := hedera.NewScheduleSignTransaction().
SetScheduleID(scheduleId).
FreezeWith(client)
if err != nil {
panic(err)
}
//Sign with one of the required signatures, sign with the client operator private key and submit the transaction to a Hedera network
txResponse, err := transaction.Sign(privateKeySigner1).Execute(client)
if err != nil {
panic(err)
}
//Request the receipt of the transaction
receipt, err := txResponse.GetReceipt(client)
if err != nil {
panic(err)
}
//Get the transaction consensus status
status:= *receipt.Status
fmt.Printf("The transaction consensus status is %v\n", status)
```
```rust Rust theme={null}
// Create the transaction
let transaction = ScheduleSignTransaction::new()
.schedule_id(schedule_id)
.freeze_with(&client)?
.sign(private_key_signer1);
// Sign with the client operator key to pay for the transaction and submit to a Hedera network
let tx_response = transaction.execute(&client).await?;
// Get the receipt of the transaction
let receipt = tx_response.get_receipt(&client).await?;
// Get the transaction status
let status = receipt.status;
println!("The transaction consensus status is {:?}", status);
// v0.34.0
```
# Set Up Your Local Network
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/set-up-your-local-network
**Hiero Local Node Deprecation (September 2026)**
Hiero Local Node is entering a 6-month deprecation period. Support ends September 2026. Migrate local testing and CI workflows to [Solo](https://solo.hiero.org/v0.60.0/docs) before then. [Learn more](https://hedera.com/blog/hiero-local-node-deprecation-6-month-transition-to-solo/).
While you are developing your application, you can use the Hedera-supported networks (previewnet and testnet) to test your application against. In addition to using those networks, you have the option to set up your own local consensus node and mirror node for testing purposes.
With your local network set up, you can:
* Create and submit transactions and queries to a consensus node
* Interact with the mirror node via REST APIs
### 1. Set Up your local network
Set-up your local network by following the instructions found in the [readme](https://github.com/hashgraph/hedera-local-node#docker) of the `hedera-local-node` project. This will create a Hedera network composed of one consensus node and one mirror node. The consensus node will process incoming transactions and queries. The mirror node stores the history of transactions. Both nodes are created at startup.
### 2. Configure your network
Once you have your local network up and running, you will need to configure your Hedera client to point to your local network in your project of choice. Your project should have your language specific Hedera SDK as a dependency and imported into your project. You may reference the environment setup instructions if you don't know how.
Your local network IP address and port will be `127.0.0.1:50211` and your local mirror node IP and port will be `127.0.0.1:5600`. The consensus node account ID is `0.0.3`. This is the node account ID that will receive your transaction and query requests. It is recommended to store these variables in an environment or config file. These values will be hard-coded in the example for demonstration purposes.
Configure your local network by using `Client.forNetwork()`. This allows you to set a custom consensus network by providing the IP address and port. `Client.setMirrorNetwork()` allows you to set a custom mirror node network by providing the IP address and port.
```java Java theme={null}
//Create your local client
Client client = Client.forNetwork(Collections.singletonMap("127.0.0.1:50211", AccountId.fromString("0.0.3"))).setMirrorNetwork(List.of("127.0.0.1:5600"));
```
```javascript JavaScript theme={null}
//Create your local client
const node = {"127.0.0.1:50211": new AccountId(3)};
const client = Client.forNetwork(node).setMirrorNetwork("127.0.0.1:5600");
```
```go Go theme={null}
//Create your local client
node := make(map[string]hedera.AccountID, 1)
node["127.0.0.1:50211"] = hedera.AccountID{Account: 3}
mirrorNode := []string{"127.0.0.1:5600"}
client := hedera.ClientForNetwork(node)
client.SetMirrorNetwork(mirrorNode)
```
### 3. Set your local node transaction fee paying account
You will need an account ID and key to pay for the [fees](/hedera/networks/mainnet/fees) associated with each transaction and query that is submitted to your local network. You will use the account ID and key provided by the local node on startup to set up your operator account ID and key. The operator is the default account that pays for transaction and query fees.
| **Account ID** | `0.0.2` |
| --------------- | -------------------------------------------------------------------------------------------------- |
| **Private Key** | `302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137` |
**Note**: It is not good practice to post your private keys in any public place. These keys are provided only for development and testing purposes only. They do not exist on any production networks.
```java Java wrap theme={null}
client.setOperator(AccountId.fromString("0.0.2"), PrivateKey.fromString("302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"));
```
```javascript JavaScript wrap theme={null}
client.setOperator(AccountId.fromString("0.0.2"),PrivateKey.fromString("302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"));
```
```go Go wrap theme={null}
accountId, err := hedera.AccountIDFromString("0.0.2")
privateKey, err := hedera.PrivateKeyFromString(
"302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137")
client.SetOperator(accountId, privateKey)
```
### 4. Submit your transaction
Submit a transaction that will create a new account in your local network. The console should print out the new account ID. In this example, we are using the same key as the transaction fee paying account as the key for the new account. You can also create a [new key](/hedera/sdks-and-apis/sdks/keys/generate-a-new-key-pair) if you wish.
```java Java theme={null}
//Submit a transaction to your local node
TransactionResponse newAccount = new AccountCreateTransaction()
.setKeyWithoutAlias(PrivateKey.fromString("302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"))
.setInitialBalance(new Hbar(1))
.execute(client);
//Get the receipt
TransactionReceipt receipt = newAccount.getReceipt(client);
//Get the account ID
AccountId newAccountId = receipt.accountId;
System.out.println(newAccountId);
```
```javascript JavaScript theme={null}
//Submit a transaction to your local node
const newAccount = await new AccountCreateTransaction()
.setKeyWithoutAlias(PrivateKey.fromString("302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"))
.setInitialBalance(new Hbar(1))
.execute(client);
//Get receipt
const receipt = await newAccount.getReceipt(client);
//Get the account ID
const newAccountId = receipt.accountId;
console.log(newAccountId);
```
```go Go theme={null}
//Submit a transaction to your local node
newAccount, err := hedera.NewAccountCreateTransaction().
SetKeyWithoutAlias(privateKey).
SetInitialBalance(hedera.NewHbar(1)).
Execute(client)
if err != nil {
println(err.Error(), ": error getting balance")
return
}
//Get receipt
receipt, err := newAccount.GetReceipt(client)
//Get the account ID
newAccountId := receipt.AccountID
fmt.Print(newAccountId)
```
### 5. View your transaction
You can view the executed transaction by querying your local mirror node.
The local mirror node endpoint URL is `http://localhost:5551/`.
You can view the transactions that were submitted to your local node by submitting this request:
```http theme={null}
http://localhost:5551/api/v1/transactions
```
The list of supported mirror node REST APIs can be found [here](/hedera/sdks-and-apis/rest-api). You have now set-up your local environment. Check out the following links for more examples.
### Code Check ✅
```java Java wrap theme={null}
import com.hedera.hashgraph.sdk.*;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeoutException;
public class LocalNode {
public static void main(String[] args) throws TimeoutException, PrecheckStatusException, ReceiptStatusException, InterruptedException, IOException {
//Create your local client
Client client = Client.forNetwork(Collections.singletonMap("127.0.0.1:50211", AccountId.fromString("0.0.3"))).setMirrorNetwork(List.of("127.0.0.1:5600"));
//Set the transaction fee paying account
client.setOperator(AccountId.fromString("0.0.2"), PrivateKey.fromString("302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"));
//Submit a transaction to your local node
TransactionResponse newAccount = new AccountCreateTransaction()
.setKeyWithoutAlias(PrivateKey.fromString("302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"))
.setInitialBalance(new Hbar(1))
.execute(client);
//Get the receipt
TransactionReceipt receipt = newAccount.getReceipt(client);
//Get the account ID
AccountId newAccountId = receipt.accountId;
System.out.println(newAccountId);
}
}
```
```javascript JavaScript theme={null}
const {
Client,
PrivateKey,
Hbar,
AccountId,
AccountCreateTransaction,
} = require("@hashgraph/sdk");
async function main() {
//Create your local client
const node = {"127.0.0.1:50211": new AccountId(3)}
const client = Client.forNetwork(node).setMirrorNetwork("127.0.0.1:5600");
//Set the transaction fee paying account
client.setOperator(AccountId.fromString("0.0.2"),PrivateKey.fromString("302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"));
//Submit a transaction to your local node
const newAccount = await new AccountCreateTransaction()
.setKeyWithoutAlias(PrivateKey.fromString("302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"))
.setInitialBalance(new Hbar(1))
.execute(client);
//Get receipt
const receipt = await newAccount.getReceipt(client);
//Get the account ID
const newAccountId = receipt.accountId;
console.log(newAccountId);
}
void main();
```
```go Go theme={null}
package main
import (
"fmt"
hedera "github.com/hiero-ledger/hiero-sdk-go/v2/sdk"
)
func main() {
//Create your local node client
node := make(map[string]hedera.AccountID, 1)
node["127.0.0.1:50211"] = hedera.AccountID{Account: 3}
mirrorNode := []string{"127.0.0.1:5600"}
client := hedera.ClientForNetwork(node)
client.SetMirrorNetwork(mirrorNode)
//Set the transaction fee paying account
accountId, err := hedera.AccountIDFromString("0.0.2")
privateKey, err := hedera.PrivateKeyFromString("302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137")
client.SetOperator(accountId, privateKey)
//Submit a transaction to your local node
newAccount, err := hedera.NewAccountCreateTransaction().
SetKeyWithoutAlias(privateKey).
SetInitialBalance(hedera.NewHbar(1)).
Execute(client)
if err != nil {
println(err.Error(), ": error getting balance")
return
}
//Get receipt
receipt, err := newAccount.GetReceipt(client)
//Get the account ID
newAccountId := receipt.AccountID
fmt.Print(newAccountId)
}
```
# Signature Provider
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/signature-provider
# Local Provider
Source: https://docs.hedera.com/hedera/sdks-and-apis/sdks/signature-provider/local-provider
This feature is available in the [Hedera JavaScript SDK](https://github.com/hashgraph/hedera-sdk-js) only. (version >=2.14.0).
LocalProvider is a quality of life implementation that creates a provider using the `HEDERA_NETWORK` environment variable.
The `LocalProvider()` requires the following variable to be defined in the `.env` file. The `.env` file is located in the root directory of the project.
* `HEDERA_NETWORK`
* The network the wallet submits transactions to
```.env theme={null}
//Example .env file
HEDERA_NETWORK= previewnet/testnet/mainnet (select one network)
```
## class LocalProvider implements Wallet
### Constructor
#### new LocalProvider`()`
Instantiates the LocalProvider object. The local provider is built using `HEDERA_NETWORK` network specified in the `.env` file.
### Methods
#### **`.getAccountBalance()`** **-> Promise \**
Returns the account balance of the account in the local wallet.
#### **`.getAccountInfo()`** **-> Promise \**
Returns the account information of the account in the local wallet.
#### **`.getAccountRecords()`** **-> Promise \**
Returns the last transaction records for this account using `TransactionRecordQuery`.
#### **`.getLedgerId()>`** **LedgerId**
Returns the ledger ID (`previewnet`, `testnet`, or `mainnet`).
#### **`.getMirrorNetwork()>`** **string**
The mirror network the wallet is connected to.
#### **`.getNetwork()>`** **\[key: string]: string | AccountId**
Returns the network map information.
#### **`.getTransactionReceipt()>`** Promise\
Returns the transaction receipt.
#### **`.waitForReceipt()>`** Promise\
Wait for the receipt for a transaction response.
**`.call((request: Executable)>`** **`Promise