> For the complete documentation index, see [llms.txt](https://support.backpack.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.backpack.exchange/support-docs/vn/vi-wallet/tai-lieu-ky-thuat/deeplinks/cac-phuong-thuc-provider/signtransaction.md).

# SignTransaction

[SignAndSendTransaction](broken://pages/vEasqQZZKPhNBYZJLl5f) là phương thức đơn giản nhất và được khuyến nghị nhất để gửi một giao dịch. Backpack sẽ gửi giao dịch ngay sau khi ký, do đó đảm bảo an toàn hơn cho người dùng và cung cấp một API đơn giản hơn cho nhà phát triển, thay vì để ứng dụng tự xử lý việc này.\
Tuy nhiên, ứng dụng cũng có thể chỉ yêu cầu Backpack cung cấp chữ ký. Sau khi được ký, ứng dụng có thể tự gửi giao dịch bằng [web3.js](https://solana-labs.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction) `sendRawTransaction`.

## URL cơ sở

```
https://backpack.app/ul/v1/signTransaction
```

## Tham số Chuỗi Truy vấn

* `dapp_encryption_public_key` **(bắt buộc)**: Khóa công khai mã hóa ban đầu được ứng dụng sử dụng cho phiên  [Connect](broken://pages/XwbwIltEf3ZAVdFk4Zan) hiện có.
* `nonce` **(bắt buộc)**: Một nonce được sử dụng để mã hóa yêu cầu, được mã hóa bằng base58.
* `redirect_link` **(bắt buộc)**: URI nơi Backpack sẽ chuyển hướng người dùng sau khi hoàn tất. Vui lòng tham khảo [Specifying Redirects](broken://pages/eEN4Je3hS9GkJD2llYkD) để biết thêm chi tiết. Được mã hóa URL.
* `payload` **(bắt buộc)**: Một chuỗi JSON đã được mã hóa với các trường sau:

  ```
  {
    "transaction": "...", // serialized transaction, base58 encoded
    "session": "...", // token received from connect-method
  }
  ```

  * `transaction` **(bắt buộc)**: [Giao dịch](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html) mà Backpack sẽ ký được tuần tự hóa và mã hóa bằng base58.
  * `session` **(bắt buộc)**: Mã phiên nhận được từ phương thức [Connect](broken://pages/XwbwIltEf3ZAVdFk4Zan) . Vui lòng tham khảo [Handling Sessions](broken://pages/XkwAjjvmdBNyhgvfc29p) để biết thêm chi tiết.

## Kết Quả Trả Về

### Chấp nhận

* `nonce`: Một nonce được sử dụng để mã hóa phản hồi, được mã hóa bằng base58.
* `data`: Một chuỗi JSON đã được mã hóa. Tham khảo [Encryption](broken://pages/NAJcuZG486Q2zBT5Xu0v) để tìm hiểu cách ứng dụng có thể giải mã `data` bằng shared secret. Các byte đã mã hóa được mã hóa bằng base58.

  ```
  // content of decrypted `data`-parameter
  {
      transaction: "...", // signed serialized transaction, base58 encoded
  }
  ```

  * `transaction`: Giao dịch đã ký và đã tuần tự hóa, được mã hóa bằng base58. Backpack sẽ không gửi giao dịch này. Ứng dụng có thể gửi giao dịch này thông qua [web3.js](https://solana-labs.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction) `sendRawTransaction`.

### Từ chối

Một `errorCode` và `errorMessage` dưới dạng các tham số truy vấn.

Vui lòng tham khảo [Errors](broken://pages/T3LxDBNiZXh6Q2nP7dhl#errors) ể biết danh sách đầy đủ các mã lỗi có thể xảy ra.

```
{
  "errorCode": "...",
  "errorMessage": "..."
}
```


---

# 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://support.backpack.exchange/support-docs/vn/vi-wallet/tai-lieu-ky-thuat/deeplinks/cac-phuong-thuc-provider/signtransaction.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.
