Skip to content

Commit da0d29c

Browse files
authored
fix(docs): add getting started for fdc (#562)
2 parents 5f7a3a2 + adc77f1 commit da0d29c

24 files changed

+11358
-9547
lines changed

docs/fdc/1-overview.mdx

Lines changed: 66 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
---
22
sidebar_position: 1
33
slug: overview
4-
title: FDC
4+
title: FDC Overview
5+
authors: [lukaavbreht, filipkoprivec]
6+
description: The Flare Data Connector (FDC) enables secure, on-chain attestation of external data.
7+
tags: [intermediate, ethereum, fdc]
8+
keywords: [ethereum, flare-data-connector, evm, flare-network]
9+
unlisted: false
510
---
611

712
import ThemedImage from "@theme/ThemedImage";
813
import useBaseUrl from "@docusaurus/useBaseUrl";
914

10-
The **F**lare **D**ata **C**onnector **(FDC)** is an [enshrined oracle](/support/terminology#enshrined-oracle) designed to validate external data for Flare's EVM state.
15+
The **Flare Data Connector (FDC)** is an [enshrined oracle](/support/terminology#enshrined-oracle) designed to validate external data for Flare's EVM state.
1116
It allows users to submit attested data that smart contracts can trust, eliminating the need for direct reliance on users for data integrity.
1217

13-
- **Network-level security:** Data attestation requires reaching a 50%+ signature weight from data providers, ensuring decentralized consensus.
14-
- **Efficient onchain storage:** Verified data is represented in a Merkle tree, with only the Merkle root stored on-chain. This minimizes storage costs while preserving data integrity.
15-
- **Easy offchain accessibility:** Data providers serve attestation responses and Merkle proofs offchain through a Data Availability (DA) Layer, enabling efficient data retrieval without sacrificing trust.
16-
- **Proof-based verification:** Smart contracts validate Merkle proofs against the stored Merkle root, ensuring that only authentic data can trigger contract actions.
17-
- **Extensible attestation types:** Support for new attestation types and data sources can be added through provider consensus, ensuring the FDC remains adaptable to evolving data needs.
18+
## Key Features
19+
20+
- **Network-Level Security**: Data attestation requires reaching a 50%+ signature weight from data providers, ensuring decentralized consensus.
21+
- **Efficient On-chain Storage**: Verified data is stored in a Merkle tree, with only the Merkle root stored on-chain to minimize costs.
22+
- **Easy Off-chain Accessibility**: Data providers serve attestation responses and Merkle proofs off-chain through a Data Availability (DA) Layer, ensuring efficient data retrieval.
23+
- **Proof-Based Verification**: Smart contracts validate Merkle proofs against the stored Merkle root, ensuring only authentic data triggers contract actions.
24+
- **Extensible Attestation Types**: New attestation types and data sources can be added through provider consensus, ensuring adaptability.
1825

1926
## Architecture
2027

@@ -26,65 +33,83 @@ It allows users to submit attested data that smart contracts can trust, eliminat
2633
}}
2734
/>
2835

29-
1. **Data Verification:** The FDC verifies user-submitted attestation requests.
30-
2. **Merkle Representation:** Verified responses are organized into a Merkle tree. Only the Merkle root is stored on-chain.
31-
3. **Attestation Usage:** Users retrieve attestation responses and Merkle proofs from data providers and submit them to smart contracts.
36+
1. **Data Verification**: The FDC verifies user-submitted attestation requests.
37+
2. **Merkle Representation**: Verified responses are organized into a Merkle tree, with only the Merkle root stored on-chain.
38+
3. **Attestation Usage**: Users retrieve attestation responses and Merkle proofs from data providers and submit them to smart contracts.
3239

3340
:::tip[Interested in learning more?]
34-
3541
For a detailed explanation of the FDC mechanism, read the [FDC whitepaper](https://flare.network/wp-content/uploads/FDC_WP_171024_02.pdf).
36-
3742
:::
3843

3944
### Data Availability Layer
4045

41-
The Data Availability (DA) Layer provides API endpoints for querying offchain attestation data. Accessing this data is trustless, as users can independently compute and compare Merkle roots against the on-chain version.
46+
The Data Availability Layer (DA Layer) provides API endpoints for querying off-chain attestation data.
47+
Accessing this data is trustless, as users can independently compute and compare Merkle roots against the on-chain version.
4248

43-
Operating a DA Layer is permissionless, Anyone can run a DA Layer service by sourcing data from an [FTSOv2 data provider](/run-node/ftso-data-provider) and [FDC attestation provider](/run-node/fdc-attestation-provider).
49+
Operating a DA Layer is permissionless—anyone can run a DA Layer service by sourcing data from an [FTSOv2 data provider](/run-node/ftso-data-provider) and [FDC attestation provider](/run-node/fdc-attestation-provider).
4450

4551
<ThemedImage
46-
alt="FTSO Price Comparison"
52+
alt="DA Layer Diagram"
4753
sources={{
4854
light: useBaseUrl("img/fdc-overview/da_layer_light.svg"),
4955
dark: useBaseUrl("img/fdc-overview/da_layer_dark.svg"),
5056
}}
5157
/>
5258

53-
## Workflows Overview
59+
## Attestation Types
60+
61+
FDC currently supports seven attestation types, each serving specific verification needs. Below is an overview of these types, with detailed explanations available in their respective sections:
62+
63+
- **AddressValidity**: Validates the format and checksum of addresses on specified chains.
64+
- **EVMTransaction**: Verifies and retrieves transaction details from EVM-compatible chains (`ETH`, `FLR`, `SGB`).
65+
- **JsonApi**: Fetches and processes any Web2 data using a JQ transformation, then returns it as ABI-encoded output. (Currently only on Coston & Coston2).
66+
- **Payment**: Confirms and fetches payment transaction details from non-EVM chains (`BTC`, `DOGE`, `XRP`).
67+
- **ConfirmedBlockHeightExists**: Verifies block existence and confirmation status.
68+
- **BalanceDecreasingTransaction**: Validates if a transaction reduces an address's balance.
69+
- **ReferencedPaymentNonexistence**: Confirms the absence of specific payments within time intervals.
70+
71+
The first three attestation types are the most generally useful, while the last three are primarily used in **FAssets**.
72+
73+
## Workflow Overview
74+
75+
For all attestation types, the workflow follows the same general steps.
76+
Due to the waiting period between steps **2** and **3**, where the round is finalized, the process is split into multiple sections.
5477

5578
### General Workflow
5679

57-
1. **Request Submission:** Users submit requests to the [`FdcHub`](/fdc/reference/IFdcHub) smart contract.
58-
2. **Batch Processing:** Data providers group requests by emission timestamps.
59-
3. **Data Retrieval:** Providers fetch and format responses, creating a Merkle tree of hashed responses.
60-
4. **Consensus Storage:** Once signatures representing 50%+ weight are collected, the Merkle root is submitted to the [`Relay`](/network/fsp/solidity-reference/IRelay) contract.
61-
5. **Proof Retrieval:** Users fetch attestation responses and proofs from the DA Layer.
62-
6. **Verification and Action:** Smart contracts verify proofs and use the attested data if valid.
80+
1. **Request Submission**: Users submit attestation requests to the [`FdcHub`](/fdc/reference/IFdcHub) smart contract.
81+
2. **Batch Processing**: Data providers group requests based on emission timestamps.
82+
3. **Data Retrieval**: Providers fetch and format responses, creating a Merkle tree of hashed responses.
83+
4. **Consensus Storage**: Once signatures representing 50%+ weight are collected, the Merkle root is submitted to the [`Relay`](/network/fsp/solidity-reference/IRelay) contract.
84+
5. **Proof Retrieval**: Users fetch attestation responses and proofs from the DA Layer.
85+
6. **Verification and Action**: Smart contracts verify proofs and use the attested data if valid.
6386

6487
### User Workflow
6588

66-
1. **Identify Data Needs:** Determine the required attestation type and data source.
67-
2. **Prepare Request:** Format the request with the expected response hash (MIC).
68-
3. **Submit Request:** Use [`requestAttestation`](/fdc/reference/IFdcHub#requestattestation) from `FdcHub` and pay the base fee (fee varies by attestation type).
69-
4. **Track Submission:** Record the block timestamp and calculate the voting round.
70-
5. **Wait for Finalization:** Wait for the voting round to conclude. A relay contract event signals finalization.
71-
6. **Fetch Data:** Retrieve responses and proofs from the DA Layer.
72-
7. **Submit to Smart Contract:** Provide responses and proofs for verification.
89+
1. **Identify Data Needs**: Determine the required attestation type and data source.
90+
2. **Prepare Request**: Format the request with the expected response hash (MIC).
91+
3. **Submit Request**: Use [`requestAttestation`](/fdc/reference/IFdcHub#requestattestation) from `FdcHub` and pay the required fee.
92+
4. **Track Submission**: Record the block timestamp and calculate the voting round.
93+
5. **Wait for Finalization**: The voting round concludes, and a relay contract event signals finalization.
94+
6. **Fetch Data**: Retrieve responses and proofs from the DA Layer.
95+
7. **Submit to Smart Contract**: Provide responses and proofs for verification.
7396

7497
### Smart Contract Workflow
7598

76-
1. **Define Triggers:** Define data events that trigger specific actions.
77-
2. **Receive Data:** Accept responses and proofs from users.
78-
3. **Verify Proofs:** Use the [`FdcVerification`](/fdc/reference/IFdcVerification) contract to validate the response against the Merkle root.
79-
4. **Act on Data:** Use the verified data for decision-making or computation.
99+
1. **Define Triggers**: Establish data-driven triggers.
100+
2. **Receive Data**: Accept attestation responses and proofs from users.
101+
3. **Verify Proofs**: Use the [`FdcVerification`](/fdc/reference/IFdcVerification) contract to validate the response against the Merkle root.
102+
4. **Act on Data**: Utilize the verified data for computation or decision-making.
80103

81104
### Data Provider Workflow
82105

83-
1. **Collect Requests:** Group requests by emission timestamps.
84-
2. **Retrieve Data:** Fetch responses from verifier servers.
85-
3. **Validate Responses:** Ensure data validity using MIC and LUT checks.
86-
4. **Submit BitVectors:** Indicate valid requests using BitVectors during the "choose phase" (90-135 seconds into the round).
87-
5. **Achieve Consensus:** Aggregate BitVectors to form a consensus BitVector.
88-
6. **Create Merkle Tree:** Build a Merkle tree from validated responses.
89-
7. **Sign and Submit:** Collect signatures representing 50%+ weight and submit the Merkle root to the [`Relay`](/network/fsp/solidity-reference/IRelay) contract.
90-
8. **Serve Data:** Provide attestation responses and proofs through the DA Layer.
106+
1. **Collect Requests**: Group requests by emission timestamps.
107+
2. **Retrieve Data**: Fetch responses from verifier servers.
108+
3. **Validate Responses**: Ensure data validity using MIC and LUT checks.
109+
4. **Submit BitVectors**: Indicate valid requests using BitVectors during the "choose phase" (90-135 seconds into the round).
110+
5. **Achieve Consensus**: Aggregate BitVectors to form a consensus BitVector.
111+
6. **Create Merkle Tree**: Construct a Merkle tree from validated responses.
112+
7. **Sign and Submit**: Collect signatures representing 50%+ weight and submit the Merkle root to the [`Relay`](/network/fsp/solidity-reference/IRelay) contract.
113+
8. **Serve Data**: Provide attestation responses and proofs via the DA Layer.
114+
115+
The **Flare Data Connector (FDC)** is a critical infrastructure component for the Flare ecosystem, enabling smart contracts to access **secure, attested external data** while maintaining trustless verification through **Merkle proofs**. By integrating the FDC, developers can create more **reliable, decentralized applications** across multiple blockchains.

0 commit comments

Comments
 (0)