Skip to content

Commit

Permalink
Merge pull request #193 from Consensys/fix/denv-command-test
Browse files Browse the repository at this point in the history
feat: update Readme
  • Loading branch information
phoax authored Jul 11, 2024
2 parents dff0e43 + 6962caa commit cf9fb37
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 24 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ contract TestL1 is EVMFetchTarget {

## Requirements

- NodeJs v18.x.
- pnpm v9.x
- yarn for the linea-ens-contracts package only
- [Node.js](https://nodejs.org/en/download/package-manager) v18.x.
- [pnpm](https://pnpm.io/installation) v9.x
- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install) v1.2
- [Docker](https://docs.docker.com/engine/install/)
- [docker-compose](https://docs.docker.com/compose/install/) v1.2x

## Packages

Expand Down
150 changes: 131 additions & 19 deletions packages/linea-ens-app/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# Linea ENS App

Friendly forked from ENS V3 app: https://github.com/ensdomains/ens-app-v3
This documentation provides instructions on how to set up, deploy, and run the Linea ENS App locally.

Friendly forked from ENS V3 app: [https://github.com/ensdomains/ens-app-v3](https://github.com/ensdomains/ens-app-v3).

## Usage

### Requirements

Install `Node.js`, `pnpm`, `Yarn` and `docker-compose`.

See [Requirements](../../README.md#requirements).

### Install

In the `linea-ens` root folder, run:

```bash
pnpm i
```

### Quick start on localhost

In a first terminal run:
#### 1. Run background services and deploy smart contracts

In a first terminal, run:

```bash
cd packages/linea-ens-app
Expand All @@ -21,50 +33,93 @@ pnpm i
pnpm denv
```

In a second terminal run:
Once successfully started, you should see `TheGraph` logs:

```bash
graph-node_1 | Jul 11 10:39:41.725 INFO Done processing trigger, gas_used: 197859281, data_source: ENSRegistry, handler: handleNewResolver, total_ms: 2, transaction: 0x807b…2c88, address: 0x5fbd…0aa3, signature: NewResolver(indexed bytes32,address), sgd: 1, subgraph_id: QmUqJV5Z..., component: SubgraphInstanceManager
graph-node_1 | Jul 11 10:39:41.729 INFO Applying 7 entity operation(s), block_hash: 0xb51c59cdbc..., block_number: 79, sgd: 1, subgraph_id: QmUqJV5Z..., component: SubgraphInstanceManager
```

#### 2. Deploy ENS Subgraph

In a second terminal, run:

```bash
cd packages/linea-ens-subgraph
yarn setup
```

In a third terminal run:
Once successfully started, you should see:

```bash
Build completed: QmRmG8bPjg3oy62b...
Deployed to http://127.0.0.1:8000/subgraphs/name/graphprotocol/ens/graphql
```

#### 3. Start Web3Signer

In a third terminal, run:

```bash
cd services/web3signer/
cp ./keyFiles/examples/signer.yaml ./keyFiles/signer.yaml
make dev-docker
```

In a fourth terminal run:
Once successfully started, you should see:

```bash
Web3Signer has started with TLS disabled, and ready to handle signing requests on 0.0.0.0:9000
```

#### 4. Start PoH Signer API

In a fourth terminal, run:

```bash
cd packages/poh-signer-api
cp .env.example .env
cp pnpm i
make pnpm start
pnpm i
make dev
```

Make sure `VERIFIER_CONTRACT_ADDRESS` matches the `PohVerifier` contract address in ./packages/linea-ens-app/.env.local
Make sure `VERIFIER_CONTRACT_ADDRESS` matches the `PohVerifier` contract address in `./packages/linea-ens-app/.env.local`.

In a fifth terminal run:
Once successfully started, you should see:

```bash
Poh Signer Api v1.0.0 development started on port: 4000
```

#### 5. Start ENS frontend

In a fifth terminal, run:

```bash
cd packages/linea-ens-app
pnpm dev:glocal
```

You'll need an account with POH to fully use the local env, if you don't, you can get it [here] (https://poh.linea.build/)
You'll need an account with POH to fully use the local env, if you don't, you can get it [here] (https://poh.linea.build/).

- Then browse http://localhost:3000/.
- Import one of the hardhat test accounts in your MetaMask to have funds (eg, private key: `ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80`, for address: `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`)
- Add the local test network to your MetaMask with these info:

- Click on `Add a network manually`
- Add this config:

| Setting | Value |
| --------------- | --------------------- |
| Network name | Localhost 8545 |
| New RPC URL | http://127.0.0.1:8545 |
| Chain ID | 1337 |
| Currency symbol | ETH |

- Then browse http://localhost:3000/
- Import one of the hardhat test accounts in your metamask to have funds (eg: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80)
- Add the local test network to your metamask with this info:
- Localhost 8545
- http://127.0.0.1:8545
- 1337
- ETH
- Transfer some ETH from the test account to your POH account
- You can start testing the app and register a domain
- Save and Swith to `Localhost 8455`.
- Transfer 1 ETH from the test account above (eg: `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`), to your POH account
- If you don't have an address with PoH, see [Common Errors](#common-errors).
- You can start testing the app and register a domain.

### Running Dev env

Expand Down Expand Up @@ -136,3 +191,60 @@ pnpm buildandstart:glocal
The structure of the `pages` folder is mimicked inside `components`. Components specific to a page can be found in the the `components` folder, in the folder corresponding to that page.

Components that are used in multiple places will be found in the top level of the `components` folder.

## Common Errors

### Node.js version and other requirements

Most installation errors are due to `Node.js`, `pnpm`, `yarn` or `docker-compose` versions. Verify the [requirements](../../README.md#requirements) if you encounter an error. To verify, you can execute:

```bash
node --version
v18.20.4
```

```bash
pnpm --version
9.4.0
```

```bash
yarn --version
1.22.22
```

```bash
docker-compose --version
docker-compose version 1.29.2, build 5becea4c
```

### EACCES: permission denied, unlink

If you encounter this error:

```bash
[Error: EACCES: permission denied, unlink '/home/rapha/studio/linea/ens/linea-ens/packages/linea-ens-app/data/ipfs/api'] {
errno: -13,
code: 'EACCES',
syscall: 'unlink',
path: '/home/rapha/studio/linea/ens/linea-ens/packages/linea-ens-app/data/ipfs/api'
}
```

To fix it, you can safely remove `data` in `./packages/linea-ens-app/data`.

### Linea PoH Status: INVALID

If your address doesn't have a PoH, for testing purpose you can temporally deactivate the PoH verification:

1. Edit `linea-ens/packages/poh-signer-api/src/modules/poh/poh.service.ts`.

2. Comment `if` statement on L.30, like:

```
// if (!pohResponse.poh) {
// throw new Error('address not POH');
// }
```

But you cannot use an address twice, you have to change address for each new registration.
2 changes: 1 addition & 1 deletion services/web3signer/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SERVICE := ENS WEB3SIGNER
NETWORK_NAME := ens-resolver
NETWORK_NAME := ens-network
SHOW_DOCKER_HELP := true

include .makefiles/help.mk
Expand Down
2 changes: 1 addition & 1 deletion services/web3signer/keyFiles/examples/signer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ type: "file-raw"
keyType: "SECP256K1"
# WARNING: FOR LOCAL DEV ONLY - DO NOT REUSE THESE KEYS ELSEWHERE
# Key for aggregation finalization
privateKey: "59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
privateKey: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"

0 comments on commit cf9fb37

Please sign in to comment.