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

# Build a dApp

> Scaffold a full-stack confidential dApp with create-inco-app

The `create-inco-app` CLI allows you to create a new full-stack confidential dApp with a Next.js frontend, Solidity smart contracts, and the Inco SDK. It is the easiest way to get started building on Inco.

## Basic usage

<CodeGroup>
  ```bash npm theme={null}
  npx create-inco-app@latest
  ```

  ```bash pnpm theme={null}
  pnpm create inco-app@latest
  ```

  ```bash yarn theme={null}
  yarn create inco-app
  ```

  ```bash bun theme={null}
  bunx create-inco-app@latest
  ```
</CodeGroup>

On installation, you'll see the following prompts:

```
What is your project named? my-app
Which chain would you like to use? EVM
Which contract framework would you like to use? Foundry / Hardhat
Which wallet provider would you like to use? RainbowKit / Privy / Dynamic / Reown / Para
```

After the prompts, `create-inco-app` will create a folder with your project name and install the required dependencies.

## Reference

```
npx create-inco-app@latest [project-name] [options]
```

The following options are available:

| Option                        | Description                                                         |
| ----------------------------- | ------------------------------------------------------------------- |
| `-h` or `--help`              | Show all available options                                          |
| `-v` or `--version`           | Output the version number                                           |
| `-f` or `--framework <value>` | Contract framework (`foundry` or `hardhat`)                         |
| `-w` or `--wallet <value>`    | Wallet provider (`rainbowkit`, `privy`, `dynamic`, `reown`, `para`) |
| `-c` or `--chain <value>`     | Chain type (`evm`, `svm`)                                           |
| `-y` or `--yes`               | Skip prompts, use defaults                                          |
| `--install`                   | Auto-install dependencies after scaffolding                         |
| `--git`                       | Initialize a git repository                                         |
| `--use-npm`                   | Explicitly tell the CLI to bootstrap using npm                      |
| `--use-pnpm`                  | Explicitly tell the CLI to bootstrap using pnpm                     |
| `--use-yarn`                  | Explicitly tell the CLI to bootstrap using Yarn                     |
| `--use-bun`                   | Explicitly tell the CLI to bootstrap using Bun                      |

## Project Structure

The scaffolded project is a monorepo with two workspaces:

```
my-app/
├── contracts/          # Solidity contracts (Foundry or Hardhat)
│   ├── src/            # Contract source files
│   ├── test/           # Contract tests
│   └── docker-compose.yml  # Local node + covalidator
└── frontend/           # Next.js app (pre-configured for Base Sepolia)
    ├── components/
    │   ├── Providers.tsx    # Wallet provider setup
    │   └── ConfLottery.tsx  # Example dApp component
    └── hooks/
        └── useConfLottery.ts  # Inco SDK integration
```

<Note>
  The frontend is pre-configured for **Base Sepolia** (chain ID `84532`). All wallet providers point to Base Sepolia by default — no chain configuration changes are needed.
</Note>

## Examples

### With default options

<CodeGroup>
  ```bash npm theme={null}
  npx create-inco-app@latest
  ```

  ```bash pnpm theme={null}
  pnpm create inco-app@latest
  ```

  ```bash yarn theme={null}
  yarn create inco-app
  ```

  ```bash bun theme={null}
  bunx create-inco-app@latest
  ```
</CodeGroup>

### With Foundry and RainbowKit

<CodeGroup>
  ```bash npm theme={null}
  npx create-inco-app@latest my-app --framework foundry --wallet rainbowkit --chain evm --yes
  ```

  ```bash pnpm theme={null}
  pnpm create inco-app@latest my-app --framework foundry --wallet rainbowkit --chain evm --yes
  ```

  ```bash yarn theme={null}
  yarn create inco-app my-app --framework foundry --wallet rainbowkit --chain evm --yes
  ```

  ```bash bun theme={null}
  bunx create-inco-app@latest my-app --framework foundry --wallet rainbowkit --chain evm --yes
  ```
</CodeGroup>

### With Hardhat and Para

<CodeGroup>
  ```bash npm theme={null}
  npx create-inco-app@latest my-app --framework hardhat --wallet para --chain evm --yes
  ```

  ```bash pnpm theme={null}
  pnpm create inco-app@latest my-app --framework hardhat --wallet para --chain evm --yes
  ```

  ```bash yarn theme={null}
  yarn create inco-app my-app --framework hardhat --wallet para --chain evm --yes
  ```

  ```bash bun theme={null}
  bunx create-inco-app@latest my-app --framework hardhat --wallet para --chain evm --yes
  ```
</CodeGroup>

## Test Contracts

<Tabs>
  <Tab title="Foundry">
    No Docker needed — uses IncoTest mocked infrastructure.

    <CodeGroup>
      ```bash npm theme={null}
      cd my-app && npm install
      cd contracts && forge test -vvv
      ```

      ```bash pnpm theme={null}
      cd my-app && pnpm install
      cd contracts && forge test -vvv
      ```

      ```bash yarn theme={null}
      cd my-app && yarn install
      cd contracts && forge test -vvv
      ```

      ```bash bun theme={null}
      cd my-app && bun install
      cd contracts && forge test -vvv
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Hardhat">
    Requires the local Docker node running.

    <CodeGroup>
      ```bash npm theme={null}
      cd my-app && npm install
      cd contracts
      docker compose up -d
      sleep 10
      npx hardhat compile
      npx hardhat test --network anvil
      ```

      ```bash pnpm theme={null}
      cd my-app && pnpm install
      cd contracts
      docker compose up -d
      sleep 10
      pnpm hardhat compile
      pnpm hardhat test --network anvil
      ```

      ```bash yarn theme={null}
      cd my-app && yarn install
      cd contracts
      docker compose up -d
      sleep 10
      yarn hardhat compile
      yarn hardhat test --network anvil
      ```

      ```bash bun theme={null}
      cd my-app && bun install
      cd contracts
      docker compose up -d
      sleep 10
      bunx hardhat compile
      bunx hardhat test --network anvil
      ```
    </CodeGroup>

    When done, stop the local node:

    ```bash theme={null}
    docker compose down
    ```
  </Tab>
</Tabs>

## Deploy to Base Sepolia

The frontend is pre-configured for **Base Sepolia** (chain ID `84532`) and only works against Base Sepolia — local nodes are for contract testing only.

Set up your environment variables in `contracts/.env`:

```bash theme={null}
PRIVATE_KEY_BASE_SEPOLIA=<your-private-key>
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
```

Make sure your account has Base Sepolia testnet ETH for gas fees.

<Tabs>
  <Tab title="Foundry">
    ```bash theme={null}
    cd contracts
    forge script script/DeployConfLottery.s.sol --rpc-url $BASE_SEPOLIA_RPC_URL --broadcast
    ```
  </Tab>

  <Tab title="Hardhat">
    <CodeGroup>
      ```bash npm theme={null}
      cd contracts
      npx hardhat compile
      npx hardhat ignition deploy ignition/modules/ConfidentialLottery.ts --network baseSepolia
      ```

      ```bash pnpm theme={null}
      cd contracts
      pnpm hardhat compile
      pnpm hardhat ignition deploy ignition/modules/ConfidentialLottery.ts --network baseSepolia
      ```

      ```bash yarn theme={null}
      cd contracts
      yarn hardhat compile
      yarn hardhat ignition deploy ignition/modules/ConfidentialLottery.ts --network baseSepolia
      ```

      ```bash bun theme={null}
      cd contracts
      bunx hardhat compile
      bunx hardhat ignition deploy ignition/modules/ConfidentialLottery.ts --network baseSepolia
      ```
    </CodeGroup>
  </Tab>
</Tabs>

Note the deployed contract address from the output, then configure and run the frontend:

```bash theme={null}
cd frontend
cp .env.example .env.local
# Set NEXT_PUBLIC_CONFLOTTERY_ADDRESS=<deployed address>
# Set wallet-specific env vars (see wallet provider pages)
```

<CodeGroup>
  ```bash npm theme={null}
  npm run dev
  ```

  ```bash pnpm theme={null}
  pnpm run dev
  ```

  ```bash yarn theme={null}
  yarn dev
  ```

  ```bash bun theme={null}
  bun run dev
  ```
</CodeGroup>

Open [http://localhost:3000](http://localhost:3000) to see your dApp.

## Inco SDK Integration

The scaffolded app uses `@inco/js` for encryption and decryption. Here's the core pattern:

```tsx theme={null}
import { Lightning } from "@inco/js/lite";
import { handleTypes } from "@inco/js";

// Initialize Inco
const zap = await Lightning.latest("testnet", 84532);

// Encrypt a value before sending on-chain
const ciphertext = await zap.encrypt(parseEther("100"), {
  accountAddress: address,
  dappAddress: contractAddress,
  handleType: handleTypes.euint256,
});

// Call your contract with the encrypted value
writeContract({
  address: contractAddress,
  abi: contractAbi,
  functionName: "deposit",
  args: [ciphertext],
  value: await getIncoFee(), // Inco executor fee
});

// Decrypt with attestation (e.g., check if user is winner)
const result = await zap.attestedDecrypt(walletClient, [encryptedHandle]);
const plaintext = result[0].plaintext.value;
```

See [Encrypting Values](/js-sdk/encryption) and [Attested Decrypt](/js-sdk/attestations/attested-decrypt) for full details.

## Choose Your Wallet Provider

Each wallet provider has its own setup. Select one to see the provider configuration and how it integrates with Inco:

<CardGroup cols={3}>
  <Card title="Para" img="https://mintcdn.com/inco/ATAF7MZMLS3SasjU/wallets/para.svg?fit=max&auto=format&n=ATAF7MZMLS3SasjU&q=85&s=d2cbd9331eacaecc84777b24c04bf1c0" href="/quickstart/wallets/para" width="120" height="120" data-path="wallets/para.svg">
    Embedded + external wallet support
  </Card>

  <Card title="RainbowKit" img="https://mintcdn.com/inco/ATAF7MZMLS3SasjU/wallets/rainbowkit.svg?fit=max&auto=format&n=ATAF7MZMLS3SasjU&q=85&s=7d6848666fd338cb33b0b81366ff9db8" href="/quickstart/wallets/rainbowkit" width="120" height="120" data-path="wallets/rainbowkit.svg">
    Multi-wallet connector
  </Card>

  <Card title="Privy" img="https://mintcdn.com/inco/ATAF7MZMLS3SasjU/wallets/privy.svg?fit=max&auto=format&n=ATAF7MZMLS3SasjU&q=85&s=bfbd810a0117928825c8d7b0e7f9b3e2" href="/quickstart/wallets/privy" width="120" height="120" data-path="wallets/privy.svg">
    Embedded wallets & social login
  </Card>

  <Card title="Dynamic" img="https://mintcdn.com/inco/ATAF7MZMLS3SasjU/wallets/dynamic.svg?fit=max&auto=format&n=ATAF7MZMLS3SasjU&q=85&s=f3a87589c1ddff2bdf43617a951ad9e5" href="/quickstart/wallets/dynamic" width="120" height="120" data-path="wallets/dynamic.svg">
    Multi-chain wallet orchestration
  </Card>

  <Card title="Reown" img="https://mintcdn.com/inco/ATAF7MZMLS3SasjU/wallets/reown.svg?fit=max&auto=format&n=ATAF7MZMLS3SasjU&q=85&s=f066cbeb8bbff131f9f6e050ce3cd527" href="/quickstart/wallets/reown" width="120" height="120" data-path="wallets/reown.svg">
    WalletConnect-powered connections
  </Card>
</CardGroup>

## Quick Reference

| Command                            | Description                          |
| ---------------------------------- | ------------------------------------ |
| `docker compose up -d`             | Start local node (from `contracts/`) |
| `docker compose down`              | Stop local node                      |
| `forge build`                      | Compile (Foundry)                    |
| `forge test -vvv`                  | Test (Foundry)                       |
| `npx hardhat compile`              | Compile (Hardhat)                    |
| `npx hardhat test --network anvil` | Test (Hardhat)                       |
| `npm run dev`                      | Start frontend (from `frontend/`)    |
