Skip to content

Commit

Permalink
fix: merge remote-tracking branch 'origin/dev' into refactor/replace-…
Browse files Browse the repository at this point in the history
…nestjs-with-turborepo
  • Loading branch information
0xnigir1 committed Aug 21, 2024
2 parents 35f937b + 01eba7d commit bd7747d
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged && pnpm check-types
npx lint-staged && pnpm check-types
79 changes: 58 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
# zkChainHub
# ZKchainHub - Backend

## Description

ZKchainHub is envisioned as a permissionless, cloud-agnostic platform that allows anyone to deploy an instance, specifically focusing on the settlement chain.
You can fetch metrics from the ZKsync ecosystem and ZK chains from L1 RPC (Ethereum). Optionally, it will also fetch data from L2 RPCs for the chains where the user provides the RPC.

## 📋 Prerequisites
## Overview

This repository is a monorepo consisting of 4 packages and 1 app:

- Ensure you have `node >= 20.0.0` and `pnpm >= 9.0.0` installed.
- [`@zkchainhub/shared`](./packages/shared): A library for shared configurations, constants, types, etc.
- [`@zkchainhub/providers`](./packages/providers): A library that provides abstracted services over Viem providers to query blockchain data
- [`@zkchainhub/pricing`](./packages/pricing): An extensible library that provides Pricing services to fetch token prices. Currently, only Coingecko provider is developed
- [`@zkchainhub/metrics`](./packages/metrics): A library that provides different aggregated metrics from the ZKsync ecosystem and ZK chains.
- [`@zkchainhub/api`](./apps/api): An Express server that exposes an API where you can fetch information about ZKsync ecosystem and their chains, using the before mentioned libraries

## 📋 Prerequisites

- Ensure you have `node >= 20.0.0` and `pnpm >= 9.5.0` installed.

## Diagram

This is a high level architecture diagram of the ZKchainHub

```mermaid
graph LR
API -->|Ethereum RPC| ETH_RPC[Ethereum RPC]
Expand All @@ -21,29 +32,46 @@ graph LR
style L2_RPC fill:#2E86C1,stroke:#ffffff,stroke-width:2px
```


## Installation

```bash
$ pnpm install
```

## Running the app
## Building

To build the monorepo packages, run:

```bash
# development
$ pnpm run start
$ pnpm build
```

## ⚙️ Setting up env variables

- Inside `apps/api` folder, create `.env` file and copy paste `.env.example` content in there.

```
$ cd apps/api && cp .env.example .env
```

- Set up `L1_RPC_URLS` as CSV list of RPC URLs. For example, `https://eth.llamarpc.com,https://rpc.flashbots.net/fast`. You can check [Chainlist](https://chainlist.org/) for a list of public RPCs
- Set up `L2_RPC_URLS` as CSV list of RPC URLs. For example, `https://mainnet.era.zksync.io`. You can check [Chainlist](https://chainlist.org/) for a list of public RPCs
- Set `COINGECKO_API_KEY`, `COINGECKO_BASE_URL` and `COINGECKO_API_KEY` depending on your API plan. You can get an API Key creating an account on [Coingecko's site](https://www.coingecko.com/en/api)
- (Optionally) Set `PORT` on which API is made available. By default is port 3000

# watch mode
$ pnpm run start:dev
## Running the app

```bash
# development watch mode
$ pnpm run dev

# production mode
$ pnpm run start:prod
$ pnpm run start

# running a specific app
$ pnpm run start my-app
```

Verify that ZKchainHub API is running on http://localhost:3000 (or the port specified)

## Test

```bash
Expand All @@ -57,15 +85,24 @@ $ pnpm run test:e2e
$ pnpm run test:cov
```

## Creating a new app
```bash
$ pnpm nest g app <app-name>
```
## Docs

## Creating a new library
```bash
$ pnpm create-lib <lib-name>
```
Locally Swagger docs are available at http://localhost:3000/docs

## Development

### Linter

Run `pnpm run lint` to make sure the code base follows configured linter rules.

### 💻 Conventional Commits

## 💻 Conventional Commits
We follow the Conventional Commits [specification](https://www.conventionalcommits.org/en/v1.0.0/#specification).

## Contributing

ZKchainHub was built with ❤️ by [Wonderland](https://defi.sucks).

Wonderland is a team of top Web3 researchers, developers, and operators who believe that the future needs to be open-source, permissionless, and decentralized.

[DeFi sucks](https://defi.sucks), but Wonderland is here to make it better.

0 comments on commit bd7747d

Please sign in to comment.