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

# Sender와의 토지 거래

> Helius Sender를 사용하여 지역 엔드포인트, 연결 가열, 동적 우선 수수료, 팁, 재시도 확인과 함께 저지연 전송 루프를 구축합니다.

Sender는 동시에 모든 고속 경로(Helius, Jito, Harmonic, Rakurai)를 통해 거래를 제출하고 API 크레딧을 소모하지 않습니다. 전송 당 SOL 팁을 지불합니다. 이 가이드는 연결을 가열하고, 실시간 가격의 수수료 및 재시도 정책으로 확인하면서 생산 전송 루프를 구축합니다.

## 티어 선택하기

[Sender Max](/docs/ko/sending-transactions/sender-max) (최소 0.001 SOL 팁)은 모든 경로를 통해 라우팅되고, 더 큰 팁이 먼저 도달하는 우선 팁 버퍼에 들어갑니다.

[SWQOS-only](/docs/ko/sending-transactions/sender-swqos-only) (0.000005 SOL)은 비용 최적화를 위해 단일 고속 경로를 사용합니다. 엔드포인트 URL에 `?swqos_only=true`를 추가하십시오.

두 최소값 사이의 팁은 적은 경로를 통해 최선을 다하므로 한 티어를 선택하십시오.

## 엔드포인트 선택하기

백엔드는 서버에 가장 가까운 지역 HTTP 엔드포인트를 사용해야 합니다 (`http://ewr-sender.helius-rpc.com/fast`, `fra`, `slc`, `ams`, `lon`, `sg`, `tyo`).

브라우저는 CORS 문제를 피하고 자동 라우팅되는 글로벌 HTTPS 엔드포인트 `https://sender.helius-rpc.com/fast`를 사용해야 합니다.

## 연결 가열하기

콜드 TCP/TLS 핸드셰이크는 유휴 기간 후 첫 전송에 지연을 추가합니다.

시스템이 약 5초 이상 전송 사이에 있을 수 있다면 핑 엔드포인트로 연결을 가열하십시오:

```typescript theme={"system"}
const SENDER = 'http://ewr-sender.helius-rpc.com';

setInterval(async () => {
  try {
    await fetch(`${SENDER}/ping`);
  } catch (e) {
    console.warn('warm-up failed:', e);
  }
}, 5_000);
```

## 거래 구축하기

모든 Sender 거래는 지정된 팁 계정으로 팁을 전송하고 계산 유닛 가격을 포함해야 합니다. Missing한 거래는 Sender가 거부합니다.

우선 수수료를 하드코딩하면 조용한 시장에서 과다 지불하고 붐비는 시장에서 경쟁에서 뒤쳐지게 되므로 [Priority Fee API](/docs/ko/priority-fee-api)에서 가격을 확인하십시오:

```typescript send.ts theme={"system"}
import {
  Connection, TransactionMessage, VersionedTransaction,
  SystemProgram, PublicKey, Keypair, ComputeBudgetProgram, LAMPORTS_PER_SOL
} from '@solana/web3.js';

const RPC = 'https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY';
const TIP_ACCOUNTS = [
  '4ACfpUFoaSD9bfPdeu6DBt89gB6ENTeHBXCAi87NhDEE',
  'D2L6yPZ2FmmmTKPgzaMKdhu6EWZcTpLy1Vhx8uvZe7NZ',
  '9bnz4RShgq1hAnLnZbP8kbgBg1kEmcJBYQq3gQbmnSta'
];

async function buildTransaction(keypair: Keypair, tradeInstructions: any[]) {
  const connection = new Connection(RPC);
  const { blockhash } = await connection.getLatestBlockhash('confirmed');

  // Price the fee against the accounts the trade touches
  const feeRes = await fetch(RPC, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      jsonrpc: '2.0', id: '1', method: 'getPriorityFeeEstimate',
      params: [{
        accountKeys: tradeInstructions.flatMap(ix => ix.keys.map((k: any) => k.pubkey.toBase58())),
        options: { recommended: true }
      }]
    })
  });
  const { result } = await feeRes.json();

  const tx = new VersionedTransaction(
    new TransactionMessage({
      instructions: [
        ComputeBudgetProgram.setComputeUnitLimit({ units: 100_000 }),
        ComputeBudgetProgram.setComputeUnitPrice({ microLamports: result.priorityFeeEstimate }),
        ...tradeInstructions,
        SystemProgram.transfer({
          fromPubkey: keypair.publicKey,
          toPubkey: new PublicKey(TIP_ACCOUNTS[Math.floor(Math.random() * TIP_ACCOUNTS.length)]),
          lamports: 0.001 * LAMPORTS_PER_SOL // Sender Max minimum; tip more to land first
        })
      ],
      payerKey: keypair.publicKey,
      recentBlockhash: blockhash
    }).compileToV0Message()
  );
  tx.sign([keypair]);
  return tx;
}
```

팁은 거래 경로를 결정하고, 우선 수수료는 검증자 큐에서 위치를 높입니다. 함께 포함 확률을 극대화합니다.

## 전송 후 확인

클라이언트 측 검증을 대가로 지연을 교환하는 `skipPreflight: true`로 제출한 후 RPC 연결을 통해 확인합니다.

Sender는 서명을 즉시 반환하지만 이는 도착 증거가 아닙니다:

```typescript theme={"system"}
async function sendAndConfirm(tx: VersionedTransaction): Promise<string> {
  const signature = await send(tx);

  const connection = new Connection(RPC);
  for (let i = 0; i < 30; i++) {
    const { value } = await connection.getSignatureStatuses([signature]);
    const status = value[0];
    if (status?.err) throw new Error(`Transaction failed: ${JSON.stringify(status.err)}`);
    if (status?.confirmationStatus === 'confirmed' || status?.confirmationStatus === 'finalized') {
      return signature;
    }
    await new Promise(r => setTimeout(r, 1_000));
  }
  throw new Error('Not confirmed within 30s: rebuild with a fresh blockhash and resend');
}

async function send(tx: VersionedTransaction): Promise<string> {
  const res = await fetch(`${SENDER}/fast`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      jsonrpc: '2.0',
      id: Date.now().toString(),
      method: 'sendTransaction',
      params: [
        Buffer.from(tx.serialize()).toString('base64'),
        { encoding: 'base64', skipPreflight: true, maxRetries: 0 }
      ]
    })
  });
  const json = await res.json();
  if (json.error) throw new Error(json.error.message);
  return json.result;
}
```

`maxRetries: 0`로 재시도 정책을 소유합니다: 확인 시간이 초과되면 오래된 거래를 재전송하는 대신 새로운 블록해시와 다시 가격을 책정한 수수료로 재구성하십시오.

기본 처리량은 50 TPS입니다. 전문 플랜은 [높은 제한 요청](https://www.helius.dev/contact) 가능합니다.

## 선택사항: 샌드위치 공격자 우회하기

엔드포인트 URL에 `?mev-protect=true`를 추가하여 샌드위치 공격과 관련된 검증자를 피하십시오. 요청 본문은 변경되지 않고, 두 티어 모두에서 작동합니다:

```text theme={"system"}
http://ewr-sender.helius-rpc.com/fast?mev-protect=true
```

[MEV Protect](/docs/ko/sending-transactions/mev-protect)에서 트레이드오프를 참조하십시오. 아토믹 다중 거래 실행(최대 4건의 거래, 올 오어 낫씽)을 위해 동일한 엔드포인트에서 [`sendBundle`](/docs/ko/sending-transactions/sender-max#번들)를 사용하십시오.

## 관련 가이드

<CardGroup cols={2}>
  <Card title="Sender 개요" icon="paper-plane" href="/docs/ko/sending-transactions/sender">
    티어, 엔드포인트, 팁 계정, 및 전체 요금제 제한
  </Card>

  <Card title="사전 확인에서 거래" icon="stopwatch" href="/docs/ko/pre-confirmations/guides/trade-on-preconfirmations">
    가장 빠른 전송 경로와 가장 빠른 거래 신호를 결합
  </Card>
</CardGroup>
