> 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/signandsendtransaction.md).

# SignAndSendTransaction

Khi đã kết nối với Backpack, một ứng dụng có thể yêu cầu người dùng cấp quyền để gửi giao dịch thay mặt họ.

Để gửi một giao dịch, ứng dụng phải:

1\. Tạo một giao dịch chưa ký.

2\. Để giao dịch được ký và gửi lên mạng bởi ví Backpack của người dùng.

3\. (Tuỳ chọn) Chờ xác nhận từ mạng bằng cách sử dụng kết nối Solana JSON RPC.

{% hint style="info" %}
Để biết thêm thông tin về bản chất của các giao dịch Solana, vui lòng tham khảo tài liệu [`solana-web3.js` docs](https://solana-labs.github.io/solana-web3.js/), cũng như [Solana Cookbook](https://solanacookbook.com/core-concepts/transactions.html#transactions).
{% endhint %}

## URL cơ sở

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

## 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
  "sendOptions": "..." // an optional Solana web3.js sendOptions object
  "session": "...", // token received from the 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ý và gửi được tuần tự hóa và mã hóa bằng base58.
* `sendOptions` (tùy chọn): Một đối tượng tùy chọn chỉ định các tùy chọn về cách Backpack nên gửi giao dịch. Đối tượng này được [định nghĩa trong Solana web3.js.](https://solana-labs.github.io/solana-web3.js/modules.html#SendOptions)
* `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
{  
    "signature": "..." // transaction-signature
}
```

* `signature`: Chữ ký đầu tiên trong giao dịch có thể được sử dụng làm [ID giao dịch.](https://docs.solana.com/terminology#transaction-id)

### 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/signandsendtransaction.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.
