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

# 小费交易

> 如何为交易添加小费。

使用我们的 SWQoS，您可以使用默认的优先费用（无需特别设置），使用小费作为优先选项。在构建交易时，您需要向交易中添加一个小费转账指令，以加速交易打包进区块。

示例代码生成的 base64 编码交易数据可以直接通过 SDK 方法调用，例如传递给 `send_transaction`。

```javascript theme={null}
const ixs = {your instructions ixs};
const keypair = {your_actual_keypair};
const TIP_AMOUNT = 1_000_000; // 0.001 SOL;
const BLOCKRUSH_TIP = new PublicKey("AhMVT9KWLGjBbzvdqQkTt4vHwpawnGNoGSqaqXYftNDR");

// 添加小费支付指令
ixs.push(
    SystemProgram.transfer({
        fromPubkey: keypair.publicKey,
        toPubkey: BLOCKRUSH_TIP,
        lamports: TIP_AMOUNT,
    }),
);

// 编译并签名交易指令
const messageV0 = new TransactionMessage({
    payerKey: keypair.publicKey,
    recentBlockhash: latestBlockhash.blockhash,
    instructions: ixs,
}).compileToV0Message();
const transaction = new VersionedTransaction(messageV0);
transaction.sign([keypair]);

// 获取完全签名交易的 Base64 编码字符串
const transactionRaw = Buffer.from(transaction.serialize()).toString('base64');
```
