|
1 |
| -# CCIP-Read-DNS-Gateway: Your Gasless DNSSEC Support |
| 1 | +# CCIP-Read-DNS-Gateway |
2 | 2 |
|
3 |
| -Welcome aboard the CCIP-Read-DNS-Gateway! This isn't just any gateway, it's a special server that provides DNS resolution services for ENS domains, with a focus on gasless DNSSEC support. |
| 3 | +## Overview |
4 | 4 |
|
5 |
| -## Inside the Gateway |
| 5 | +CCIP-Read-DNS-Gateway is a specialized server providing DNS resolution services for ENS domains with a focus on gasless DNSSEC support. It leverages the CCIP-Read protocol to offer efficient, off-chain DNS resolution and DNSSEC validation. |
6 | 6 |
|
7 |
| -Let's take a quick look at what makes this gateway tick: |
| 7 | +## Core Components |
8 | 8 |
|
9 |
| -- `index.ts`: This is the starting point for our application. It sets up the DNS prover with a specified DoH gateway URL and gets the server up and running. |
| 9 | +- `index.ts`: Express server for handling incoming requests. Mostly suitable for self-hosting or cloud development. |
| 10 | +- `worker.ts`: Cloudflare worker script for handling incoming requests in a (Cloudflare Worker) serverless environment. |
10 | 11 |
|
11 |
| -- `app.ts`: This is where the server gets its instructions. It sets up the server with the necessary routes and handlers, and uses the `@ensdomains/dnsprovejs` library to perform DNS queries and proofs. |
| 12 | +- `app.ts`: Configures server routes and handlers. Utilizes the `@ensdomains/dnsprovejs` library for DNS queries and proof generation. |
12 | 13 |
|
13 |
| -- `worker.ts`: This is our diligent Cloudflare worker, ready to handle incoming requests and direct them to the appropriate handlers. Useful for [getting started fast](#gateway-server). |
| 14 | +## Installation |
14 | 15 |
|
15 |
| -## Ready to Get Started? |
| 16 | +```bash |
| 17 | +git clone https://github.com/your-repo/ccip-read-dns-gateway.git |
| 18 | +cd ccip-read-dns-gateway |
| 19 | +npm install |
| 20 | +``` |
16 | 21 |
|
17 |
| -### I will run in local |
| 22 | +## Configuration |
18 | 23 |
|
19 |
| -To run this server locally, you'll need to provide a DoH (DNS over HTTPS) gateway URL. Set the DOH_GATEWAY_URL environment variable and you're all set! The server will use this gateway to perform DNS queries. |
| 24 | +Set the `DOH_GATEWAY_URL` environment variable to specify your DNS-over-HTTPS gateway: |
20 | 25 |
|
21 |
| -Once you're ready, just run the index.ts file. You'll be up and running on port 8080 (default). |
| 26 | +```bash |
| 27 | +export DOH_GATEWAY_URL=https://your-doh-gateway.com/dns-query |
| 28 | +``` |
22 | 29 |
|
23 |
| -### I will run as Cloudflare Worker |
| 30 | +## Usage |
24 | 31 |
|
25 |
| -If you want to run this as a Cloudflare Worker, the process is slightly different, but still super easy. |
| 32 | +### Local Development |
26 | 33 |
|
27 |
| -First, you'll need to install wrangler on your machine. You can do this by following the instructions [here](https://developers.cloudflare.com/workers/wrangler/install-and-update/#install-wrangler-globally). |
| 34 | +To run the server locally: |
28 | 35 |
|
29 |
| -Once wrangler is installed, use wrangler login to configure your account. |
| 36 | +```bash |
| 37 | +npm start |
| 38 | +``` |
30 | 39 |
|
31 |
| -Next, navigate to the wrangler.toml file and update the DOH_GATEWAY_URL environment variable with the DoH server you want to use. |
| 40 | +The server will start on `http://localhost:8080` by default. |
32 | 41 |
|
33 |
| -Finally, run `wrangler publish` and voila! Your Cloudflare worker is up and running. Easy peasy! |
| 42 | +### Cloudflare Worker Deployment |
34 | 43 |
|
35 |
| -## Our Companions |
| 44 | +1. Install Wrangler CLI: |
| 45 | + ```bash |
| 46 | + npm install -g @cloudflare/wrangler |
| 47 | + ``` |
36 | 48 |
|
37 |
| -We've got some great companions on this journey: |
| 49 | +2. Authenticate with your Cloudflare account: |
| 50 | + ```bash |
| 51 | + wrangler login |
| 52 | + ``` |
38 | 53 |
|
39 |
| -- [`@ensdomains/dnsprovejs`](https://github.com/ensdomains/dnsprovejs): Our reliable ally for DNS proofs. |
40 |
| -- [`@chainlink/ccip-read-server`](https://github.com/smartcontractkit/ccip-read): Sets the stage for a CCIP read server. |
| 54 | +3. Update `wrangler.toml` with your DoH gateway URL: |
| 55 | + ```toml |
| 56 | + [vars] |
| 57 | + DOH_GATEWAY_URL = "https://your-doh-gateway.com/dns-query" |
| 58 | + ``` |
41 | 59 |
|
42 |
| -Remember, this is just a quick overview. For a deeper understanding, feel free to explore the source code. Happy coding! |
| 60 | +4. Deploy the worker: |
| 61 | + ```bash |
| 62 | + wrangler publish |
| 63 | + ``` |
| 64 | + |
| 65 | +## API Endpoints |
| 66 | + |
| 67 | +- `GET /`: Health check endpoint |
| 68 | +- `POST /`: Main endpoint for DNS resolution and proof generation |
| 69 | + |
| 70 | +## Dependencies |
| 71 | + |
| 72 | +- [`@ensdomains/dnsprovejs`](https://github.com/ensdomains/dnsprovejs): Library for DNS proof generation and validation |
| 73 | +- [`@chainlink/ccip-read-server`](https://github.com/smartcontractkit/ccip-read): Framework for implementing CCIP-Read servers |
| 74 | + |
| 75 | +## License |
| 76 | + |
| 77 | +MIT |
| 78 | + |
| 79 | +## Support |
| 80 | + |
| 81 | +For support, please open an issue in the GitHub repository or contact our support team at support@ens.domains. |
0 commit comments