Skip to content

Commit fd57ede

Browse files
fix(docs): minor changes match other two types
1 parent b1dd4d2 commit fd57ede

File tree

2 files changed

+73
-62
lines changed

2 files changed

+73
-62
lines changed

docs/fdc/guides/check-address-validity.mdx

Lines changed: 56 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ unlisted: false
1010

1111
The [AddressValidity](/fdc/attestation-types/address-validity) attestation type validates whether a string represents a valid address on supported blockchain networks (`BTC`, `DOGE`, and `XRP`).
1212
This validation ensures addresses meet chain-specific formatting and checksum requirements before they're used in transactions or smart contracts.
13-
The full specification is available on the official [specification repo](https://github.com/flare-foundation/flare-specs/blob/main/src/FDC/AttestationTypes/AddressValidity.md).
13+
The full specification is available on the official [specification repo](/fdc/attestation-types/address-validity).
1414

1515
The primary contract interface for this attestation type is [`IAddressValidity`](/fdc/reference/IFdcHub). Let's walk through validating a Bitcoin testnet address using the FDC protocol.
1616
We will use the address `mg9P9f4wr9w7c1sgFeiTC5oMLYXCc2c7hs` as an example throughout this guide.
@@ -58,7 +58,7 @@ The names of included contracts mostly mirror the steps described in the [FDC ov
5858
To bridge the separate script executions, we will save the relevant data of each script to a file in the `dirPath` folder.
5959
Each succeeding script will then read that file to load the data.
6060

61-
## Preparing the Request
61+
## Prepare request
6262

6363
A JSON request to the verifier follows the same structure for all attestation types, with field values varying per type.
6464

@@ -74,7 +74,7 @@ For `AddressValidity`, `requestBody` contains a single field:
7474

7575
### Reference Documentation
7676

77-
- [AddressValidity Specification](https://gitlab.com/flarenetwork/docs-team/flare-specs/-/blob/main/src/FDC/AttestationTypes/AddressValidity.md?ref_type=heads)
77+
- [AddressValidity Specification](/fdc/attestation-types/address-validity)
7878
- [Verifier Interactive Docs](https://fdc-verifiers-testnet.flare.network/verifier/btc/api-doc#/AddressValidity/BTCAddressValidityVerifierController_prepareRequest)
7979
- API available for [DOGE](https://fdc-verifiers-testnet.flare.network/verifier/doge/api-doc#/AddressValidity/BTCAddressValidityVerifierController_prepareRequest) and [XRP](https://fdc-verifiers-testnet.flare.network/verifier/xrp/api-doc#/AddressValidity/BTCAddressValidityVerifierController_prepareRequest).
8080

@@ -273,7 +273,7 @@ forge script script/fdcExample/AddressValidity.s.sol:PostRequest --private-key $
273273
The prerequisite for this is that the `.env` file is not missing the `PRIVATE KEY` and `COSTON2_RPC_URL` values.
274274
The script can also access other chains; that can be achieved by replacing the `--rpc-url` value with `COSTON_RPC_URL`, `FLARE_RPC_URL`, or `SONGBIRD_RPC_URL`.
275275

276-
## Posting the Request to a Verifier Server
276+
## Post request to verifier
277277

278278
Before submitting address validation requests to the FDC protocol, we first need to prepare and send them to a verifier server.
279279
This section walks through the request submission process using the `surl` package.
@@ -355,25 +355,25 @@ Let's break it down line by line:
355355

356356
What this demonstrates is that, with some effort, the `abiEncodedRequest` can be constructed manually.
357357

358-
## Submitting the Request to the FDC
358+
## Submit request to FDC
359359

360360
This step transitions from off-chain request preparation to on-chain interaction with the FDC protocol. Now, we submit the validated request to the blockchain using deployed smart contracts.
361361

362-
### Submitting the Request
362+
### Submit request
363363

364364
The entire submission process requires only five key steps:
365365

366366
```solidity title="script/fdcExample/Base.s.sol"
367367
function submitAttestationRequest(
368-
AttestationResponse memory response
368+
bytes memory abiEncodedRequest
369369
) internal {
370370
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
371371
vm.startBroadcast(deployerPrivateKey);
372372
373373
IFdcRequestFeeConfigurations fdcRequestFeeConfigurations = ContractRegistry
374374
.getFdcRequestFeeConfigurations();
375375
uint256 requestFee = fdcRequestFeeConfigurations.getRequestFee(
376-
response.abiEncodedRequest
376+
abiEncodedRequest
377377
);
378378
console.log("request fee: %s\n", requestFee);
379379
vm.stopBroadcast();
@@ -385,15 +385,15 @@ function submitAttestationRequest(
385385
console.log(address(fdcHub));
386386
console.log("\n");
387387
388-
fdcHub.requestAttestation{value: requestFee}(response.abiEncodedRequest);
388+
fdcHub.requestAttestation{value: requestFee}(abiEncodedRequest);
389389
vm.stopBroadcast();
390390
}
391391
```
392392

393393
### Step-by-Step Breakdown
394394

395395
1. Load Private Key
396-
The private key is read from the `.env` file using Foundrys `envUint` function:
396+
The private key is read from the `.env` file using Foundry's `envUint` function:
397397

398398
```solidity
399399
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
@@ -430,7 +430,7 @@ function submitAttestationRequest(
430430
fdcHub.requestAttestation{value: requestFee}(response.abiEncodedRequest);
431431
```
432432

433-
5. Calculate Voting Round Number
433+
5. Calculate the Voting Round Number
434434
To determine the voting round in which the attestation request is processed, we query the `FlareSystemsManager` contract:
435435

436436
```solidity
@@ -445,7 +445,7 @@ function submitAttestationRequest(
445445

446446
This can be done within the existing broadcast or in a new one (as done in the demo repository for better code organization).
447447

448-
## Waiting for the response
448+
## Wait for response
449449

450450
We wait for the round to finalize.
451451
This takes no more than 90 seconds.
@@ -455,9 +455,9 @@ To check if the round has been finalized, go to [Finalizations](https://coston2-
455455

456456
If you want to learn more about how the FDC protocol works, check [here](/fdc/overview).
457457

458-
## Preparing proof request
458+
## Prepare proof request
459459

460-
We prepare the proof request in a similar manner as in the step Preparing the request, by string concatenation.
460+
We prepare the proof request in a similar manner as in the step Prepare the request, by string concatenation.
461461
We import two new variables from the `.env` file; the URL of a verifier server and the corresponding API key.
462462
note
463463

@@ -480,39 +480,51 @@ contract RetrieveDataAndProof is Script {
480480
using Surl for *;
481481
482482
function run() external {
483-
string memory daLayerUrl = vm.envString("COSTON2_DA_LAYER_URL");
484-
string memory apiKey = vm.envString("X_API_KEY");
485-
string memory fileName = string.concat(attestationTypeName, ".txt");
486-
string memory filePath = string.concat(dirPath, fileName);
487-
488-
// We import the roundId and abiEncodedRequest from the first file
489-
string memory votingRoundId = vm.readLine(filePath);
490-
string memory requestBytes = vm.readLine(filePath);
491-
console.log("votingRoundId: %s\n", votingRoundId);
492-
console.log("requestBytes: %s\n", requestBytes);
493-
494-
// Preparing the proof request
495-
string[] memory headers = prepareHeaders(apiKey);
496-
string memory body = string.concat(
497-
'{"votingRoundId":',
498-
votingRoundId,
499-
',"requestBytes":"',
500-
requestBytes,
501-
'"}'
502-
);
503-
console.log("body: %s\n", body);
504-
console.log(
505-
"headers: %s",
506-
string.concat("{", headers[0], ", ", headers[1]),
507-
"}\n"
508-
);
483+
string memory daLayerUrl = vm.envString("COSTON2_DA_LAYER_URL");
484+
string memory apiKey = vm.envString("X_API_KEY");
485+
486+
string memory requestBytes = vm.readLine(
487+
string.concat(
488+
dirPath,
489+
attestationTypeName,
490+
"_abiEncodedRequest",
491+
".txt"
492+
)
493+
);
494+
string memory votingRoundId = vm.readLine(
495+
string.concat(
496+
dirPath,
497+
attestationTypeName,
498+
"_votingRoundId",
499+
".txt"
500+
)
501+
);
502+
503+
console.log("votingRoundId: %s\n", votingRoundId);
504+
console.log("requestBytes: %s\n", requestBytes);
505+
506+
string[] memory headers = Base.prepareHeaders(apiKey);
507+
string memory body = string.concat(
508+
'{"votingRoundId":',
509+
votingRoundId,
510+
',"requestBytes":"',
511+
requestBytes,
512+
'"}'
513+
);
514+
console.log("body: %s\n", body);
515+
console.log(
516+
"headers: %s",
517+
string.concat("{", headers[0], ", ", headers[1]),
518+
"}\n"
519+
);
520+
509521
510522
...
511523
}
512524
}
513525
```
514526

515-
## Posting the proof request to a DA Layer provider
527+
## Post proof request to DA Layer
516528

517529
We post the proof request to a chosen DA Layer provider server also with the same code as we did in the previous step.
518530

@@ -540,7 +552,7 @@ struct ParsableProof {
540552
```
541553

542554
The field `attestationType` holds the UTF8 encoded hex string of the attestation type name, padded to 32 bytes.
543-
Thus, it should match the value of the `attestationType` parameter in the Preparing the request step.
555+
Thus, it should match the value of the `attestationType` parameter in the Prepare the request step.
544556
In our case, that value is `0x4164647265737356616c69646974790000000000000000000000000000000000`.
545557

546558
The array `proofs` holds the Merkle proofs of our attestation request.
@@ -559,7 +571,7 @@ IAddressValidity.Response memory proofResponse = abi.decode(
559571
);
560572
```
561573

562-
## Verifying the proof
574+
## Verify proof
563575

564576
FDC optimizes on-chain storage costs by implementing a hybrid data verification system.
565577
Instead of storing complete datasets on-chain, it stores only Merkle proofs, while maintaining the actual data through trusted off-chain providers.
@@ -598,7 +610,7 @@ console.log("proof is valid: %s\n", StringsBase.toString(isValid));
598610
vm.stopBroadcast();
599611
```
600612

601-
## Using the data
613+
## Use the data
602614

603615
We will now define a simple contract, that will demonstrate how the data can be used onchain.
604616
The contract will receive an address and proof, and decide if the address is valid.

docs/fdc/guides/evm-transaction.mdx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ unlisted: false
1010

1111
The [`EVMTransaction`](/fdc/attestation-types/evm-transaction) attestation type enables data collection about a transaction on an EVM chain.
1212
The currently supported chain are: `ETH`, `FLR`, and `SGB`.
13-
You can learn more about it in the official [specification repo](https://github.com/flare-foundation/flare-specs/blob/main/src/FDC/AttestationTypes/EVMTransaction.md).
13+
You can learn more about it in the official [specification repo](/fdc/attestation-types/evm-transaction).
1414

1515
We will now demonstrate how the FDC protocol can be used to collect the data of a given Ethereum transaction.
1616
The transaction we will be observing has the hash `0x4e636c6590b22d8dcdade7ee3b5ae5572f42edb1878f09b3034b2f7c3362ef3c`; this is an arbitrary transaction that we acquired from the Sepolia Ethereum testnet [explorer](https://sepolia.etherscan.io/).
@@ -56,7 +56,7 @@ The names of included contracts mostly mirror the steps described in the [FDC gu
5656
To bridge the separate executions of the scripts, we will save the relevant data of each script to a file in the `dirPath` folder.
5757
Each succeeding script will then read that file to load the data.
5858

59-
## Preparing the Request
59+
## Prepare request
6060

6161
The JSON request to the verifier is the same form for all attestation types, but the values of the fields differ between them.
6262
It contains the following fields.
@@ -77,10 +77,8 @@ In the case of `EVMTransaction`, `requestBody` is a JSON containing the fields:
7777

7878
### Reference Documentation
7979

80-
We can find the required fields in the [specification](https://gitlab.com/flarenetwork/docs-team/flare-specs/-/blob/main/src/FDC/AttestationTypes/EVMTransaction.md?ref_type=heads) for the `EVMTransaction` attestation type.
81-
Alternatively, we can check the verifier's [interactive docs](https://fdc-verifiers-testnet.flare.network/verifier/api-doc#/ETH/ETHEVMTransactionVerifierController_prepareRequest).
82-
Here we can also check the verifier's response by providing the necessary data.
83-
Though the URLs are slightly different, the verifier has the same API for both [FLR](https://fdc-verifiers-testnet.flare.network/verifier/flr/api-doc#/AddressValidity/BTCAddressValidityVerifierController_prepareRequest) and [SGB](https://fdc-verifiers-testnet.flare.network/verifier/sgb/api-doc#/AddressValidity/BTCAddressValidityVerifierController_prepareRequest).
80+
- [EVMTransaction Specification](/fdc/attestation-types/evm-transaction)
81+
- [Verifier Interactive Docs](https://fdc-verifiers-testnet.flare.network/verifier/api-doc#/)
8482

8583
### Example Values
8684

@@ -296,7 +294,7 @@ forge script script/fdcExample/EVMTransaction.s.sol:PrepareAttestationRequest --
296294
The prerequisite for this is that the `.env` file is not missing the `PRIVATE KEY` and `COSTON2_RPC_URL` values.
297295
The script can also access other chains; that can be achieved by replacing the `--rpc-url` value with `COSTON_RPC_URL`, `FLARE_RPC_URL`, or `SONGBIRD_RPC_URL`.
298296

299-
## Posting the Request to a Verifier Server
297+
## Post request to verifier
300298

301299
Before submitting address validation requests to the FDC protocol, we first need to prepare and send them to a verifier server.
302300
This section walks through the request submission process using the `surl` package.
@@ -389,11 +387,11 @@ Base.writeToFile(
389387
);
390388
```
391389

392-
## Submitting the Request to the FDC
390+
## Submit request to FDC
393391

394392
This step transitions from off-chain request preparation to on-chain interaction with the FDC protocol. Now, we submit the validated request to the blockchain using deployed smart contracts.
395393

396-
### Submitting the Request
394+
### Submit request
397395

398396
The entire submission process requires only five key steps:
399397

@@ -462,7 +460,7 @@ function submitAttestationRequest(bytes memory abiEncodedRequest) internal {
462460
fdcHub.requestAttestation{value: requestFee}(response.abiEncodedRequest);
463461
```
464462

465-
5. Calculate Voting Round Number
463+
5. Calculate the Voting Round Number
466464
To determine the voting round in which the attestation request is processed, we query the `FlareSystemsManager` contract:
467465

468466
```solidity
@@ -479,7 +477,7 @@ This can be done within the existing broadcast or in a new one (as done in the d
479477

480478
Again, we write the `roundId` to a file (`data/EVMTransaction_roundId.txt`).
481479

482-
## Waiting for the Response
480+
## Wait for response
483481

484482
We wait for the round to finalize.
485483
This takes no more than 145 seconds.
@@ -489,9 +487,9 @@ To check if the round has been finalized, go to [Finalizations](https://coston2-
489487

490488
If you want to learn more about how the FDC protocol works, check [here](/fdc/overview).
491489

492-
## Preparing Proof Request
490+
## Prepare proof request
493491

494-
We prepare the proof request in a similar manner as in the step Preparing the request, by string concatenation.
492+
We prepare the proof request in a similar manner as in the step Prepare the request, by string concatenation.
495493
We import two new variables from the `.env` file; the URL of a verifier server and the corresponding API key.
496494

497495
```solidity title="scrip/fdcExample/EVMTransaction.s.sol"
@@ -571,7 +569,7 @@ contract RetrieveDataAndProof is Script {
571569
}
572570
```
573571

574-
## Posting the Proof Request to a DA Layer Provider
572+
## Post proof request to DA Layer
575573

576574
We post the proof request to a chosen DA Layer provider server also with the same code as we did in the previous step.
577575

@@ -599,7 +597,7 @@ struct ParsableProof {
599597
```
600598

601599
The field `attestationType` holds the UTF8 encoded hex string of the attestation type name, padded to 32 bytes.
602-
Thus, it should match the value of the `attestationType` parameter in the Preparing the request step.
600+
Thus, it should match the value of the `attestationType` parameter in the Prepare the request step.
603601
In our case, that value is `0x45564d5472616e73616374696f6e000000000000000000000000000000000000`.
604602

605603
The array `proofs` holds the Merkle proofs of our attestation request.
@@ -618,7 +616,7 @@ IEVMTransaction.Response memory proofResponse = abi.decode(
618616
);
619617
```
620618

621-
## Verifying the Proof
619+
## Verify proof
622620

623621
FDC optimizes on-chain storage costs by implementing a hybrid data verification system.
624622
Instead of storing complete datasets on-chain, it stores only Merkle proofs, while maintaining the actual data through trusted off-chain providers.
@@ -670,7 +668,7 @@ Base.writeToFile(
670668
);
671669
```
672670

673-
## Using the Data
671+
## Use the data
674672

675673
We will now define a simple contract, that will demonstrate how the data can be used onchain.
676674
The contract will receive data and proof of an Ethereum transaction, and store all token transfers contained into an array of `TokenTransfer` structs.
@@ -782,7 +780,8 @@ contract TransferEventListener is ITransferEventListener {
782780
}
783781
```
784782

785-
We deploy the contract through a simple script. The script creates a new `TransferEventListener` contract, and writes its address to a file (`data/EVMTransaction_listenerAddress.txt`).
783+
We deploy the contract through a simple script.
784+
The script creates a new `TransferEventListener` contract, and writes its address to a file (`data/EVMTransaction_listenerAddress.txt`).
786785

787786
```solidity title="scrip/fdcExample/EVMTransaction.s.sol"
788787
contract DeployContract is Script {

0 commit comments

Comments
 (0)