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

# Setting up Environment for Hardhat

> This is a quick start guide for deploying and understanding a confidential ERC20 using the [Hardhat template](https://github.com/Inco-fhevm/inco-lite-template).

<Steps>
  <Step title="Prerequisites">
    We recommend installing nvm (Node Version Manager) first and then install Node.js with nvm.

    * For Linux: The official Linux version can be found [here](https://github.com/nvm-sh/nvm) or follow [this tutorial](https://tecadmin.net/how-to-install-nvm-on-ubuntu-20-04/).
    * For Windows, follow the [Readme guide](https://github.com/coreybutler/nvm-windows/blob/master/README.md#installation--upgrades).
    * For Mac, you can follow this [tutorial](https://tecadmin.net/install-nvm-macos-with-homebrew/).

    Install Node.js:

    ```bash theme={null}
    nvm install node
    ```

    Install pnpm:

    ```bash theme={null}
    npm install -g pnpm
    ```
  </Step>

  <Step title="Setting up your environment">
    1. Clone the template project:

    ```bash theme={null}
    git clone https://github.com/Inco-fhevm/inco-lite-template.git
    cd inco-lite-template
    ```

    2. Install dependencies:

    ```bash theme={null}
    pnpm install
    ```

    3. Set up `.env` file. You can use the values below, taken from the README:

    ```bash theme={null}
    # This should be a private key funded with native tokens.
    PRIVATE_KEY_ANVIL="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
    PRIVATE_KEY_BASE_SEPOLIA=""

    # This should be a seed phrase used to test functionalities with different accounts.  
    # You can send funds from the main wallet to this whenever needed.
    SEED_PHRASE="garden cage click scene crystal fat message twice rubber club choice cool"

    # This should be an RPC URL provided by a proper provider  
    # that supports the eth_getLogs() and eth_getFilteredLogs() methods.
    LOCAL_CHAIN_RPC_URL="http://localhost:8545"
    BASE_SEPOLIA_RPC_URL="https://base-sepolia-rpc.publicnode.com"
    ```

    <Note>
      If you don't have a mnemonic, you can generate one using [this website](https://iancoleman.io/bip39/) or use our default test accounts.
      We recommend using RPC providers instead of public endpoints for better log access.
    </Note>

    4. Compile contracts:

    ```bash theme={null}
    pnpm hardhat compile
    ```

    5. Run a local Node

    <Note>
      The current instructions will run a local node and a local covalidator. If you are using this template against another network, e.g. Base Sepolia, skip this step.
    </Note>

    ```bash theme={null}
    docker compose up
    ```

    6. Run tests:

    ```bash theme={null}
    pnpm hardhat test --network anvil
    ```
  </Step>
</Steps>

## Deploying on Base Sepolia

After setting the `PRIVATE_KEY_BASE_SEPOLIA` and `BASE_SEPOLIA_RPC_URL` fields in the `.env` file, run the following command:

```bash theme={null}
pnpm hardhat ignition deploy ./ignition/modules/ConfidentialToken.ts --network baseSepolia
```

Then, you can make sure tests still pass with:

```bash theme={null}
pnpm hardhat test --network baseSepolia
```

## Next Step

Now that you have deployed and tested the contract, let's understand how it works.
