Skip to content

Hackathon Submission: GastroBenchmark microservice for Cuqui on Cardano#117

Open
pjcdz wants to merge 15 commits intopyth-network:mainfrom
pjcdz:gastro-benchmark
Open

Hackathon Submission: GastroBenchmark microservice for Cuqui on Cardano#117
pjcdz wants to merge 15 commits intopyth-network:mainfrom
pjcdz:gastro-benchmark

Conversation

@pjcdz
Copy link

@pjcdz pjcdz commented Mar 22, 2026

Pyth Examples Contribution

Type of Contribution

  • New Example Project (Adding a new example to demonstrate Pyth integration)
  • Bug Fix (Fixing an issue in existing examples)
  • Documentation Update (Improving README, comments, or guides)
  • Enhancement (Improving existing functionality or adding features)
  • Hackathon Submission (Submitting a project from a hackathon)

Project Information

Project/Example Name: GastroBenchmark for Cuqui

Pyth Product Used:

  • Pyth Price Feeds
  • Pyth Entropy
  • Multiple Products
  • Other: Pyth Lazer

Blockchain/Platform:

  • Ethereum/EVM
  • Solana
  • Aptos
  • Sui
  • Fuel
  • Starknet
  • TON
  • Other: Cardano

Description

What does this contribution do?

This contribution turns lazer/cardano/gastro-benchmark into a hackathon-ready example project for Cuqui, a buyer platform for supplier catalogs.

The example now presents GastroBenchmark as a backend microservice that receives normalized supplier offers and returns:

  • live commodity benchmark snapshots from Pyth
  • recent historical fallback points in USD
  • comparison results showing how far a supplier quote is above or below international market reference
  • explicit coverage states when Pyth/Cardano does not yet support a usable commodity benchmark

It also preserves the Cardano-oriented foundation of the original example by keeping the on-chain/off-chain Cardano files in place while reorganizing the project around a clean microservice layer.

How does it integrate with Pyth?

The project uses Pyth Lazer price feeds as the market reference layer.

Specifically, it:

  • queries Pyth Lazer for current commodity prices
  • falls back to recent historical prices when live prices are unavailable
  • maps gastronomy-related products to supported commodity feeds
  • exposes benchmark and comparison data through REST endpoints for consumption by Cuqui
  • keeps the Cardano-specific integration path in the codebase so the project can evolve toward stronger on-chain/off-chain Cardano flows as Pyth coverage on Cardano matures

What problem does it solve or demonstrate?

Restaurants and merchants usually compare one supplier against another, but they do not know how far those offers are from the international market price of the underlying commodity.

This example demonstrates how a buyer platform can go beyond supplier-vs-supplier comparison and answer questions like:

  • Is this flour quote expensive relative to the international corn or grain market?
  • How much markup over the market benchmark am I paying?
  • Which products have usable Pyth/Cardano benchmark coverage today, and which are future candidates?

This is especially useful for hackathon reviewers because it shows a practical real-world use case for Pyth price feeds on Cardano in procurement software.

Directory Structure (for new examples)

lazer/cardano/gastro-benchmark/
├── onchain/                     # Aiken validators and Cardano contract artifacts
├── src/
│   ├── benchmark-catalog.ts     # Supported gastronomy benchmark definitions
│   ├── benchmark-service.ts     # Comparison service used by the API
│   ├── cardano-base.ts          # Cardano foundation/capability metadata
│   ├── pyth.ts                  # Pyth Lazer client, snapshots and history
│   ├── server.ts                # REST microservice entrypoint
│   ├── contract.ts              # Cardano contract helper
│   ├── onchain-update.ts        # Cardano/Pyth update helpers
│   └── ...
├── test.ts                      # Local verification with mocked price provider
└── README.md                    # Project documentation and Cuqui integration story

Testing & Verification

How to Test This Contribution

Prerequisites

  • Node.js version: 24.x used locally
  • Other dependencies: npm install
  • Optional env var for live calls: PYTH_API_KEY

Setup & Run Instructions

cd lazer/cardano/gastro-benchmark
npm install
npm test
npm run check
npm run serve

Optional dashboard demo:

cd lazer/cardano/gastro-benchmark
npm run dashboard

Deployment Information (if applicable)

Network: Cardano-oriented example with Pyth Lazer market data and Cardano integration scaffolding

Contract Address(es): Not deployed as part of this submission

Demo URL: N/A

Checklist

Code Quality

  • Code follows existing patterns in the repository
  • Proper error handling implemented
  • No hardcoded values (use environment variables where appropriate)

Testing

  • Tested locally and works as expected
  • All existing functionality still works (no breaking changes)

Additional Context

Related Issues

Fixes #N/A

Screenshots/Demo (if applicable)

No live hosted demo URL in this PR. The included REST service and CLI dashboard are the local demo surfaces.

Notes for Reviewers

This submission should be read together with the Cuqui platform concept:

  • Cuqui handles ingestion, parsing, normalization and buyer-facing UI
  • GastroBenchmark is the backend microservice that adds international market comparison using Pyth on Cardano

The project intentionally makes partial market coverage explicit. Many gastronomy products still do not have a direct benchmark in Pyth/Cardano, and the service returns those cases as coverage gaps or future mapping candidates instead of inventing prices.

pjcdz added 13 commits March 22, 2026 17:59
- Added gastro_benchmark validator with Pyth price validation logic
- Max markup: 30% over Pyth commodity prices
- TODO: Build plutus.json locally (aiken build)

Team Cuqui - Pablo Cardozo, Nashira Oropeza
- Clean build with 0 errors, 0 warnings
- Validator: gastro_benchmark (spend handler)
- Blueprint includes datum, redeemer, and validator address

Team Cuqui - Pablo Cardozo, Nashira Oropeza
- contract.ts: Load plutus.json and derive validator address
- demo.ts: lock and redeem purchase orders with Pyth validation
- .env: Template for API keys and wallet seed
- Scripts: npm run lock, npm run redeem

Team Cuqui - Pablo Cardozo, Nashira Oropeza
- Compares supplier prices vs Pyth Network benchmarks
- Color-coded markup indicators (🟢🟡🔴)
- Shows fair/acceptable/expensive suppliers
- Team Cuqui: Pablo Cardozo, Nashira Oropeza

Run: npm run dashboard
- Complete project description
- Demo command and output
- Team Cuqui members listed
- Future work section

Ready for PR submission
- Fetches live BTC/ETH prices from CoinGecko API
- Shows comparison between exchange prices and market
- Premium calculation: overpaying exchanges flagged in red
- Architecture documentation for Pyth integration

Team Cuqui: Pablo Cardozo, Nashira Oropeza
- Document CoinGecko API integration
- Show actual live price output
- Team Cuqui listed

Ready for PR submission
- Food commodities: Harina, Aceite Soja, Carne Vacuna
- Suppliers: Molinos, La Serenísima, Frigoríficos, etc.
- Pyth feeds: WHEAT, SOYBEAN_OIL, LIVE_CATTLE
- Business value: Restaurants pay fair prices

Team Cuqui: Pablo Cardozo, Nashira Oropeza
- Food commodities: Harina, Aceite Soja, Carne Vacuna
- Suppliers: Molinos, La Serenísima, Frigoríficos
- Business value: Restaurants pay fair prices
- Team Cuqui: Pablo Cardozo, Nashira Oropeza

Ready for PR
Add @pythnetwork/pyth-lazer-sdk and refactor the gastro-benchmark tool to use live Pyth feeds. Introduces src/pyth.ts which encapsulates PythLazerClient creation, feed definitions, latest snapshot retrieval, historical fallback logic, value scaling/normalization, and client shutdown. Update src/dashboard.ts to consume the new API: pretty-printed benchmark table, supplier quote comparisons with markup classification, notes, improved formatting, error handling, and graceful shutdown. Also update package.json and package-lock.json to include the new SDK dependency.
@pjcdz pjcdz changed the title Gastro benchmark cuqui - pablo cardozo - nashira oropeza Mar 22, 2026
@pjcdz pjcdz changed the title cuqui - pablo cardozo - nashira oropeza Hackathon Submission: GastroBenchmark microservice for Cuqui on Cardano Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant