Skip to content

DDS Generation Pipeline

The Due Diligence Statement pipeline generates, signs, stores, and files EUDR-compliant documents automatically from normal AsiliChain operations. No manual input from the exporter beyond initiating the request.

flowchart TD
    INIT["Exporter calls
POST /eudr/generate-dds"]
    subgraph FETCH ["Data Fetch — parallel"]
        MANTLE["Mantle
BatchToken IDs
FarmerIDs
Cooperative licence"]
        HEDERA["Hedera HCS
8-stage event history
Custody timestamps"]
        GFW["Global Forest Watch
Final deforestation check"]
    end
    BUILD["pdf-lib
Assemble DDS document"]
    SIGN["Cooperative EIP-712
signature"]
    IPFS["Pinata → IPFS
Permanent pin"]
    TRACES["EU TRACES API
Filed + reference returned"]
    MANTLE2["Mantle
DDS IPFS CID recorded
on BatchToken"]
    HEDERA2["Hedera HCS
DDS_GENERATED event"]
    RESP["API response:
dds_id · ipfs_url · traces_ref"]
    INIT --> FETCH
    MANTLE --> BUILD
    HEDERA --> BUILD
    GFW --> BUILD
    BUILD --> SIGN --> IPFS
    IPFS --> TRACES
    IPFS --> MANTLE2
    IPFS --> HEDERA2
    MANTLE2 & HEDERA2 & TRACES --> RESP

Step 1: Data Fetch (parallel, ~2–4 seconds)

Section titled “Step 1: Data Fetch (parallel, ~2–4 seconds)”

The pipeline fetches from three sources simultaneously:

  • Mantle: All BatchToken metadata for the shipment — farmer IDs, GPS hash, grade, weight, cooperative licence number
  • Hedera HCS: Complete stage history for each batch — timestamps, actor wallet addresses, Mantle tx hashes
  • GFW: Final satellite deforestation check against December 2020 baseline for each farm polygon

pdf-lib assembles the PDF DDS document. The document includes:

  • All farm GPS references (IPFS CID links to raw GeoJSON — not embedded in PDF)
  • Complete 8-stage custody chain
  • GFW verification status and timestamp
  • Cooperative EIP-712 signature placeholder

The cooperative’s wallet signs the DDS hash using EIP-712 structured data signing. This provides:

  • Cryptographic proof of cooperative authorization
  • Non-repudiation — the cooperative cannot deny having filed the DDS
  • Verifiability by EU customs without contacting AsiliChain

Pinata pins the signed DDS to IPFS. The IPFS CID is recorded:

  • As a field in the DDS response
  • On the BatchToken metadata on Mantle
  • In a Hedera HCS message for the DDS_GENERATED event

The pipeline calls the EU TRACES API with the DDS data. TRACES returns a reference number that the cooperative uses for export documentation.

StepDuration
Data fetch (parallel)2–4 seconds
Document assembly1–2 seconds
EIP-712 signature< 1 second
IPFS pinning3–8 seconds
TRACES filing5–15 seconds
Mantle + HCS record2–5 seconds
Total~15–35 seconds
FailureBehaviour
GFW API timeoutRetry 3×. If unresolvable, DDS blocked — farm must be manually reviewed
TRACES API unavailableDDS generated and pinned to IPFS. TRACES filing retried on schedule. Exporter notified.
Batch not GRADEDAPI returns BATCH_NOT_ELIGIBLE — DDS requires GRADED status
Farm not deforestation-freeAPI returns GFW_CHECK_FAILED — batch blocked from this shipment, flagged for review