> For the complete documentation index, see [llms.txt](https://docs.hiveauth.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hiveauth.com/developer-documentation/has-for-applications/transactions/transaction-request.md).

# Transaction request

The **APP** can request the **PKSA** to sign and/or broadcast a transaction.

Before sending its request, the **APP** must create a "sign request data" object (`sign_req_data`) it will send to the **PKSA**

### sign\_req\_data

```javascript
{
    key_type: string
    ops: Array
    broadcast: boolean
    nonce: number
}
```

{% tabs %}
{% tab title="Properties" %}

* **`key_type`**: the key type required to sign the transactions. It can be one of `posting`|`active`
* **`ops`**: an array of operations objects (see [Hive API doc](https://developers.hive.io/apidefinitions/#condenser_api.broadcast_transaction) for more info)
* **`broadcast`**: `true` if the **PKSA** must broadcast the transaction to the blockchain. `false` if the **PKSA** must return a signed transaction but not broadcast it to the blockchain.
* **`nonce`**: current UNIX time in ms (`Date.now()` in Javascript). If a transaction request ever fails, do **NOT** reuse the `sign_req_data` object before **first updating the nonce**!
  {% endtab %}
  {% endtabs %}

The **APP** must then encrypt the `sign_req_data` object using the encryption key previously shared with the **PKSA** (`auth_key`). By encrypting the `sign_req_data` object, the **HAS** will be unaware of what's going on between the app and the PKSA and unable to tamper with the sign request process.

Finally, the **APP** sends its request to the **HAS** using the following message:

### sign\_req

```
{ 
    cmd: "sign_req"
    account: string
    data: string
    token: string // DEPRECATED - protocol < 1 only    
}
```

{% tabs %}
{% tab title="Properties" %}

* **`account`**: the Hive account name that must sign the transactions
* **`data`**: the Base64 representation of an encrypted `sign_req_data` object<br>
* **`token`**: the authentication token - ***Deprecated since protocol V1***
  {% endtab %}
  {% endtabs %}

The **HAS** will reply with a `sign_wait` message:

### sign\_wait

```javascript
{
    cmd: "sign_wait",
    uuid: string,
    expire: number
}
```

{% tabs %}
{% tab title="Properties" %}

* **`uuid`**: a unique identifier given by the **HAS** to the request
* **`expire`**: UNIX time when the request will expire
  {% endtab %}
  {% endtabs %}

{% hint style="info" %}

### Signing transactions using delegated authority

Authority delegation on the Hive blockchain allows users to grant specific permissions to others, enabling them to sign transactions or perform actions on their behalf while retaining control over their account.

This can be easily achieved with HiveAuth.

Let's assume that the @alice account has delegated authority to @bob's account and that @bob wants to broadcast transactions to the blockchain on behalf of @alice.

1. create one or multiple operations using `"alice"` as the operation initiator, then add them to the `sign_req_data`
2. create a `sign_req` object and use `"bob"` as the signing account.
   {% endhint %}


---

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

```
GET https://docs.hiveauth.com/developer-documentation/has-for-applications/transactions/transaction-request.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.
