Files
agents-marketplace/supplier/.env.example
david 5cae0c4f6c shared: opt-in CIP-33 reference-scripts for script-spending txs
When ESCROW_REF_UTXO / ADVERT_REF_UTXO env vars are set (format
<txhash>#<idx>), Claim/Submit/Accept/Reclaim/RetireAdvert call
.readFrom([refUtxo]) instead of inlining the validator CBOR via
.attach.SpendingValidator(). Lucid-evolution 0.4.30 auto-extracts
utxo.scriptRef into the script-witness map (dist/index.js:1903–1913),
so no separate attach call is needed. Default (env unset) is unchanged.

Adds buildLiveTxForPublishReferenceScripts (a one-shot tx that
publishes both validators as scriptRef-bearing UTxOs at a caller-
supplied address — typically the all-zero-pkh enterprise burn address)
and the supplier tx:publish-reference-scripts CLI that wraps it.

Targeted at testnet trial; mainnet rollout is a separate flip after
verification.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 15:25:59 +02:00

115 lines
5.2 KiB
Plaintext

# supplier/.env.example
#
# Copy to supplier/.env and fill in real values before `docker compose up`.
# .env is gitignored — NEVER commit a populated copy.
#
# To generate a fresh Ed25519 wallet seed:
# openssl rand -hex 32
# Fund the resulting address with ~5 AP3X on Vector testnet via the faucet
# before running. See deploy/README.md §2.
#
# Lines marked SECRET must never be shared, logged, or committed.
# ─── Required ─────────────────────────────────────────────────────────────
# 64-char hex Ed25519 private key seed for the supplier wallet. SECRET.
# Generate via: openssl rand -hex 32
SUPPLIER_PRIV_KEY_HEX=PASTE_64_HEX_CHARS_HERE
# Ogmios WebSocket URL. For external hosted Ogmios (recommended for M1-F):
# wss://ogmios.vector.testnet.apexfusion.org
# For a local Ogmios container (M1-F-vector-stack follow-up): ws://ogmios:1337
OGMIOS_URL=wss://ogmios.vector.testnet.apexfusion.org
# Ollama HTTP base URL. Inside compose this is the service name.
OLLAMA_URL=http://ollama:11434
# OutputReference of this supplier's on-chain advertisement UTxO.
# Format: "<64-hex-tx-hash>#<int-output-index>"
# Posting an advert is a one-shot operation — see deploy/README.md §4.
ADVERT_REF=PASTE_TXHASH_HERE#0
# Cardano network ID. "0" = testnet, "1" = mainnet.
# IMPORTANT: leave at "0" until ARCHITECTURE.md §9 #5 mainnet safety lands.
NETWORK_ID=0
# ─── Optional ─────────────────────────────────────────────────────────────
# HTTP listen port inside the container. Compose maps this to the host.
PORT=8080
# Ollama request timeout (ms). Tiny CPU model on Hetzner CX is slow — keep
# generous. Increase if you see ollama_timeout reasons in logs.
OLLAMA_TIMEOUT_MS=120000
# ─── Optional (not in supplier/src/config.ts; consumed by index.ts boot) ──
# Pre-derived public-key + pkh + bech32 address. M1-D will derive these from
# SUPPLIER_PRIV_KEY_HEX automatically; until then index.ts reads them from
# env. Tests inject WalletKey directly.
# SUPPLIER_PUB_KEY_HEX=
# SUPPLIER_PKH=
# SUPPLIER_ADDRESS=
# ─── Optional — chain provider selection (M1-F-2) ─────────────────────────
# LIVE_CHAIN: opt-in to real Ogmios submitTx + awaitTx.
# Default unset = ReadOnlyOgmiosProvider (no real chain writes; safe for dev).
# Set to literal "1" to enable LiveOgmiosProvider — REAL TESTNET/MAINNET
# SUBMISSIONS WILL HAPPEN. Any other value (including "true", "yes", "TRUE")
# is treated as off, by design (safety against misconfiguration).
LIVE_CHAIN=
# ─── tx:post-advert — run once before first deploy (M1-F-3) ───────────────────
# Execute: pnpm --filter @marketplace/supplier tx:post-advert
# On success, copy the printed "<txHash>#0" string into ADVERT_REF above.
# Capability published in the on-chain advertisement. // added M1-F-3
ADVERT_CAPABILITY_ID=llm.text.generate.v1
# Ollama model name served by this supplier. // added M1-F-3
ADVERT_MODEL=qwen2.5:0.5b
# Maximum output tokens the supplier will honour per request. // added M1-F-3
ADVERT_MAX_OUTPUT_TOKENS=512
# Maximum processing time the supplier guarantees (ms). // added M1-F-3
ADVERT_MAX_PROCESSING_MS=60000
# Flat price per prompt in AP3X lovelace. // added M1-F-3
ADVERT_PRICE_LOVELACE=2000000
# Supplier bond deposited into the advert UTxO (lovelace). // added M1-F-3
# Default 1_000_000 if omitted.
ADVERT_SUPPLIER_BOND_LOVELACE=1000000
# Buyer bond required per escrow (lovelace). // added M1-F-3
# Default 1_000_000 if omitted.
ADVERT_BUYER_BOND_LOVELACE=1000000
# HTTPS endpoint buyers will call (must be publicly reachable). // added M1-F-3
ADVERT_ENDPOINT_URL=https://mp-supplier.vector.testnet.apexfusion.org
# Optional off-chain detail pointer (IPFS / HTTPS URI). // added M1-F-3
# Leave empty for v1 if no extended metadata is published.
ADVERT_DETAIL_URI=
# Optional sha256 of the detail JSON (64 hex chars). // added M1-F-3
# If empty, defaults to sha256("") =
# e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
ADVERT_DETAIL_HASH=
# ─── Optional: CIP-33 reference scripts ───────────────────────────────────
# Saves witness-set fee on script-spending txs (Claim, Submit, Accept,
# Reclaim, RetireAdvert) by referencing on-chain script UTxOs instead of
# inlining the full validator CBOR. Leave unset to use inlined scripts
# (current behavior).
#
# Publish the two reference UTxOs (one-shot; uses SUPPLIER_PRIV_KEY_HEX +
# OGMIOS_URL + NETWORK_ID from this env file):
# docker compose -f deploy/testnet/docker-compose.supplier.yml run --rm \
# --entrypoint sh supplier \
# -c "node_modules/.bin/tsx supplier/src/cli/publish-reference-scripts.ts"
# Paste the two printed refs here AND into buyer/.env, then
# `docker compose down && up -d` to apply.
# ESCROW_REF_UTXO=<txhash>#0
# ADVERT_REF_UTXO=<txhash>#1