Skip to main content
Loading navigation

Build a Verified Origin Certificate Verification and Duty Expiry Reconciler — implementation

Prompt source

implementation86 lines11 sectionsNo variables1 code block
## Build
Audit ASEAN-Singapore preferential tariff certificates against OpenAttestation verification rules. Flag credential expiries and calculate mock customs duty liabilities.

## User
Cross-Border Customs Broker

## Workflow
1. Ingest wrapped electronic Certificates of Origin (e-CO) formatted according to TradeTrust specifications.
2. Validate document authenticity and cryptographic signature status using OpenAttestation core functions.
3. Verify certificate validity dates against planned customs clearance and free trade agreement expiration dates.
4. Calculate potential duty impact if origin credentials expire and compile a customs audit file.

## Interface
Customs tariff dashboard displaying certificate hash trees, HS code matches, and duty liability calculations.

## Data
Normalized JSON documents mimicking ASEAN Trade in Goods Agreement (ATIGA) Form D certificates wrapped with OpenAttestation.
Starter examples below are synthetic. They are not downloaded records.

## Source
[TradeTrust](https://raw.githubusercontent.com/TradeTrust/tradetrust-website/master/README.md)
Leverages TradeTrust website and document-store integration paradigms to verify electronic certificates of origin against Sepolia testnet parameters.

## Tools
langgraph, ethers, typescript.
LangGraph manages cyclic verification workflows, branching between valid signatures, expired certificates, and duty recalculations.
API-hosted model for analyzing trade agreement rules and synthesizing non-technical customs broker explanations.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Verify TradeTrust cryptographic signatures and merkle root inclusion.
- Flag expired certificates of origin prior to import permit lodgement.
- Compute preferential versus standard non-preferential duty deltas accurately.
- Generate a structured customs reconciliation summary for broker sign-off.

## Starter Examples
```json
[
  {
    "input": {
      "declaration_id": "DEC-SG-CUSTOMS-5501",
      "hs_code": "8471.30.00",
      "goods_description": "Data processing servers",
      "customs_value_sgd": 350000,
      "preferential_rate_percent": 0,
      "standard_rate_percent": 5,
      "co_document": {
        "certificate_number": "MY-SG-2024-8871",
        "expiry_date": "2025-06-30T00:00:00Z",
        "signature_valid": true,
        "merkle_root_published": true
      },
      "declaration_date": "2025-04-12T00:00:00Z"
    },
    "expected_output": {
      "certificate_status": "VALID_ACTIVE",
      "preferential_duty_eligible": true,
      "applied_duty_sgd": 0,
      "duty_saved_sgd": 17500,
      "customs_ready": true,
      "broker_action": "Proceed with zero-tariff FTA import lodgement."
    }
  },
  {
    "input": {
      "declaration_id": "DEC-SG-CUSTOMS-5502",
      "hs_code": "2208.30.00",
      "goods_description": "Commercial spirits",
      "customs_value_sgd": 80000,
      "preferential_rate_percent": 2,
      "standard_rate_percent": 10,
      "co_document": {
        "certificate_number": "TH-SG-2023-1102",
        "expiry_date": "2024-12-31T00:00:00Z",
        "signature_valid": true,
        "merkle_root_published": true
      },
      "declaration_date": "2025-04-12T00:00:00Z"
    },
    "expected_output": {
      "certificate_status": "EXPIRED",
      "preferential_duty_eligible": false,
      "applied_duty_sgd": 8000,
      "duty_saved_sgd": 0,
      "customs_ready": false,
      "broker_action": "Preferential tariff certificate expired. Hold declaration or lodge under standard MFN duty rate (10%)."
    }
  }
]
```

## Safety
No filings are made to Singapore Customs; all duty rate comparisons and document validations are simulated locally.
Use mock external writes. Require human review before any real deployment.