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

# Quickstart

> Add a tip, sign and send your first transaction through Tracefall Sender.

If you send through an RPC URL today, you change that URL and add one instruction. Nothing else.

**1. Fetch the tip accounts**

Call `getTipAccounts` on `https://sender.tracefall.xyz`. It answers the eight tip accounts. Fetch them when you
start, rather than copying them into your code.

**2. Add the tip**

Add a System Program transfer of at least **100,000 lamports** (0.0001 SOL) to one of them, picked at random, as a
top-level instruction of your transaction. See [Tip accounts](https://docs.tracefall.xyz/tip-accounts.md) for the rules.

**3. Sign**

Sign the transaction as you do today, with a recent blockhash from your own RPC node.

**4. Send**

Send it with `sendTransaction` to `https://sender.tracefall.xyz`, in base64, with `skipPreflight: true`. The answer
is the transaction's signature.

**5. Confirm**

Confirm it on your own RPC node, as you do today. Until it is confirmed, send the same bytes again, at most once a
second ([Sending again](https://docs.tracefall.xyz/sending-again.md)).

```ts web3.js theme={null}
// npm install @solana/web3.js@1   (an ES module: it uses top-level await)
import { readFileSync } from 'node:fs';
import { Connection, Keypair, PublicKey, SystemProgram, Transaction } from '@solana/web3.js';

const SENDER_URL = 'https://sender.tracefall.xyz';

const payer = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(readFileSync(process.env.KEYPAIR!, 'utf8'))));
const rpc = new Connection(process.env.RPC_URL!, 'confirmed'); // your RPC node: reads and confirmations
const sender = new Connection(SENDER_URL); // Tracefall Sender: sends only

// 1. Fetch the tip accounts.
const res = await fetch(SENDER_URL, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'getTipAccounts', params: [] }),
});
const { result: tipAccounts } = (await res.json()) as { result: string[] };

// 2. Tip one of them, picked at random, in a top-level transfer of at least 100,000 lamports.
const tipAccount = new PublicKey(tipAccounts[Math.floor(Math.random() * tipAccounts.length)]);
const tx = new Transaction().add(
  // ...your instructions,
  SystemProgram.transfer({ fromPubkey: payer.publicKey, toPubkey: tipAccount, lamports: 100_000 }),
);

// 3. Sign.
const latest = await rpc.getLatestBlockhash();
tx.recentBlockhash = latest.blockhash;
tx.feePayer = payer.publicKey;
tx.sign(payer);

// 4. Send. sendRawTransaction sends base64.
const signature = await sender.sendRawTransaction(tx.serialize(), { skipPreflight: true });

// 5. Confirm on your own RPC node.
const { value } = await rpc.confirmTransaction({ signature, ...latest }, 'confirmed');
console.log(value.err ? 'landed but failed:' : 'landed:', signature);
```

```ts Kit theme={null}
// npm install @solana/kit @solana-program/system   (an ES module: it uses top-level await)
import { readFileSync } from 'node:fs';
import {
  address, appendTransactionMessageInstructions, createKeyPairSignerFromBytes, createSolanaRpc, createTransactionMessage,
  getBase64EncodedWireTransaction, getSignatureFromTransaction, pipe, setTransactionMessageFeePayerSigner,
  setTransactionMessageLifetimeUsingBlockhash, signTransactionMessageWithSigners,
} from '@solana/kit';
import { getTransferSolInstruction } from '@solana-program/system';

const SENDER_URL = 'https://sender.tracefall.xyz';

const payer = await createKeyPairSignerFromBytes(Uint8Array.from(JSON.parse(readFileSync(process.env.KEYPAIR!, 'utf8'))));
const rpc = createSolanaRpc(process.env.RPC_URL!); // your RPC node: reads and confirmations
const sender = createSolanaRpc(SENDER_URL); // Tracefall Sender: sends only

// 1. Fetch the tip accounts.
const res = await fetch(SENDER_URL, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'getTipAccounts', params: [] }),
});
const { result: tipAccounts } = (await res.json()) as { result: string[] };

// 2. Tip one of them, picked at random, in a top-level transfer of at least 100,000 lamports.
const tip = getTransferSolInstruction({
  source: payer,
  destination: address(tipAccounts[Math.floor(Math.random() * tipAccounts.length)]),
  amount: 100_000n,
});

// 3. Sign.
const { value: latest } = await rpc.getLatestBlockhash({ commitment: 'confirmed' }).send();
const message = pipe(
  createTransactionMessage({ version: 0 }),
  (m) => setTransactionMessageFeePayerSigner(payer, m),
  (m) => setTransactionMessageLifetimeUsingBlockhash(latest, m),
  (m) => appendTransactionMessageInstructions([/* your instructions, */ tip], m),
);
const tx = await signTransactionMessageWithSigners(message);
const signature = getSignatureFromTransaction(tx);

// 4. Send, in base64.
await sender.sendTransaction(getBase64EncodedWireTransaction(tx), { encoding: 'base64', skipPreflight: true }).send();

// 5. Confirm on your own RPC node.
for (let i = 0; i < 60; i++) {
  const { value } = await rpc.getSignatureStatuses([signature]).send();
  const status = value[0];
  if (status?.confirmationStatus === 'confirmed' || status?.confirmationStatus === 'finalized') {
    console.log(status.err ? 'landed but failed:' : 'landed:', signature);
    break;
  }
  await new Promise((r) => setTimeout(r, 1_000));
}
```

```rust Rust theme={null}
// Cargo.toml: solana-client = "2", solana-sdk = "2", rand = "0.8", serde_json = "1",
//             solana-system-interface = { version = "1", features = ["bincode"] }
use rand::seq::SliceRandom;
use solana_client::{rpc_client::RpcClient, rpc_config::RpcSendTransactionConfig, rpc_request::RpcRequest};
use solana_sdk::{
    commitment_config::CommitmentConfig,
    pubkey::Pubkey,
    signature::{read_keypair_file, Signer},
    transaction::Transaction,
};
use solana_system_interface::instruction::transfer;
use std::str::FromStr;

const SENDER_URL: &str = "https://sender.tracefall.xyz";

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let payer = read_keypair_file(std::env::var("KEYPAIR")?)?;
    let rpc = RpcClient::new_with_commitment(std::env::var("RPC_URL")?, CommitmentConfig::confirmed()); // your RPC node
    let sender = RpcClient::new(SENDER_URL); // Tracefall Sender: sends only

    // 1. Fetch the tip accounts.
    let tip_accounts: Vec<String> =
        sender.send(RpcRequest::Custom { method: "getTipAccounts" }, serde_json::json!([]))?;

    // 2. Tip one of them, picked at random, in a top-level transfer of at least 100,000 lamports.
    let tip_account = Pubkey::from_str(tip_accounts.choose(&mut rand::thread_rng()).ok_or("no tip accounts")?)?;
    let tip = transfer(&payer.pubkey(), &tip_account, 100_000);

    // 3. Sign.
    let blockhash = rpc.get_latest_blockhash()?;
    let instructions = [/* your instructions, */ tip];
    let tx = Transaction::new_signed_with_payer(&instructions, Some(&payer.pubkey()), &[&payer], blockhash);

    // 4. Send. send_transaction_with_config sends base64.
    let config = RpcSendTransactionConfig { skip_preflight: true, ..Default::default() };
    let signature = sender.send_transaction_with_config(&tx, config)?;

    // 5. Confirm on your own RPC node.
    rpc.poll_for_signature_with_commitment(&signature, CommitmentConfig::confirmed())?;
    println!("landed: {signature}");
    Ok(())
}
```

```python Python theme={null}
# pip install solders
import base64
import json
import os
import random
import time
import urllib.request

from solders.hash import Hash
from solders.keypair import Keypair
from solders.pubkey import Pubkey
from solders.system_program import TransferParams, transfer
from solders.transaction import Transaction

SENDER_URL = "https://sender.tracefall.xyz"
RPC_URL = os.environ["RPC_URL"]  # your RPC node: reads and confirmations


def rpc(url, method, params):
    body = json.dumps({"jsonrpc": "2.0", "id": 1, "method": method, "params": params}).encode()
    req = urllib.request.Request(url, data=body, headers={"Content-Type": "application/json"})
    with urllib.request.urlopen(req) as res:
        answer = json.load(res)
    if "error" in answer:
        raise RuntimeError(answer["error"])
    return answer["result"]


with open(os.environ["KEYPAIR"]) as f:
    payer = Keypair.from_json(f.read())

# 1. Fetch the tip accounts.
tip_accounts = rpc(SENDER_URL, "getTipAccounts", [])

# 2. Tip one of them, picked at random, in a top-level transfer of at least 100,000 lamports.
tip_account = Pubkey.from_string(random.choice(tip_accounts))
tip = transfer(TransferParams(from_pubkey=payer.pubkey(), to_pubkey=tip_account, lamports=100_000))

# 3. Sign.
latest = rpc(RPC_URL, "getLatestBlockhash", [{"commitment": "confirmed"}])
blockhash = Hash.from_string(latest["value"]["blockhash"])
tx = Transaction.new_signed_with_payer([tip], payer.pubkey(), [payer], blockhash)  # your instructions before the tip

# 4. Send, in base64.
wire = base64.b64encode(bytes(tx)).decode()
signature = rpc(SENDER_URL, "sendTransaction", [wire, {"encoding": "base64", "skipPreflight": True}])

# 5. Confirm on your own RPC node.
for _ in range(60):
    status = rpc(RPC_URL, "getSignatureStatuses", [[signature]])["value"][0]
    if status and status["confirmationStatus"] in ("confirmed", "finalized"):
        print("landed:" if status["err"] is None else "landed but failed:", signature)
        break
    time.sleep(1)
```

```bash curl theme={null}
# 1. Fetch the tip accounts.
curl -s https://sender.tracefall.xyz \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"getTipAccounts","params":[]}'

# 2 and 3. Build a transaction that transfers at least 100,000 lamports to one of them,
# sign it, and encode it in base64.

# 4. Send it.
curl -s https://sender.tracefall.xyz \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"sendTransaction","params":["<base64 transaction>",{"encoding":"base64","skipPreflight":true}]}'
```

> [!NOTE]
>
> No key is needed: a send with no key is admitted at up to 5 a second from one address. To send more, see
> [Authentication](https://docs.tracefall.xyz/authentication.md).

`KEYPAIR` is the path of a keypair file (a JSON array of 64 numbers, as `solana-keygen` writes it) and `RPC_URL` is your
own RPC node. We answer sends and `getTipAccounts`, not reads: keep `getLatestBlockhash` and confirmations on your RPC
node.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.