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

# Quick Start

> Get started with Enso Shield in under 5 minutes.

export const date_0 = "2026-04-14"

This guide walks through the core Shield workflow: **simulate** a transaction to predict its outcome, then **validate** it before signing.

We'll use a simple ETH → WETH wrap as the example transaction — the calldata is just `0xd0e30db0` (the `deposit()` function selector), so you can copy-paste and run immediately.

## Prerequisites

* An Enso API key ([get one here](/pages/build/get-started/authentication))

## 1. Simulate a Transaction

Send your transaction to the simulate endpoint to get predicted output amounts and gas consumption.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://shield.api.enso.build/api/v1/simulate \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "chainId": 1,
      "transaction": {
        "data": "0xd0e30db0",
        "value": "1000000000000000000",
        "to": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
      },
      "tokenIn": ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"],
      "tokenOut": ["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"],
      "amountIn": ["1000000000000000000"]
    }'
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch("https://shield.api.enso.build/api/v1/simulate", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${ENSO_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      chainId: 1,
      transaction: {
        data: "0xd0e30db0",
        value: "1000000000000000000",
        to: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        from: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
      },
      tokenIn: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"],
      tokenOut: ["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"],
      amountIn: ["1000000000000000000"],
    }),
  });

  const simulation = await response.json();
  console.log("Simulation ID:", simulation.simulationId);
  console.log("Amount out:", simulation.result.amountOut);
  console.log("Gas:", simulation.result.gas);
  ```
</CodeGroup>

**Response:**

```json theme={null}
{
  "simulationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "chainId": 1,
  "result": {
    "status": "Success",
    "amountOut": ["1000000000000000000"],
    "gas": "46000"
  }
}
```

The `simulationId` is a UUID you'll use in the next step to validate the transaction before signing.

## 2. Validate Before Signing

Before signing the transaction, send it with the `simulationId` to confirm nothing has changed.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://shield.api.enso.build/api/v1/validate \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "simulationId": "<SIMULATION_ID>",
      "transaction": {
        "data": "0xd0e30db0",
        "to": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
        "value": "1000000000000000000",
        "chainId": 1
      }
    }'
  ```

  ```typescript TypeScript theme={null}
  const validation = await fetch("https://shield.api.enso.build/api/v1/validate", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${ENSO_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      simulationId: simulation.simulationId,
      transaction: {
        data: "0xd0e30db0",
        to: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        from: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
        value: "1000000000000000000",
        chainId: 1,
      },
    }),
  }).then((res) => res.json());

  if (validation.valid) {
    console.log("Transaction verified — safe to sign");
  } else {
    console.error("Validation failed:", validation.checks);
  }
  ```
</CodeGroup>

**Response:**

```json theme={null}
{
  "valid": true,
  "simulationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "checks": {
    "chainId": true,
    "data": true,
    "to": true,
    "value": true,
    "from": true
  }
}
```

## 3. Sign and Submit

Once validated, sign and submit the transaction using any web3 library.

<CodeGroup>
  ```typescript viem theme={null}
  import { createWalletClient, http } from "viem";
  import { mainnet } from "viem/chains";
  import { privateKeyToAccount } from "viem/accounts";

  const account = privateKeyToAccount("0x...");
  const client = createWalletClient({ account, chain: mainnet, transport: http() });

  if (validation.valid) {
    const hash = await client.sendTransaction({
      to: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
      data: "0xd0e30db0",
      value: BigInt("1000000000000000000"),
    });
    console.log("Transaction hash:", hash);
  }
  ```

  ```typescript ethers.js theme={null}
  import { ethers } from "ethers";

  const provider = new ethers.JsonRpcProvider("https://eth.llamarpc.com");
  const wallet = new ethers.Wallet("0x...", provider);

  if (validation.valid) {
    const txResponse = await wallet.sendTransaction({
      to: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
      data: "0xd0e30db0",
      value: "1000000000000000000",
    });
    console.log("Transaction hash:", txResponse.hash);
  }
  ```
</CodeGroup>

<Warning>
  Simulations are cached for **5 minutes**. Validate within this window, or re-simulate to get a fresh `simulationId`.
</Warning>

<Tip>
  Shield works with transactions from **any source** — Uniswap, Enso, Aave, or your own contracts. See the [Third-Party Transactions guide](/pages/shield/guides/third-party-transactions) for examples.
</Tip>

<div className="text-right text-xs gray-200 font-semibold w-full" style={{marginTop: '0'}}>
  <p style={{
        color: "#b2b2b2"  
    }}>Updated {date_0}</p>
</div>
