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>
This commit is contained in:
david
2026-05-14 15:25:59 +02:00
parent 15693c8532
commit 5cae0c4f6c
7 changed files with 351 additions and 18 deletions

View File

@@ -26,6 +26,15 @@ BUYER_PORT=8070
# See ARCHITECTURE.md §9 follow-up — naming drift to be reconciled.)
NETWORK_ID=0
# ─── Optional: CIP-33 reference scripts ───────────────────────────────────
# When set, buyer-signed script-spending txs (Accept, Reclaim) read the
# escrow validator from an on-chain reference UTxO instead of inlining
# its CBOR — saving witness-set fees. Must match the values published
# by `supplier tx:publish-reference-scripts` (printed to stdout by that
# CLI). Leave unset to use inlined scripts (current behavior).
# ESCROW_REF_UTXO=<txhash>#0
# ADVERT_REF_UTXO=<txhash>#1 # not used by buyer; kept for env-file symmetry
# ─── Reserved for M1-F ────────────────────────────────────────────────────
# INDEXER_TIMEOUT_MS is referenced in deploy/README.md but is NOT yet read
# by buyer/src/config.ts. M1-F should add it; see follow-ups.