> For the complete documentation index, see [llms.txt](https://dev-docs.dcentwallet.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev-docs.dcentwallet.com/dcent-biometric-wallet-for-pc/dcent-web-connector/hedera-hbar-and-hts.md).

# Hedera (HBAR & HTS)

## Get Public Key

In order to get public key for Hedera Account, you can use `getAddress()` function.

If you use `DcentWebConnector.coinType.HEDERA` as a coinType parameter for `getAddress()` function, you can get public key for the private key of the BIP44 path.

For more detail about `getAddress()`, please see the below section.

* go to [Get Address API](/dcent-biometric-wallet-for-pc/dcent-web-connector/address-and-xpub.md#get-address) description

## Sign Transaction

### **Supported Transaction Types**

<table><thead><tr><th width="259.3893925964739">Transaction</th><th width="150" align="center">Supported</th><th width="150">Group</th></tr></thead><tbody><tr><td>AccountCreateTransaction</td><td align="center">O</td><td>Accounts</td></tr><tr><td>AccountUpdateTransaction</td><td align="center">O</td><td>Accounts</td></tr><tr><td>TransferTransaction</td><td align="center">O</td><td>Accounts</td></tr><tr><td>AccountDeleteTransaction</td><td align="center">X</td><td>Accounts</td></tr><tr><td>AccountAllowanceApprovalTransaction</td><td align="center">X</td><td>Accounts</td></tr><tr><td>AccountAllowanceAdjustTransaction</td><td align="center">X</td><td>Accounts</td></tr><tr><td>TokenCreateTransaction</td><td align="center">O</td><td>Token</td></tr><tr><td>TokenUpdateTransaction</td><td align="center">O</td><td>Token</td></tr><tr><td>TokenDeleteTransaction</td><td align="center">X</td><td>Token</td></tr><tr><td>TokenAssociateTransaction</td><td align="center">O</td><td>Token</td></tr><tr><td>TokenDissociateTransaction</td><td align="center">O</td><td>Token</td></tr><tr><td>TokenMintTransaction</td><td align="center">O</td><td>Token</td></tr><tr><td>TokenBurnTransaction</td><td align="center">O</td><td>Token</td></tr><tr><td>TokenFreezeTransaction</td><td align="center">O</td><td>Token</td></tr><tr><td>TokenFeeScheduleUpdateTransaction</td><td align="center">X</td><td>Token</td></tr><tr><td>TokenUnfreezeTransaction</td><td align="center">O</td><td>Token</td></tr><tr><td>TokenGrantKycTransaction</td><td align="center">X</td><td>Token</td></tr><tr><td>TokenRevokeKycTransaction</td><td align="center">X</td><td>Token</td></tr><tr><td>TokenPauseTransaction</td><td align="center">O</td><td>Token</td></tr><tr><td>TokenUnpauseTransaction</td><td align="center">O</td><td>Token</td></tr><tr><td>TokenWipeTransaction</td><td align="center">O</td><td>Token</td></tr></tbody></table>

For your reference, all transaction types for Hedera can be found here.

* <https://docs.hedera.com/guides/docs/sdks/transactions>

### **getHederaSignedTransaction()**

#### Supported Coin Type

* Hedera(HTS)

#### Parameters :

* unsignedTx: unsigned hexadecimal tx [Hedera Docs](https://docs.hedera.com/guides/getting-started/transfer-hbar)
* path: key path, wallet sign with that private key with a given key path (BIP32 ex) "m/44'/144'/0'").
* symbol: symbol, It is a symbol that the wallet displays on the screen.
* decimals: hedera or hts token's decimals.

#### Requirements:

* `D'CENT Bridge` version 1.2.1 or higher is required.
* D'CENT Biometric Wallet version 2.19.3. or higher is required.
* This feature is tested with [Hedera JavaScript SDK](https://github.com/hashgraph/hedera-sdk-js) v2.8.0

#### Usage:

```javascript
const _buf2hex = (buffer) => { // buffer is an ArrayBuffer
return Array.prototype.map.call(new Uint8Array(buffer), x => ('00' + x.toString(16)).slice(-2)).join('');
}
const client = HederaSDK.Client.forMainnet()
const nodeList = client._network.getNodeAccountIdsForExecute()
const validStart = Timestamp.generate()
const fromAccountId = AccountId.fromString('accountIdString')
const txId = new TransactionId(fromAccountId, validStart)
const tx = new HederaSDK.TransferTransaction()

// when you transfer hbar
tx.addHbarTransfer(fromAccountId, HederaSDK.Hbar.fromTinybars('-' + amountTinybar))
tx.addHbarTransfer('toAccountIdString', HederaSDK.Hbar.fromTinybars(amountTinybar))

// or you can transfer token like this.
tx.addTokenTransfer(contractAddress, fromAccountId, HederaSDK.Hbar.fromTinybars('-' + amountTinybar))
tx.addTokenTransfer(contractAddress, 'toAccountIdString', HederaSDK.Hbar.fromTinybars(amountTinybar))


tx.setNodeAccountIds([nodeList[nodeList.length - 1]])
tx.setTransactionId(txId)
tx.setTransactionMemo('')
tx.setMaxTransactionFee(fee)
tx.freezeWith(client)

const bodyBytes = tx._signedTransactions[0].bodyBytes
const unsignedTx = _buf2hex(bodyBytes)

const transactionJson = {
    unsignedTx: unsignedTx,
    path: `m/44'/3030'/0'`,
    symobl: HBAR,
    decimals: 8,
}

var result
try {
    result = await DcentWebConnector.getHederaSignedTransaction(transactionJson);    
} catch (e) {
    console.log(e)
    result = e
}
```

#### Returned response object:

```json
{
    "header": {
        "version": "1.0",
        "response_from": "hedera",
        "status": "success"
    },
    "body": {
        "command": "transaction",
        "parameter": {
            "signed_tx": "0x31aa13b5e04cb6fc6381ea0520bf7f6727ebdb6e96cd7ca8625bb3e3dd36cf0e2cee4ece13aa9f7ddc09ee10c74aa00af954201829d8016317f10f5a921dcc0d",
            "pubkey": "0x9a5c753d02038e512c06867556324b37181c9c1fc19c21c27752c520e8f0d822"
        }
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dev-docs.dcentwallet.com/dcent-biometric-wallet-for-pc/dcent-web-connector/hedera-hbar-and-hts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
