> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dfns.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Hedera

> Reference for Hedera transaction payloads used with the Dfns sign and sign-and-broadcast endpoints, including HBAR transfers and HCS messages.

## Transaction

Signs an unsigned Hedera or EVM transaction and broadcasts it to chain.

| Field         | Description                                                                                                                                                           | Type - Optional     |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
| `kind`        | `Transaction`                                                                                                                                                         | String              |
| `transaction` | The unsigned hex encoded transaction as shown below.                                                                                                                  | String              |
| `externalId`  | A unique ID from your system. It can be leveraged to be used as an idempotency key (read more [here](https://docs-legacy.dfns.co/d/advanced-topics/api-idempotency)). | String *(optional)* |

```json theme={null}
{
  "kind": "Transaction",
  "transaction": "0x0a6c2a6a0a660a1a0a0b08f6f89fc80610ecf1bf1912090800100018c7b1a303180012060800100018051880c2d72f22020878320072350a330a200a1a0800100022140c78f5e80fe0107ba1ab52048b4b2053ee948611100218000a0f0a090800100018c7b1a303100118001200"
}
```

### Typescript Example with Hiero JavaScript SDK

First install the Hiero JavaScript SDK. You can find the full documentation here: [https://github.com/hiero-ledger/hiero-sdk-js](https://github.com/hiero-ledger/hiero-sdk-js)

Here a code sample to broadcast a transaction via [the Dfns TypeScript SDK](https://github.com/dfns/dfns-sdk-ts):

```typescript theme={null}
import { Hbar, TransferTransaction } from '@hashgraph/sdk'

const walletId = 'wa-172um-hgi5f-xxxxxxxxxxxxxxxx'
const wallet = await dfnsClient.wallets.getWallet({ walletId })

const recipient = '0x956fbb0c88b3c597d4afdbab3e26939051ff6725'

const client = Client.forMainnet()

const transaction = await new TransferTransaction()
  .addHbarTransfer(recipient, Hbar.fromTinybars(1))
  .addHbarTransfer(wallet.address!, Hbar.fromTinybars(-1))
  .freezeWith(client)

const res = await dfnsClient.wallets.broadcastTransaction({
  walletId,
  body: {
    kind: 'Transaction',
    transaction: `0x${Buffer.from(transaction.toBytes()).toString('hex')}`,
  },
})
```

## Complete examples

For a complete working example, see the SDK example on GitHub:

* [Basic transaction](https://github.com/dfns/dfns-sdk-ts/tree/m/examples/libs/hedera/basic-tx) - Simple Hbar transfer
