# Environment Setup

## Prerequisite

In this section, we list items needs to be complete before start building.

* [NodeJS](https://nodejs.org/en)
* [Metamask](https://metamask.io/)
* [Docker](https://www.docker.com/)

###

### Start the Sight environment locally.

First, clone the pre-prepared example code repository to your local machine.

```sh
git clone https://github.com/sight-ai/sight-oracle-contract-example-hardhat
cd sight-oracle-contract-example-hardhat
npm install
cp -f .env.example .env
```

In these commands, we will clone the Sight Oracle example code locally, install the necessary dependencies using `npm`, and finally use the `cp` command to copy the contents of `.env.example` to a new `.env` file.

```sh
npm run sight:stop ;npm run sight:start
```

Next, let’s run this command to start Sight environment. It may take 3-5 minutes to complete.

> **Note:** If you are using Docker Desktop, please make sure you have logged in and opened the Docker application in advance.

It will launch a complete Sight environment locally with a single command, including an EVM chain, an FHEVM chain, a backend service, and a database. Once everything is set up, you should see information from the backend service monitoring events on the chain being printed, similar to the output shown in the image below.

<figure><img src="https://4239479252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fc6n88IVs810uKFVbVyUQ%2Fuploads%2FWqNZt4Q9PLOCGbjyiwhN%2Fimage.png?alt=media&#x26;token=814003a1-4b19-4ce5-9619-b41113b71709" alt=""><figcaption></figcaption></figure>

### Deployment Config

To deploy the contract on the Sepolia test network, you first need to obtain some Sepolia test tokens and the Sepolia RPC URL.

If you don’t have a **Sepolia RPC** yet, you can click [here](https://dashboard.alchemy.com/) to require one.

> **Note:** You can get the `private key` through **MetaMask** by going to Account Details => Export Private Key (Please use a test wallet, as leaking the private key poses a risk of account theft!).

```properties
PRIVATE_KEY=<YOUR_PRIVATE_KEY>
SEPOLIA_RPC_URL=<YOUR_SEPOLIA_RPC_URL>
SEPOLIA_ORACLE_CONTRACT_ADDRESS=0xC5ac65f17Ce781E9F325634b6218Dc75a5CF9abF
```

Add these environment variables to the `.env` file. `SEPOLIA_ORACLE_CONTRACT_ADDRESS` is the Oracle address we have deployed on the Sepolia test network.

```typescript
networks: {
    //other network
    sepolia: {
      url: process.env.SEPOLIA_RPC_URL!,
      accounts: [process.env.PRIVATE_KEY!],
      chainId: 11155111
    }
  },
```

Add the Sepolia network configuration information to the `hardhat.config.ts` file

### Wallet Installation

* Install [Metamask](https://metamask.io/)
* Create a account
* Add Ethereum-Sepolia Testnet to your MetaMask wallet (Click [here](https://chainlist.org/?testnets=true\&search=11155111))

  <figure><img src="https://4239479252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fc6n88IVs810uKFVbVyUQ%2Fuploads%2FZ6J4sAmNjmjGCh11Hjsh%2F%E6%88%AA%E5%B1%8F2024-11-15%2022.43.59.png?alt=media&#x26;token=3cf97df5-4849-4cbc-8540-b769ba7177ad" alt=""><figcaption></figcaption></figure>

  Check the box for "**Include Testnets**," then click "**Add to MetaMask**."

### Get testnet token

Request ETH token from faucet below:

* Main (Sepolia): [Sepolia Faucet](https://cloud.google.com/application/web3/faucet/ethereum/sepolia) (0.05ETH)

<figure><img src="https://4239479252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fc6n88IVs810uKFVbVyUQ%2Fuploads%2FRmKF3yRw7CewVLTXT3tB%2F%E6%88%AA%E5%B1%8F2024-10-22%2014.19.50.png?alt=media&#x26;token=21de2d04-897c-4633-b319-a7b8c11c1f2e" alt=""><figcaption></figcaption></figure>

Enter your account address in the input box below, then click **Receive 0.05 Sepolia ETH** button. After waiting for a while, you can check your balance in Metamask.

### Next Steps

You now have completed Prerequisite items, choose one of the development framework to get started:

* Remix
* [Hardhat](https://sightai.gitbook.io/docs/verifiable-ai/sight-oracle/tutorial/create-your-first-dapp-using-hardhat)
* [Foundry](https://sightai.gitbook.io/docs/verifiable-ai/sight-oracle/tutorial/create-your-first-dapp-using-foundry)

> Note: For any questions or suggestions related to the tutorial, please submit issues to github issue page [here](https://github.com/sight-ai/sight-oracle-contract-example-hardhat/issues)
