{
  "component": "baseline-payments",
  "baseCommit": "aebd9183af6a4b1643ddd1e71277f0e8166f3eda",
  "objectiveStatus": "INCOMPLETE",
  "files": {
    "changed": [
      "artifacts/goal/batches/e2-runner-components/items/baseline-payments/result.json"
    ],
    "sourceChanges": [],
    "scratchFiles": [],
    "inspected": [
      "receipt-check/audit.py",
      "receipt-check/README.md",
      "receipt-check/tests/synthetic_pass.json",
      "regtest-payment/regtest_payment.py",
      "regtest-payment/README.md",
      "regtest-payment/tests/test_regtest_payment.py",
      "regtest-payment/receipt.json"
    ]
  },
  "commands": [
    {
      "command": "git rev-parse HEAD && git status --short && rg --files | rg 'receipt-check|regtest-payment'",
      "exitCode": 0,
      "result": "Pinned HEAD matched; initial status clean; component files located."
    },
    {
      "command": "nl -ba receipt-check/audit.py",
      "exitCode": 0,
      "result": "Inspected fixed policy, decoded records, verdict and CLI."
    },
    {
      "command": "nl -ba regtest-payment/regtest_payment.py; cat regtest-payment/receipt.json",
      "exitCode": 0,
      "result": "Inspected Core workflow, receipt validation and delivered summary."
    },
    {
      "command": "command -v bitcoind; command -v bitcoin-cli",
      "exitCode": 1,
      "result": "Neither command produced a path."
    },
    {
      "command": "cat receipt-check/README.md regtest-payment/README.md receipt-check/tests/synthetic_pass.json; nl -ba regtest-payment/tests/test_regtest_payment.py; python3 -B receipt-check/audit.py regtest-payment/receipt.json; python3 -B receipt-check/audit.py receipt-check/tests/synthetic_pass.json; command -v bitcoind; command -v bitcoin-cli; sha256sum regtest-payment/receipt.json",
      "exitCode": 0,
      "result": "Delivered receipt verdict FAIL (CLI exit 1 by audit.py:193); synthetic control PASS (exit 0); neither Core executable resolved; receipt SHA-256 recorded below. Composite status is from sha256sum."
    },
    {
      "command": "PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s receipt-check/tests -v",
      "exitCode": 0,
      "result": "18 passed in 0.001 s."
    },
    {
      "command": "PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s regtest-payment/tests -v",
      "exitCode": 0,
      "result": "5 passed in 0.000 s as rounded by unittest."
    },
    {
      "command": "python3 -B - <<'PY'\nimport copy, json, sys\nfrom pathlib import Path\nsys.path[:0] = ['receipt-check', 'regtest-payment']\nfrom audit import audit, MAX_SATS\nfrom regtest_payment import validate_receipt, check_spend\nbase = json.loads(Path('receipt-check/tests/synthetic_pass.json').read_text())\nr = json.loads(Path('regtest-payment/receipt.json').read_text())\ndef show(name, result):\n    print(name, json.dumps(result, sort_keys=True))\nshow('delivered', validate_receipt(r))\nshow('fake_confirmation', validate_receipt(dict(synthetic=True, network='regtest', txid='fake', blockhash=None, height=-1, depth=True, input_sats=1, paid_sats=2, fee_sats=-1)))\nshow('real_depth_zero_control', validate_receipt(dict(r, depth=0)))\ntry:\n    validate_receipt(dict(r, depth='1'))\nexcept TypeError as e:\n    show('wrong_depth_type', str(e))\na = copy.deepcopy(base)\ndel a['tx']['txid']\na.update(network='regtest', synthetic=True, confirmation='CONFIRMED')\nshow('unbound_tx_wrong_network', audit(a))\na['prevouts'][0]['authenticated'] = False\nshow('false_flag_control', audit(a))\na = copy.deepcopy(base)\nfor out in (a['tx']['vin'][0], a['prevouts'][0], a['snapshot']['outpoints'][0]):\n    out.update(txid='a'*64+'\\n', vout=2**32)\nshow('invalid_outpoint', audit(a))\na = copy.deepcopy(base)\nfor prev in a['prevouts']:\n    prev['value_sats'] = MAX_SATS\na['tx']['vout'][0]['value_sats'] = MAX_SATS + 1\nshow('money_range', audit(a))\na = copy.deepcopy(base)\na['tx']['vout'][0]['value_sats'] = 1\nshow('almost_all_fee', audit(a))\nk = dict(txid=r['funding_txid'], vout=r['funding_vout'])\nshow('receipt_shape_only', audit(dict(tx=dict(txid=r['txid'], vin=[k], vout=[dict(value_sats=r['paid_sats'], script_hex=r['destination_script_hex'])]), prevouts=[], snapshot=dict(outpoints=[k]))))\nshow('caller_only_spend', check_spend(dict(vin=[dict(txid='fake', vout=0)], vout=[dict(value='0.00000001', scriptPubKey=dict(type='witness_v1_taproot', hex='00'))]), 'fake', 0, 'pubkeyhash', '00', 2, 1))\nPY",
      "exitCode": 0,
      "result": "Ten labeled outputs. Details and expected behavior are listed in tests.reproductions."
    },
    {
      "command": "python3 -B -m json.tool artifacts/goal/batches/e2-runner-components/items/baseline-payments/result.json > /dev/null && wc -c artifacts/goal/batches/e2-runner-components/items/baseline-payments/result.json && git diff --exit-code HEAD && git status --short --untracked-files=all",
      "exitCode": 0,
      "result": "JSON parse, byte count, tracked diff and output-only status checked."
    }
  ],
  "tests": {
    "implemented": "Read-only compatibility audit and standalone inline Python reproducer embedded in commands. Baseline code unchanged.",
    "tested": "18 auditor and 5 fixture unit tests passed. Tested both auditor CLI verdicts and the synthetic cases below.",
    "untested": "Fresh Core end-to-end run, actual inclusion and depth of the delivered receipt, raw-transaction and snapshot integration, reorg handling, and any mainnet claim.",
    "unavailable": "Neither Core executable resolved on PATH. No install, node access, credential read, real search, signing, or broadcast was attempted.",
    "reproductions": [
      {
        "caseName": "delivered",
        "result": "Expected summary shape acceptance and mainnet audit rejection. validate_receipt returned []; CLI returned FAIL with 'need tx object, prevouts list, snapshot object' and confirmation NOT ESTABLISHED.",
        "source": "audit.py:98-101; regtest_payment.py:66-80"
      },
      {
        "caseName": "receipt_shape_only",
        "result": "Expected rejection from honest mapping of known fields. Actual FAIL for missing snapshot prize address, missing funding prevout, and recipient script mismatch. Unknown prevout data was left absent.",
        "source": "audit.py:102-103,143-158"
      },
      {
        "caseName": "fake_confirmation",
        "result": "Expected malformed evidence and impossible amounts rejected. Actual [] for txid='fake', blockhash=null, height=-1, depth=true, input=1, paid=2, fee=-1. A consumer treating [] as proof of confirmation would falsely accept.",
        "source": "regtest_payment.py:66-80"
      },
      {
        "caseName": "real_depth_zero_control",
        "result": "Expected and actual ['unconfirmed'] when changing delivered depth to 0. This checks a supplied scalar only.",
        "source": "regtest_payment.py:76"
      },
      {
        "caseName": "wrong_depth_type",
        "result": "Expected structured rejection for string depth '1'. Actual TypeError: '<' not supported between instances of 'str' and 'int'.",
        "source": "regtest_payment.py:76"
      },
      {
        "caseName": "unbound_tx_wrong_network",
        "result": "Expected hardened schema to reject missing spend txid and regtest label under mainnet policy. Actual PASS on labeled fake fixture with tx.txid removed, network=regtest, synthetic=true and confirmation=CONFIRMED. Auditor itself still emits NOT ESTABLISHED.",
        "source": "audit.py:92-109,179-180"
      },
      {
        "caseName": "false_flag_control",
        "result": "Expected and actual FAIL when one matching prevout has authenticated=false. Setting true merely supplies the asserted flag; PASS does not authenticate the record.",
        "source": "audit.py:142-154"
      },
      {
        "caseName": "invalid_outpoint",
        "result": "Expected rejection of trailing newline in a 64-hex txid and vout=4294967296. Actual PASS when all three referring rows share both values.",
        "source": "audit.py:17,109-113"
      },
      {
        "caseName": "money_range",
        "result": "Expected range rejection. Actual PASS with each input at MAX_SATS and output MAX_SATS+1; total 4200000000000000 sat, output 2100000000000001 sat.",
        "source": "audit.py:148-152,160-178"
      },
      {
        "caseName": "almost_all_fee",
        "result": "Expected explicit fee-policy rejection under a prize payout policy. Actual PASS with 299999 sat fee on 300000 sat input and only 1 sat paid. Baseline checks fee nonnegativity only.",
        "source": "audit.py:164-178"
      },
      {
        "caseName": "caller_only_spend",
        "result": "Expected malformed script and fictitious outpoint rejected if used as independent validation. Actual [] from check_spend when matching caller arguments assert txid='fake', P2PKH type and Taproot script hex '00'. The normal run sources these arguments from Core.",
        "source": "regtest_payment.py:39-63,137-163"
      }
    ]
  },
  "measurements": {
    "receiptCheck": {
      "tests": 18,
      "elapsedSecondsReported": 0.001
    },
    "regtestPayment": {
      "tests": 5,
      "elapsedSecondsReported": 0
    },
    "deliveredReceipt": {
      "sha256": "4afcd5595e69021310ba2381c1e0d215973e6c19161b4a8b34a4f674897ae723",
      "claimedCoreVersion": "/Satoshi:28.1.0/",
      "claimedHeightBlocks": 103,
      "claimedDepthBlocks": 1,
      "inputSats": 50000000,
      "paidSats": 49999000,
      "feeSats": 1000,
      "claimedVirtualBytes": 200,
      "derivedFeeSatsPerVbyte": 5
    },
    "device": "unknown",
    "spendingIMD": 0
  },
  "blockers": [
    "Core runtime unavailable via PATH; offline checks are complete. Fresh end-to-end testing requires a supplied local directory containing executable bitcoind and bitcoin-cli.",
    "Historical disposable datadir is removed by the fixture. Delivered summary alone cannot authenticate the historical transactions, snapshot or active-chain depth."
  ],
  "compatibility": "Direct use fails. An explicit versioned regtest-only schema and adapter could share transaction-policy logic with mainnet after evidence collection. The delivered summary cannot populate that schema fully. Keep mainnet source and recipient constants isolated. A scriptPubKey carries no address HRP and cannot prove network on its own.",
  "evidenceGaps": [
    "The receipt gives funding txid, output index, script type and aggregate input sats, but omits funding script hex, serialized funding transaction and spend transaction, decoded vin/vout records, a pre-spend UTXO snapshot with tip anchor, and verifiable inclusion/active-chain evidence.",
    "The fixture obtains getrawtransaction funding verbose data and the signed spend hex during the run, and queries spend verbosity 2 for fee. It does not export the funding or spend bytes, canonical prevout records, or headers/proofs. Decoded statements in the receipt cannot be reconstructed into raw transactions by renaming fields.",
    "Auditor trusts caller-supplied decoded outpoints, scripts and values and the completeness and timing of the snapshot, plus a literal authenticated=true. It compares sets and calculates arithmetic; it never reads tx.txid, binds bytes to IDs, checks signatures or validates chain membership. It does verify fixed-address checksums and performs script equality. Every auditor result leaves confirmation unestablished, so a false confirmation arises if a downstream consumer treats PASS as confirmation.",
    "Receipt validator trusts supplied regtest and synthetic labels, amounts and depth; it requires txid, blockhash and height keys without checking their values. Its substring scan is only a marker check. Fixture generation has stronger local Core checks, but the saved JSON has no way to prove those checks ran. The run copies header confirmations and does not explicitly check the spend response's in_active_chain or bind the chain observation to a stable tip."
  ],
  "requirements": [
    "Design versioned, network-specific evidence envelopes and select policy through an explicit trusted network context. Reject cross-network input. Use run-specific regtest scripts via separate configuration; keep the fixed mainnet constants intact.",
    "Export public transaction bytes for the spend and each funding transaction before teardown. Parse bytes strictly, recompute txids, bind indexed outputs to values and scripts, and reject duplicate inputs, invalid uint32 indexes and values or totals outside MoneyRange. Check recipient, exact input coverage, positive realistic fee under an explicit configured policy, and transaction validity through the intended trusted node path.",
    "Capture a completeness-backed pre-spend UTXO snapshot at a known tip. Obtain spend inclusion plus active-chain evidence at verification time via an explicitly trusted chain context. For offline evidence, specify the trusted tip or chain anchor, verify inclusion against it, and state the time and depth of that observation. Recheck for reorgs and report policy/shape, authenticity and confirmation separately.",
    "Add a fresh isolated Core integration test producing the new evidence and passing only the regtest profile. Add offline negative cases for bool/string depth, fabricated/stale blocks, wrong network, missing or mismatched transaction bytes, inconsistent snapshot/prevout, bad script and amount, and high fee."
  ],
  "restartCommand": "PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s receipt-check/tests -v && PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s regtest-payment/tests -v",
  "freshRegtestCommand": "With BITCOIN_BINDIR set to an existing local Core bin directory: mkdir -p test/scratch && python3 -B regtest-payment/regtest_payment.py --bindir \"$BITCOIN_BINDIR\" --receipt test/scratch/baseline-payments-receipt.json",
  "conclusion": "The delivery is a synthetic regtest summary. No verified real solution or confirmed prize payment."
}
