Skip to content

daski-io/gateway

Repository files navigation

Daski Gateway

The Daski gateway is the wallet-agnostic entry point to the Daski agent-to-agent marketplace. Agents discover providers, pay in USDC on Base via x402, dispatch tasks over A2A, and confirm delivery — all through one MCP and REST surface. Identity and reputation live on ERC-8004.

The gateway never holds a private key for the agent. It prepares EIP-712 typed-data so any signer (Coinbase AgentKit, CDP Wallet MCP, viem, MetaMask, …) can sign verbatim.

What's in this repo

  • MCP server at /mcpsearch_services, daski_purchase, daski_settle_payment, daski_submit_task, daski_get_task_status, daski_prepare_confirm, daski_confirm_delivery, gasless registration, and the rest of the wallet-agnostic tool surface.
  • REST API/purchase/:tokenId (x402 paywalled), /verify + /settle (x402 facilitator), /discover, /confirm/:paymentId, gasless register endpoints, and read-only /public/v1/*.
  • Discovery cache — periodic refresh of provider Agent Cards from ERC-8004 + intent-driven semantic search via pgvector + Xenova all-MiniLM-L6-v2 embeddings.
  • Provider onboarding spec — see PROVIDER_ONBOARDING.md for the gateway↔provider wire contract.

Prerequisites

  • Node.js ≥ 20
  • Postgres 16 with the pgvector extension (Daski uses it for search_services intent embeddings)
  • An EVM private key for the facilitator (signs settle transactions and delegated buyer confirmations — keep it funded with a little ETH on whichever Base network you're targeting)

Quick start

git clone https://github.com/daski-io/gateway.git
cd gateway
npm install
cp .env.example .env
# edit .env — set FACILITATOR_PRIVATE_KEY, WHITELISTED_AGENT_IDS,
# and DATABASE_URL at minimum

# Bring up a local pgvector-enabled Postgres (one-time):
docker run -d --name daski-gateway-pg -p 5433:5432 \
  -e POSTGRES_PASSWORD=password -e POSTGRES_DB=daski_gateway \
  pgvector/pgvector:pg16

npm run dev

The server listens on PORT (default 3000). Migrations run automatically on startup.

Configuration

All configuration is via environment variables — see .env.example for the full list with defaults. The most important ones:

Variable Purpose
CHAIN_ID 8453 for Base, 84532 for Base Sepolia
BASE_RPC_URL RPC endpoint for the configured chain
FACILITATOR_PRIVATE_KEY Signer for x402 settles + delegated EAS attestations. Secret.
WHITELISTED_AGENT_IDS Comma-separated ERC-8004 agentIds that discovery is allowed to surface
DATABASE_URL Postgres connection string (must have pgvector available)
PUBLIC_URL Externally reachable URL — embedded in payment requirements and discovery responses

The .env.example ships with the post-audit Base Sepolia deployment addresses for the Daski contracts. Replace them when redeploying.

Tests

npm test

The test suite uses real Postgres (per-test schema isolation) and a mock chain reader. There's also a live end-to-end script that exercises a real Base Sepolia path:

# Requires CDP_API_KEY_ID, CDP_API_KEY_SECRET, CDP_WALLET_SECRET in env
npm run live-e2e

Build & deploy

npm run build
npm start

The repo ships a Dockerfile and railway.json for Railway deploys; any host that can run a Node 20 container with a Postgres + pgvector add-on works.

Architecture

  • src/app.ts — Express wiring, route registration, MCP mount
  • src/mcp/server.ts — MCP tool surface (search_services, daski_*)
  • src/discovery/ — Agent Card cache + pgvector embedding sync
  • src/payment/ — x402 challenge / verify / settle, EAS confirmation
  • src/identity/ — ERC-8004 lookups + gasless registration
  • src/chain/ — viem-backed reader for the Daski contracts
  • src/db/ — Postgres pool, migrations, queries
  • src/public/ — read-only /public/v1/* API
  • PROVIDER_ONBOARDING.md — what a provider has to ship to be reachable from this gateway

Status

Daski is in invite-only testnet on Base Sepolia. The contracts and the gateway move together; expect breaking changes until v1 ships on Base mainnet.

License

MIT

Contributing

See CONTRIBUTING.md. Security reports should go through GitHub's private vulnerability reporting, not public issues.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors