# Hextrust - Wallet Custody Integration

## Available To

Free for the following exchange plans:

* **On-Premise Plans:**
  * Enterprise Unlimited

{% hint style="info" %}
This is a **wallet custody** plugin and is only available on **On-Premise** plans. It is not offered on Cloud plans because custody must be controlled by the exchange operator's own infrastructure and HexTrust API credentials.
{% endhint %}

## What Is It?

The **HexTrust Plugin** connects a HollaEx exchange to HexTrust wallet custody. It creates user deposit addresses through HexTrust vaults, processes signed HexTrust webhooks for deposits and withdrawals, and dispatches eligible pending crypto withdrawals to HexTrust for on-chain settlement.

The plugin exposes server-side routes only. Users request deposit addresses through the exchange, while withdrawal dispatch runs automatically in the background and can also be triggered by an admin.

## Who Needs It?

This plugin is suitable for exchange operators that:

* Use HexTrust as their custody provider.
* Want user deposit addresses derived from HexTrust vaults.
* Want pending exchange withdrawals submitted to HexTrust automatically.
* Need signed webhook confirmation before deposits are credited or withdrawals are completed.

## How to Use It?

Install the plugin from the **Plugins** section inside the Operator Control, then configure the plugin meta with your HexTrust credentials and webhook verification key.

#### 1. Get your HexTrust credentials

Create or retrieve the following values from your HexTrust environment:

* API base URL for sandbox or production.
* Enterprise ID.
* API key.
* ES256 private key used to sign API requests.
* Ed25519 webhook public key used to verify HexTrust webhook payloads.
* Source withdrawal address used as the `from` address when submitting withdrawals.

Store the private key and API key securely. Do not commit live credentials into this repository.

#### 2. Configure the plugin

Open the plugin in the Operator Control and set the following fields:

| Field                | Required | Default                                    | Description                                                                                                      |
| -------------------- | -------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| `api_url`            | **yes**  | `https://api.sandbox.hexsafe.hextrust.com` | HexTrust API base URL. Use the correct sandbox or production URL for your account.                               |
| `enterprise_id`      | **yes**  | empty                                      | HexTrust enterprise ID.                                                                                          |
| `api_key`            | **yes**  | empty                                      | HexTrust API key.                                                                                                |
| `private_key`        | **yes**  | empty                                      | ES256 private key used to sign HexTrust API requests. Escaped `\n` newlines are accepted.                        |
| `webhook_public_key` | **yes**  | empty                                      | Base64 Ed25519 public key used to verify HexTrust webhooks. Webhooks are rejected if this is missing or invalid. |
| `withdrawal_address` | **yes**  | empty                                      | Address sent as `from` when the plugin submits withdrawals to HexTrust.                                          |

The plugin will not initialize unless all required values are present.

#### 3. Configure HexTrust webhooks

Configure HexTrust to send transaction webhooks to:

```
POST https://<your exchange url>/plugins/hextrust/webhook
```

Webhook requests must include a valid signature and payload in the format expected by HexTrust. The plugin verifies the signature before processing any deposit or withdrawal update.

#### 4. Address creation

Authenticated users can request a deposit address with:

```
GET https://<your exchange url>/plugins/hextrust/create-address?crypto=<currency>&network=<network>
Authorization: Bearer <user token>
```

The plugin creates or reuses the user's HexTrust vault, derives an address for the requested asset/network, and registers the address in the exchange wallet records. If a user already has a wallet on the same network, the plugin reuses that address for compatible assets.

#### 5. Withdrawal dispatch

The plugin checks pending exchange withdrawals every minute. Eligible withdrawals are submitted to HexTrust when they are:

* Not completed.
* Not dismissed.
* Not rejected.
* Not waiting.
* Not on hold.
* Marked for processing by the plugin.
* For a supported blockchain asset.

To trigger dispatch manually as an admin:

```
POST https://<your exchange url>/plugins/hextrust/dispatch-withdrawals
Authorization: Bearer <admin token>
```

After a withdrawal is submitted, it remains waiting for a HexTrust webhook. A completed withdrawal webhook updates the exchange burn as successful and stores the on-chain transaction hash when available.

### Supported Assets

The plugin loads supported chains from HexTrust at startup and maps HexTrust chain names to exchange symbols. Built-in mappings include Bitcoin, Ethereum, Optimism, Avalanche, Kaia, Bitcoin Cash, Celestia, Cosmos, XRP, Algorand, Stacks, Tezos, Injective, and several other networks returned by HexTrust.

Assets without a mapped HexTrust chain are skipped by the withdrawal dispatcher and may not be able to derive addresses until the mapping is added.

***

## **Benefits for HollaEx Operators**

The HexTrust plugin lets an exchange keep custody operations inside HexTrust while preserving the normal HollaEx wallet flow for users. Deposit addresses are derived from custody vaults, deposit credits depend on signed custody webhooks, and outgoing withdrawals are queued and dispatched without manual API calls. This keeps custody integration centralized, auditable, and aligned with the exchange's existing pending transaction workflow.


---

# Agent Instructions: 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:

```
GET https://docs.hollaex.com/plugins/use-plugins/hextrust-wallet-custody-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
