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

@@ -96,3 +96,19 @@ ADVERT_DETAIL_URI=
# 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