From 2874f7c93364b541745dc70bb35bbd097313d91b Mon Sep 17 00:00:00 2001 From: Aitor Date: Thu, 4 Jun 2026 10:47:31 +0200 Subject: [PATCH] feat: check tipo script legacy (P2PKH/P2SH), peso -15 --- dashboard.html | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/dashboard.html b/dashboard.html index ffa30b9..6bb9edd 100644 --- a/dashboard.html +++ b/dashboard.html @@ -1024,7 +1024,7 @@ input_reuse: 25, input_type_mixing: 14, output_type_mismatch: 8, round_numbers: 10, rbf: 5, peeling: 8, unnecessary_input: 12, dust: 8, change_detection: 10, - wallet_fingerprint: 6, batch_payment: 45, entity_ofac: 20, op_return: 30, + wallet_fingerprint: 6, batch_payment: 45, entity_ofac: 20, op_return: 30, legacy_type: 15, }; let deductions = 0; @@ -1501,7 +1501,27 @@ penalty: 0, informational: true, }); - // ── 16. Detección de entidades conocidas ────────────────────────── + // ── 16. Tipo legacy (P2PKH / P2SH) ─────────────────────────────── + // Inputs en formato legacy (P2PKH = 1..., P2SH = 3...) revelan UTXOs antiguos + // o wallets que no han migrado a SegWit/Taproot. Mayor huella on-chain y + // menor anonimato en el conjunto de usuarios modernos. + const legacyTypes = ["p2pkh", "p2sh"]; + const allInputScriptTypes = [...new Set(tx.vin.map(v=>v.prevout?.scriptpubkey_type).filter(Boolean))]; + const hasLegacyInputs = allInputScriptTypes.some(t => legacyTypes.includes(t)); + const legacyInputTypes = allInputScriptTypes.filter(t => legacyTypes.includes(t)); + checks.push({ + id:"legacy_type", label:"Tipo de script legacy (P2PKH/P2SH)", certainty:"CERTEZA", + pass: !hasLegacyInputs, + actionability: "wallet", + detail: hasLegacyInputs + ? `Los inputs usan tipo legacy (${legacyInputTypes.join(", ")}). Las direcciones legacy (1... para P2PKH, 3... para P2SH) tienen mayor huella on-chain que SegWit (bc1q...) o Taproot (bc1p...) y forman un conjunto de usuarios cada vez más pequeño, lo que reduce el anonimato por conjunto.` + : "Los inputs usan SegWit o Taproot — no se detecta tipo legacy.", + didactic: "P2PKH y P2SH son los formatos originales de Bitcoin. La mayoría de wallets modernos usan SegWit (bc1q) o Taproot (bc1p), que son más eficientes y tienen menor huella. Usar legacy no es un error activo, pero sí una característica del UTXO observable por cualquiera.", + penalty: hasLegacyInputs ? weights.legacy_type : 0, + }); + if (hasLegacyInputs) deductions += weights.legacy_type; + + // ── 17. Detección de entidades conocidas ────────────────────────── // Cruza direcciones de inputs y outputs contra el ENTITY_INDEX embebido. const allTxAddrs = [ ...tx.vin.map(v => ({ addr: v.prevout?.scriptpubkey_address, side: "input" })),