|
1 | | -<p align="center"> |
2 | | - <a href="https://flare.network/" target="blank"><img src="https://flare.network/wp-content/uploads/Artboard-1-1.svg" width="400" height="300" alt="Flare Logo" /></a> |
3 | | -</p> |
| 1 | +<!-- LOGO --> |
| 2 | +<div align="center"> |
| 3 | + <a href="https://flare.network/" target="blank"> |
| 4 | + <img src="https://content.flare.network/Flare-2.svg" width="300" alt="Flare Logo" /> |
| 5 | + </a> |
| 6 | + <br /> |
| 7 | + <a href="CONTRIBUTING.md">Contributing</a> |
| 8 | + · |
| 9 | + <a href="SECURITY.md">Security</a> |
| 10 | + · |
| 11 | + <a href="CHANGELOG.md">Changelog</a> |
| 12 | +</div> |
4 | 13 |
|
5 | | -# Verifier server API implementation |
| 14 | +# FDC Attestation Verifier |
6 | 15 |
|
7 | | -One can run the Verifier API service on three different sources: |
| 16 | +A microservice in the Flare Data Connector (FDC) suite responsible for verifying and executing attestation requests and |
| 17 | +providing ABI-encoded responses. |
8 | 18 |
|
9 | | -- **BTC** / testBTC |
10 | | -- **XRP** / testXRP |
11 | | -- **DOGE** / testDOGE |
| 19 | +It can be configured to run one of the supported attestation type and source combination verifications. |
12 | 20 |
|
13 | | -For the API to function correctly, the service must be connected to the corresponding PostgreSQL database, which is populated using the appropriate indexing solution (e.g., BTC Indexer for BTC API Service). |
| 21 | +See documentation for more attestation type details: https://dev.flare.network/fdc/attestation-types/ |
14 | 22 |
|
15 | | -## Local Installation |
| 23 | +## Blockchain data attestations |
16 | 24 |
|
17 | | -Make sure you're using the Node version specified in the `.nvmrc` file. We recommend using `nvm` to manage your local Node installations. Additionally, ensure that `yarn` is installed and enabled. |
| 25 | +Supported attestation types: |
18 | 26 |
|
19 | | -Install the dependencies |
| 27 | +- `AddressValidity` |
| 28 | +- `Payment` |
| 29 | +- `BalanceDecreasingTransaction` |
| 30 | +- `ReferencedPaymentNonexistence` |
| 31 | +- `ConfirmedBlockHeightExists` |
20 | 32 |
|
21 | | -```bash |
22 | | -$ yarn install |
23 | | -``` |
| 33 | +Supported sources: |
| 34 | +- Mainnet: `BTC`, `DOGE`, `XRPL` |
| 35 | +- Testnet: `testBTC`, `testDOGE`, `testXRP` |
24 | 36 |
|
25 | | -## Configuration |
| 37 | +For these attestation types the verifier requires access to blockchain indexers writing to PostgreSQL backends (fully synced to the target network). |
26 | 38 |
|
27 | | -Copy `.env.example` to `.env` and fill the required configuration. |
| 39 | +## Web2 data attestations |
28 | 40 |
|
29 | | -## Running the app |
| 41 | +Supported attestation type: `Web2Json` |
30 | 42 |
|
31 | | -To start app run |
| 43 | +Supported sources: |
| 44 | +- Mainnet: [web2-json-sources.ts](src/config/web2/web2-json-sources.ts) |
| 45 | +- Testnet: [web2-json-test-sources.ts](src/config/web2/web2-json-test-sources.ts) |
32 | 46 |
|
33 | | -```bash |
34 | | -# development |
35 | | -$ yarn run start |
36 | | - |
37 | | -# watch mode |
38 | | -$ yarn run start:dev |
39 | | -``` |
40 | | - |
41 | | -## Testing with postgresql dump |
42 | | - |
43 | | -Download the database instances from the following links and move them to `/e2e_tests/db/`: |
44 | | - |
45 | | -- [BTC Testnet Database](https://githubstatic.flare.center/db_btc_testnet) as `db_btc_testnet` |
46 | | -- [BTC2 Testnet Database](https://githubstatic.flare.center/db_btc2_testnet) as `db_btc2_testnet` |
47 | | -- [DOGE Testnet Database](https://githubstatic.flare.center/db_doge_testnet) as `db_doge_testnet` |
48 | | -- [XRP Testnet Database](https://githubstatic.flare.center/db_xrp_testnet) as `db_xrp_testnet` |
49 | | -- [XRP2 Testnet Database](https://githubstatic.flare.center/db_xrp2_testnet) as `db_xrp2_testnet` |
50 | | - |
51 | | -or simply run |
52 | | - |
53 | | -```bash |
54 | | -yarn test download |
55 | | -``` |
56 | | - |
57 | | -Currently, all databases are from testnets. |
58 | | - |
59 | | -### Option 1: Running Tests Against a Database Instance |
60 | | - |
61 | | -To run all tests across all sources or check code coverage, use the following commands: |
62 | | - |
63 | | -```bash |
64 | | -yarn test run |
65 | | -yarn test coverage |
66 | | -``` |
67 | | - |
68 | | -### Option 2: Spinning Up a Database from a Dump and Persisting It |
69 | | - |
70 | | -Depending on your source, create a database instance using the following command: |
71 | | - |
72 | | -```bash |
73 | | -yarn test make_db btc |
74 | | -``` |
75 | | - |
76 | | -Once the database is up and running, you can start a local server and manually send requests. For this setup, set the following environment variables to your `.env` file: |
77 | | - |
78 | | -```bash |
79 | | -# .env file |
80 | | -DB_DATABASE=db |
81 | | -DB_USERNAME=user |
82 | | -DB_PASSWORD=pass |
83 | | -DB_HOST=127.0.0.1 |
84 | | -DB_PORT=8080 |
85 | | -``` |
86 | | - |
87 | | -Additionally, set the appropriate values for `VERIFIER_TYPE` and `TESTNET`: |
88 | | - |
89 | | -```bash |
90 | | -VERIFIER_TYPE=btc |
91 | | -TESTNET=true |
92 | | -``` |
93 | | - |
94 | | -When you're finished, remember to stop the database server with: |
95 | | - |
96 | | -```bash |
97 | | -yarn test delete_db |
98 | | -``` |
| 47 | +Web2 data attestations fetch and transform JSON data from HTTP(S) endpoints using jq queries. Allowed endpoints are defined by the source configuration files above. |
0 commit comments