# Running Locally

Get the full EcoRound stack running on your machine in five steps.

***

## Prerequisites

| Tool              | Install                                        |
| ----------------- | ---------------------------------------------- |
| Go 1.21+          | [go.dev/dl](https://go.dev/dl)                 |
| Node.js 18+       | [nodejs.org](https://nodejs.org)               |
| Foundry           | `curl -L https://foundry.paradigm.xyz \| bash` |
| Chainlink CRE CLI | See Chainlink docs                             |

You also need a free PostgreSQL database. [Neon](https://neon.tech) is recommended — free tier is sufficient.

***

## Step 1 — API Simulator

```bash
cd api-simulator

# Configure
echo 'DATABASE_URL=postgresql://user:pass@host.neon.tech/neondb?sslmode=require' > .env

# Run (auto-creates database tables on first start)
go run .
```

Verify: `curl http://localhost:8080/health` → `{"status":"ok"}`

***

## Step 2 — Admin Panel

```bash
cd panel-v2

cat > .env << EOF
DATABASE_URL=postgresql://user:pass@host.neon.tech/neondb?sslmode=require
RPC_URL=https://virtual.rpc.tenderly.co/.../private/ecoround-base/<uuid>
FACTORY_ADDRESS=0x9ee150e66bca22083f6e5d279d4c5c00a9a7f582
OWNER_PRIVATE_KEY=0x...
API_URL=http://localhost:8080
EOF

go run .
```

Create a match to get started:

```
> match create "Sentinels" "NRG"
```

***

## Step 3 — Frontend

```bash
cd frontend

npm install

cat > .env.local << EOF
NEXT_PUBLIC_RPC_URL=https://virtual.rpc.tenderly.co/.../public/ecoround-base
NEXT_PUBLIC_API_URL=/api/v1
NEXT_PUBLIC_WC_PROJECT_ID=ecoround-dev
EOF

npm run dev
```

Open <http://localhost:3000>.

***

## Step 4 — CRE Oracle

```bash
cd cre

export CRE_ETH_PRIVATE_KEY=0x...

# Dry run
cre workflow simulate EcoRound-workflow --target production-settings

# With real on-chain writes
cre workflow simulate EcoRound-workflow --target production-settings --broadcast
```

***

## Step 5 — Test the Full Flow

1. Go to `/faucet` → mint 10,000 test USDC
2. Go to `/matches` → open the match you created
3. Deposit 100 USDC on Team A
4. In the admin panel: `match simulate pandascore started` and `match simulate vlr started`
5. Wait up to 30 seconds — the oracle fires and calls `lockMatch()`
6. In the panel: `match simulate pandascore ended 2 1` and `match simulate vlr ended 2 1`
7. Wait — oracle resolves the match
8. Go to the match page → click Claim → receive your deposit + yield

***

## Services at a Glance

| Service       | URL / Location          |
| ------------- | ----------------------- |
| Frontend      | <http://localhost:3000> |
| API Simulator | <http://localhost:8080> |
| Admin Panel   | Terminal                |
| Blockchain    | Tenderly RPC (remote)   |
| Oracle        | CRE CLI (local process) |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eco-round.gitbook.io/eco-round-docs/deployments/running-locally.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
