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

# Deploy Your First Solana Program

> Take a Solana program from source to a live devnet transaction, with funding, deployment, and calls all routed through your Helius RPC.

export const DevnetFaucet = () => {
  const [apiKey, setApiKey] = useState('');
  const [address, setAddress] = useState('');
  const [loading, setLoading] = useState(false);
  const [result, setResult] = useState(null);
  const [error, setError] = useState(null);
  const handleAirdrop = async e => {
    e.preventDefault();
    setLoading(true);
    setError(null);
    setResult(null);
    try {
      const res = await fetch(`https://devnet.helius-rpc.com/?api-key=${apiKey}`, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          jsonrpc: '2.0',
          id: 'faucet',
          method: 'requestAirdrop',
          params: [address, 1000000000]
        })
      });
      const json = await res.json();
      if (json.error) throw new Error(json.error.message || 'Airdrop failed');
      setResult(json.result);
    } catch (err) {
      setError(err.message || 'Airdrop failed. The devnet faucet is rate-limited, try again shortly.');
    } finally {
      setLoading(false);
    }
  };
  const btnClass = loading ? 'px-4 py-2 font-medium rounded-full bg-gray-300 dark:bg-gray-700 cursor-not-allowed' : 'px-4 py-2 font-medium rounded-full bg-primary hover:bg-primary/80 text-white';
  return <div className="p-4 border dark:border-zinc-950/80 rounded-xl bg-white dark:bg-zinc-950/80 shadow-sm">
      <form onSubmit={handleAirdrop} className="space-y-4">
        <div>
          <label className="block text-sm text-zinc-950/70 dark:text-white/70 mb-1">Your API Key</label>
          <input type="text" value={apiKey} onChange={e => setApiKey(e.target.value)} placeholder="Enter your API key" className="w-full p-2 border rounded dark:bg-zinc-900 dark:border-zinc-700" required />
        </div>
        <div>
          <label className="block text-sm text-zinc-950/70 dark:text-white/70 mb-1">Devnet Wallet Address</label>
          <input type="text" value={address} onChange={e => setAddress(e.target.value)} placeholder="Your devnet address" className="w-full p-2 border rounded dark:bg-zinc-900 dark:border-zinc-700" required />
        </div>
        <button type="submit" disabled={loading} className={btnClass}>
          {loading ? 'Requesting...' : 'Request 1 Devnet SOL'}
        </button>
      </form>
      <p className="mt-3 text-xs text-zinc-500 dark:text-zinc-400">
        Your API key is used only in your browser to call Helius directly. It is never sent anywhere else.
      </p>
      {error ? <div className="mt-4 p-3 bg-red-100 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded text-red-700 dark:text-red-300">
          <strong>Error:</strong> {error}
        </div> : null}
      {result ? <div className="mt-4 p-3 bg-green-100 dark:bg-green-900/30 border border-green-200 dark:border-green-800 rounded text-green-700 dark:text-green-300 text-sm break-all">
          <strong>Airdrop sent!</strong> Signature: {result}
        </div> : null}
    </div>;
};

In this guide you'll deploy a real program to devnet and invoke it, with the entire flow running on Helius infrastructure. You'll fund a wallet with [`requestAirdrop`](/api-reference/rpc/http/requestairdrop), deploy a prebuilt sample program, then call it with [`sendTransaction`](/api-reference/rpc/http/sendtransaction) and confirm the result with [`getSignatureStatuses`](/api-reference/rpc/http/getsignaturestatuses). Using a ready-made program keeps the focus on the deploy-and-invoke loop instead of writing Rust.

<Info>
  **Prerequisites:** the [Solana CLI](https://solana.com/docs/intro/installation) and [Rust](https://www.rust-lang.org/tools/install) (to build the program), Node.js 18+ (to invoke it), and a [Helius API key](https://dashboard.helius.dev/api-keys). Devnet works on every Helius plan.
</Info>

***

<Steps>
  <Step title="Point the Solana CLI at your Helius devnet RPC">
    Use your Helius endpoint for every CLI command, and create a wallet if you don't have one:

    ```bash theme={"system"}
    solana config set --url https://devnet.helius-rpc.com/?api-key=YOUR_API_KEY
    solana-keygen new --no-bip39-passphrase   # skip if you already have a keypair
    solana address
    ```

    `solana address` prints your wallet's public key, which you'll fund next.
  </Step>

  <Step title="Get devnet SOL">
    Deploying costs a bit of SOL. Devnet SOL is free and only good for testing, so fund your address with the faucet below or from the CLI:

    ```bash theme={"system"}
    solana airdrop 1
    solana balance
    ```

    <DevnetFaucet />

    <Note>
      Devnet faucets are rate-limited, so an airdrop can fail. If it does, wait a moment and retry, or use Solana's official [devnet web faucet](https://faucet.solana.com/) as a fallback. Deploying the sample program needs only \~1 SOL.
    </Note>
  </Step>

  <Step title="Clone and build the sample program">
    Grab the "Hello, Solana!" program from Solana's official [program-examples](https://github.com/solana-developers/program-examples) repo. It just logs a greeting when invoked, which is about the smallest program that still proves the full loop works.

    ```bash theme={"system"}
    git clone https://github.com/solana-developers/program-examples.git
    cd program-examples
    cargo build-sbf --manifest-path basics/hello-solana/native/program/Cargo.toml
    ```

    `program-examples` is a Cargo workspace, so `cargo build-sbf` compiles the program to `target/deploy/hello_solana_program.so` at the repo root (not inside the program folder). Stay in the `program-examples` directory for the next step.
  </Step>

  <Step title="Deploy to devnet through Helius">
    ```bash theme={"system"}
    solana program deploy target/deploy/hello_solana_program.so
    ```

    The CLI submits the deploy transaction through your Helius RPC and prints the **Program Id**. Copy it, since you'll invoke this program next.

    ```
    Program Id: 4Nd1mYQ...your program id...
    ```
  </Step>

  <Step title="Invoke the program with sendTransaction">
    In a fresh folder, set up a small TypeScript client that builds a transaction, sends it, and confirms it.

    ```bash theme={"system"}
    mkdir invoke-client && cd invoke-client
    npm init -y
    npm install @solana/web3.js
    ```

    ```typescript invoke.ts [expandable] theme={"system"}
    import {
      Connection,
      Keypair,
      PublicKey,
      Transaction,
      TransactionInstruction,
    } from "@solana/web3.js";
    import { readFileSync } from "fs";
    import { homedir } from "os";

    const RPC = "https://devnet.helius-rpc.com/?api-key=YOUR_API_KEY";
    const PROGRAM_ID = new PublicKey("YOUR_PROGRAM_ID"); // from the deploy step

    async function main() {
      const connection = new Connection(RPC, "confirmed");

      // Load the same keypair the CLI created and funded.
      const secret = JSON.parse(
        readFileSync(`${homedir()}/.config/solana/id.json`, "utf8")
      );
      const payer = Keypair.fromSecretKey(Uint8Array.from(secret));

      // The hello-solana program takes no accounts and no data. It just logs.
      const instruction = new TransactionInstruction({
        keys: [],
        programId: PROGRAM_ID,
        data: Buffer.alloc(0),
      });

      const tx = new Transaction().add(instruction);
      const { blockhash } = await connection.getLatestBlockhash();
      tx.recentBlockhash = blockhash;
      tx.feePayer = payer.publicKey;
      tx.sign(payer);

      // sendTransaction submits the signed transaction to the cluster via Helius.
      const signature = await connection.sendRawTransaction(tx.serialize());
      console.log("Sent:", signature);

      // Poll getSignatureStatuses until the transaction is confirmed.
      for (let i = 0; i < 30; i++) {
        const { value } = await connection.getSignatureStatuses([signature]);
        const status = value[0];
        if (status?.confirmationStatus === "confirmed" || status?.confirmationStatus === "finalized") {
          if (status.err) throw new Error(`Failed: ${JSON.stringify(status.err)}`);
          console.log("Confirmed! View it on Solana Explorer:");
          console.log(`https://explorer.solana.com/tx/${signature}?cluster=devnet`);
          return;
        }
        await new Promise((r) => setTimeout(r, 1000));
      }
      throw new Error("Timed out waiting for confirmation");
    }

    main().catch(console.error);
    ```

    Replace `YOUR_API_KEY` and `YOUR_PROGRAM_ID`, then run it:

    ```bash theme={"system"}
    npx tsx invoke.ts
    ```

    You'll get a signature and an Explorer link. Open the link and expand **Program Instruction Logs** to see the program's `Hello, Solana!` greeting.
  </Step>
</Steps>

## What's happening

### Everything routes through your Helius RPC

`solana config set --url` points every CLI command (airdrop, deploy, and the balance checks) at your Helius devnet endpoint. The TypeScript client uses the same endpoint, so the whole flow runs on Helius infrastructure.

### The invoke loop: send, then confirm

`sendRawTransaction` calls the [`sendTransaction`](/api-reference/rpc/http/sendtransaction) RPC method under the hood and returns a signature immediately, before the network has processed the transaction. That's why you poll [`getSignatureStatuses`](/api-reference/rpc/http/getsignaturestatuses) until `confirmationStatus` reaches `confirmed`, checking `err` to catch failures. This send-then-confirm pattern is the foundation of every Solana transaction you'll submit.

## Next steps

<CardGroup cols={2}>
  <Card title="How to Get Devnet SOL" icon="faucet-drip" href="/rpc/devnet-sol">
    Every way to fund a devnet wallet, plus rate-limit tips.
  </Card>

  <Card title="sendTransaction" icon="paper-plane" href="/api-reference/rpc/http/sendtransaction">
    All parameters, including skipPreflight, preflightCommitment, and retries.
  </Card>

  <Card title="Land transactions reliably" icon="rocket" href="/api-reference/sender/sendtransaction">
    When you go to mainnet, use Sender for ultra-low-latency landing.
  </Card>

  <Card title="Build a portfolio tracker" icon="wallet" href="/quickstart/portfolio-tracker">
    Other track: pull any wallet's tokens, NFTs, and SOL, with a live activity feed.
  </Card>
</CardGroup>
