# QUICK START — First Tezos Integration in 10 Minutes

Three escalating starting points. Pick the one that matches how you want to run.

---

## Path A — Zero install, browser, read-only (fastest)

Drop this in an `.html` file and open it. It reads a balance from a public RPC
and recent operations from the TzKT indexer. No keys, no build step.

```html
<!doctype html>
<html>
<head><meta charset="utf-8"><title>Tezos read demo</title></head>
<body>
  <input id="addr" value="tz1burnburnburnburnburnburnburjAYjjX" size="40">
  <button onclick="go()">Look up</button>
  <pre id="out"></pre>
  <script type="module">
    import { TezosToolkit } from "https://esm.sh/@taquito/taquito@24";
    const RPC = "https://rpc.tzkt.io/mainnet";       // free public RPC
    const IDX = "https://api.tzkt.io/v1";             // free public indexer
    const Tezos = new TezosToolkit(RPC);
    window.go = async () => {
      const a = document.getElementById("addr").value.trim();
      const balMutez = await Tezos.tz.getBalance(a);
      const ops = await fetch(`${IDX}/accounts/${a}/operations?limit=5`).then(r=>r.json());
      document.getElementById("out").textContent =
        `Balance: ${balMutez.dividedBy(1e6).toFixed(6)} tez\n\n` +
        ops.map(o => `${o.type} @ ${o.timestamp}`).join("\n");
    };
  </script>
</body>
</html>
```

The `esm.sh` CDN lets you import Taquito with no bundler. For production, install
locally and bundle (Path B).

---

## Path B — Node / build-tool project, full dApp (recommended)

Requires **Node.js >= 22**.

```bash
mkdir my-tezos-app && cd my-tezos-app
npm init -y
npm install @taquito/taquito @taquito/beacon-wallet @tezos-x/octez.connect-sdk @taquito/utils
```

Minimal connect-and-send (browser/dApp context — user signs with their wallet):

```js
import { TezosToolkit } from "@taquito/taquito";
import { BeaconWallet } from "@taquito/beacon-wallet";
import { NetworkType } from "@tezos-x/octez.connect-sdk";

const Tezos = new TezosToolkit("https://rpc.tzkt.io/mainnet");
const wallet = new BeaconWallet({ name: "My dApp", network: { type: NetworkType.MAINNET } });
Tezos.setWalletProvider(wallet);

export async function connect() {
  await wallet.requestPermissions();          // opens wallet-selection popup
  return wallet.getPKH();                      // user's tz address
}

export async function send(to, tez) {
  const op = await Tezos.wallet.transfer({ to, amount: tez }).send();
  await op.confirmation(1);                    // ~6s/block
  return op.opHash;
}
```

Copy a full template from `06-templates/react-taquito/` or
`06-templates/html-vanilla/` to skip the boilerplate.

---

## Path C — Backend automation (you hold the key)

For bots, payouts, monitoring. **Keys never go in source — use env/vault.**

```bash
npm install @taquito/taquito @taquito/signer
```

```js
import { TezosToolkit } from "@taquito/taquito";
import { InMemorySigner } from "@taquito/signer";

const Tezos = new TezosToolkit("https://rpc.tzkt.io/mainnet");
Tezos.setProvider({ signer: await InMemorySigner.fromSecretKey(process.env.TZ_SECRET_KEY) });

const op = await Tezos.contract.transfer({ to: "tz1...", amount: 1 }).send();
await op.confirmation(1);
console.log("done", op.hash);
```

Note the difference: backend uses `Tezos.contract.*` with a signer; dApp uses
`Tezos.wallet.*` with a wallet provider. Same toolkit, two operation APIs.

For real production, swap `InMemorySigner` for a **remote signer** (Signatory)
or **Ledger** signer — see `03-signing/`.

---

## Where to go next

- Reading data the right way → `04-indexers/`
- Letting users connect → `02-wallet-connect/`
- Login without gas (Sign-In-With-Tezos) → `03-signing/SIWT.md`
- Atomic multi-step txns → `05-batches/`
- All endpoints and keys → `07-api-inventory/API_INVENTORY.md`
- Glossary of every term used → `GLOSSARY.md`


## Server-enforced wallet gate

For protected files or private diligence rooms, use `06-templates/cloudflare-wallet-gate/`. The static wallet-gate template is suitable for UX demos; the Cloudflare Worker gate is the real privacy boundary because protected bytes are streamed from private R2 only after server-side wallet verification.
