From d85754586d126df120631a3c494db69c7f32c7ac Mon Sep 17 00:00:00 2001 From: Yolan Romailler Date: Tue, 16 Jan 2024 15:06:51 +0100 Subject: [PATCH] Adding testnet doc and misc changes (#191) * Adding grpc check to avoid having specific rules for each endpoint and chain Signed-off-by: Yolan Romailler * Adding testnet documentation Signed-off-by: Yolan Romailler * Apply suggestions from code review Co-authored-by: PM <3749956+CluEleSsUK@users.noreply.github.com> --------- Signed-off-by: Yolan Romailler Co-authored-by: PM <3749956+CluEleSsUK@users.noreply.github.com> --- docs/developer/README.md | 9 ++++++--- docs/developer/http-api.md | 17 +++++++++++++++++ docs/operator/deploy.md | 33 ++++++++++++++++----------------- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/docs/developer/README.md b/docs/developer/README.md index 240ad60b..edf53313 100644 --- a/docs/developer/README.md +++ b/docs/developer/README.md @@ -21,13 +21,13 @@ There are two networks on mainnet: - `default` which is running the chained scheme with public keys on G1 - `quicknet` which is running the unchained scheme with public keys on G2 -`default` network chain hash: +`default` network chain hash: ```8990e7a9aaed2ffed73dbd7092123d6f289930540d7651336225dc172e51b2ce``` -`quicknet` network chain hash: +`quicknet` network chain hash: ```52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971``` -Note that [the `fastnet` network has been deprecated.](/blog/2023/07/03/fastnet-sunset-quicknet-new/). +Note that [the `fastnet` network has been deprecated](/blog/2023/07/03/fastnet-sunset-quicknet-new/). In order to retrieve randomness from a drand network you should **preferentially use the [drand client libraries](/developer/clients/) or the [drand-client CLI](/developer/drand-client/)**, which support the different mechanisms and perform verification for every value obtained. @@ -36,3 +36,6 @@ Alternatively, you can interact directly with the endpoints. Make sure to manual - [HTTP API reference](/developer/http-api/) - [Pubsub-based randomness distribution](/developer/gossipsub/) - gRPC API: usually not publicly accessible. A gRPC API is supported by the drand client libraries, the `drand-client` CLI application and the [drand application](/operator/drand-cli/) itself (using `drand get public`). + +Finally, for development purposes, we recommend also testing your code against our Testnet endpoints. +See [our dedicated documentation entry about testnet endpoints](/developer/http-api/#testnet-endpoints). diff --git a/docs/developer/http-api.md b/docs/developer/http-api.md index f7b599eb..c513b180 100644 --- a/docs/developer/http-api.md +++ b/docs/developer/http-api.md @@ -35,6 +35,23 @@ The chain hash for the League of Entropy `quicknet` network running at a 3s freq Note that [the `fastnet` network has been deprecated.](/blog/2023/07/03/fastnet-sunset-quicknet-new/). +### Testnet endpoints + +Furthermore, we have "testnet endpoints" which are a completely separate environment for testing our latest changes, potentially helping you detect breaking changes or issues with our latest release before they hit mainnet. +We recommend running your CI/CD against our testnet endpoints as well as our mainnet ones, in order to detect issues early. + +We currently have 3 testnet HTTP(S) endpoints being run by: +- Protocol Labs + - [https://pl-us.testnet.drand.sh/chains](https://pl-us.testnet.drand.sh/chains) + - [https://pl-eu.testnet.drand.sh/chains](https://pl-eu.testnet.drand.sh/chains) +- Cloudflare + - [https://testnet-api.drand.cloudflare.com/chains](https://testnet-api.drand.cloudflare.com/chains) + +As you can see, they are currently running various chains as explained below. +We are committed to maintaining the `default`, G2 based, chained testnet chain (`84b2234fb34e835dccd048255d7ad3194b81af7d978c3bf157e3469592ae4e02`) as well as the faster, G1 based, unchained `quicknet-t` testnet chain (`cc9c398442737cbd141526600919edd69f1d6f9b4adb67e4d912fbc64341a9a5`) as long as we run the equivalent mainnet networks. + +Other testnet chains, such as our first "unchained" testnet (`7672797f548f3f4748ac4bf3352fc6c6b6468c9ad40ad456a397545c6e2df5bf`) or our first G1 based non-RFC compliant chain (`f3827d772c155f95a9fda8901ddd59591a082df5ac6efe3a479ddb1f5eeb202c`) may be deprecated in the future. + ## `/chains` Retrieves the _chain hash_ of every running network a user can interact with. It returns a JSON object with the following structure: diff --git a/docs/operator/deploy.md b/docs/operator/deploy.md index ab955158..28de1945 100644 --- a/docs/operator/deploy.md +++ b/docs/operator/deploy.md @@ -79,23 +79,22 @@ Running drand behind a reverse proxy is the **default** method of deploying dran ```nginx # /etc/nginx/sites-available/default server { - server_name drand.example.xyz; - listen 443 ssl http2; - - location / { - grpc_pass grpc://localhost:4444; - grpc_set_header X-Real-IP $remote_addr; - } - - location /public/ { - proxy_pass http://localhost:8080; - proxy_set_header Host $host; - } - location /info { - proxy_pass http://localhost:8080; - proxy_set_header Host $host; - } - # Add ssl certificates by running certbot --nginx + server_name drand.example.xyz; + listen 443 ssl http2; + + location / { + # Check for gRPC header + if ($http_content_type = "application/grpc") { + grpc_pass grpc://localhost:4444; + grpc_set_header X-Real-IP $remote_addr; + } + + # If not gRPC, treat as regular HTTP + proxy_pass http://localhost:8080; + proxy_set_header Host $host; + } + + # Add ssl certificates by running certbot --nginx } ```