Skip to content

Research H SAC Leakage Lower Bound

github-actions[bot] edited this page Nov 20, 2026 · 1 revision

H-SAC: Minimum Leakage Lower Bound for Compliance Tasks

Status: theoretical boundary and interface specification. Current code provides only single-output plaintext opening disclosure, not the near-optimal zero-knowledge protocol described here.

1. Variables

Let

X : complete private user state (amounts, openings, true inputs,
    credentials and transaction relationships);
P : public chain information known to the adversary before the protocol;
Y = F(X,P) : compliance-task output;
V : final adversarial view, including transcript, public output, errors and timing.

F must be a concrete decidable task, such as testing whether selected commitments sum below a threshold or whether a true-source credential belongs to a policy root. "Legitimate funds" is not a trust-free mathematical predicate; issuer lists, real identities and policy correctness are external assumptions in P. Information quantities are defined relative to an explicit distribution (X,P). Without one, Shannon leakage has no numeric meaning and only worst-case indistinguishability or simulation definitions apply.

2. Zero-error lower bound

If the auditor recovers Y from (V,P) without error, H(Y | V,P)=0. Because Y=F(X,P) is deterministic, the chain rule gives

I(X;V | P)
 = I(X,Y;V | P)
 = I(Y;V | P) + I(X;V | Y,P)
 >= I(Y;V | P)
 = H(Y | P) - H(Y | V,P)
 = H(Y | P).

Theorem SAC-N1 (task-output lower bound)

Every protocol that lets the auditor correctly determine Y leaks at least

Leak(X -> V | P) >= H(F(X,P) | P).

This leakage is inherent in the function and independent of whether the protocol uses a view key, SNARK, MPC or trusted hardware.

3. Error-tolerant bound

Let the range of Y have size M>=2, let the auditor output Y_hat(V,P), and assume error at most epsilon. Fano's inequality gives

H(Y | V,P) <= h_2(epsilon) + epsilon log_2(M-1),
h_2(epsilon)=-epsilon log_2 epsilon
             -(1-epsilon)log_2(1-epsilon),

and therefore

I(X;V | P)
 >= H(Y | P)-h_2(epsilon)-epsilon log_2(M-1).

For a Boolean output this is H(Y|P)-h_2(epsilon). Regulatory protocols must state their false-positive and false-negative error rather than hide it in an unspecified epsilon.

4. What it means to attain the bound

4.1 Perfect task privacy

If I(X;V | Y,P)=0, then after conditioning on the public facts and necessary task result the view contains no further information about X. Under zero error, I(X;V | P)=H(Y|P). Equivalently, a simulator given only (P,Y) can produce the same view distribution. Cryptographic protocols normally obtain only computational indistinguishability for PPT adversaries:

Real(X,P) ~=_c Sim(P,F(X,P)).

That is computational near-optimality, not an unconditional Shannon equality.

4.2 Worst-case transcript bound

A deterministic zero-error auditor must distinguish the output equivalence classes reachable for fixed P. If R_P=|{F(x,P)}|, the worst-case view needs at least log_2 R_P bits of distinguishing power. This is not the same as average mutual information and the two must not be conflated.

5. Repeated disclosures compose

For adaptive tasks Y_j=F_j(X,P,V_<j) and joint view V_(1:q), correct answers to all tasks imply

I(X;V_(1:q) | P) >= H(Y_1,...,Y_q | P)

minus the corresponding Fano terms when error is allowed. Even task-optimal Boolean proofs can progressively identify X. H-SAC therefore needs capability scope and task identifiers, query/disclosure budgets, expiry and revocation, a user-auditable disclosure log, and protection against rewriting a narrow task as a high-cardinality output. Revocation cannot erase transcripts already learned by an auditor.

6. Subtract public on-chain information first

P includes at least chain ID, block time, transaction size, fee, commitment, nullifier, public scripts and observable network data. The bound is H(Y|P), not H(Y), because the public chain may already reveal some or all of the answer. Conversely, zero knowledge does not automatically hide timing, proof size, failure reasons, RPC source IP or capability-request patterns; they are part of the real V and threat model.

7. Candidate H-SAC' relation

Public statement:

Z=(cid, task_id, task_output Y, scope, expiry, auditor_pk,
   selected_commitments, input_nullifiers, policy_root, inclusion_roots).

Private witness:

W=(values,blindings,spend_secrets,real_ring_indices,
   ownership_paths,policy_credentials,policy_paths).

The relation R_F(Z,W)=1 must constrain correct commitment openings, ownership/nullifiers, authenticated-chain inclusion, credential membership, statement binding of scope/task/auditor/expiry, F(W,public facts)=Y, and the transaction balance relation where relevant. Output should be an auditor-addressed encrypted capability plus a zero-knowledge proof. Merely putting auditor_pk in a public proof prevents cross-auditor replay but does not encrypt plaintext fields.

If R_F has completeness, knowledge soundness and zero knowledge, and a transcript simulator uses only (P,Y), it approaches SAC-N1 computationally. Chain inclusion, credential issuance and encryption still need separate proof.

8. Distance from the current implementation

crates/hyphen-wallet/src/audit.rs v0 reveals in plaintext:

chain_id, txid, output/global index, auditor key, scope, validity,
nonce, commitment, one-time public key, amount, blinding, Schnorr proof.

DISCLOSED_FIELDS_V0 exposes a machine-readable leakage list. The package proves an amount opening and one-time-key ownership but places amount and blinding directly in V. For a one-bit task this is far above the theoretical minimum. It also does not prove canonical-chain inclusion, output-index consistency, the real ring input or provenance path, policy credentials, real-world legitimacy, or auditor-only readability. V0 is targeted opening disclosure, not a complete audit key or optimal selective transparency.

test-vectors/h-sac-payment-v0.json contains the serialized contract-devnet payment, its signed disclosure, and the block and tip at which its global index was checked. With Python packages blake3 and rbcl installed, run python scripts/test-h-sac-vector.py to recompute the transaction hash, Pedersen opening, Schnorr equation and capability ID. The wallet regression test also decodes the transaction and checks its selected output. hyphen-audit reads a local node database to verify its current canonical position.

Pass --wallet-bin PATH_TO_HYPHEN_DISCLOSE to issue a fresh proof with the independent wallet's public devnet fixture seed. The script checks the new scope and expiry, compares the output and opening against the archive, verifies the new Schnorr proof with libsodium and checks rejection with a different seed.

9. Why no new ZK crate is connected yet

A proof-system choice fixes field, curve, setup, recursion, circuit-audit and long-term compatibility assumptions. H-SAC public inputs, migration rules and provenance policy are not frozen. Production integration first requires a frozen F, public inputs and leakage ledger; a maintained externally reviewed proof system; circuit/constraint hashes and parameter generation; positive and negative cross-implementation vectors; soundness, zero-knowledge, side-channel and malformed-proof review; and only then transaction, block, state-root and RPC wiring.

The presence of Circom 2.2.3 proves only that the environment can compile Circom. Hyphen uses Ristretto255/BLAKE3 while ordinary Circom uses the BN254 scalar field. Reducing a 256-bit digest into one signal is non-injective. A sound relation must constrain bit decomposition, BLAKE3 and Ristretto encoding/group equations, or prove binding to a versioned field-friendly relation. See Cryptographic requirements for activation.

The repository has no H-SAC Circom source, R1CS, proving/verifying key, Rust verifier, cross-implementation vectors or external audit report. An "audited H-SAC ZK circuit" is explicitly unfinished.

10. Prior-art boundary

Monero view keys/payment proofs, Zcash viewing/payment disclosure, selective anonymous-credential disclosure, revocable credentials and general ZK/MPC already cover much of this design space. Verifiable starting points are the Zcash Protocol Specification and ZIP-310, and Practical Revocable Anonymous Credentials (FC 2012, DOI 10.1007/978-3-642-32805-3_22). A research contribution should concern task-conditioned leakage after public chain side information, composition budgets and simulations attaining the lower bound, not renaming a view key. Formal novelty still requires systematic literature and patent searches.


H-SAC:合规任务的最小泄漏下界

状态:理论边界与接口规范。当前代码只有单输出明文 opening disclosure,不是本文 所述近最优零知识协议。

1. 问题变量

令:

X : 用户的完整私有状态(金额、opening、真实输入、凭证、交易关系);
P : adversary 在协议前已知的公开链信息;
Y = F(X,P) : 合规任务输出;
V : adversary 最终视图,包括 transcript、公开输出、错误和 timing。

F 必须是可判定的具体任务,例如“选定承诺对应金额之和是否低于阈值”或 “真实来源 credential 是否属于给定 policy root”。“资金合法”不是无需外部信任 即可计算的数学谓词;名单签发、现实身份和政策正确性属于 P 中的外部假设。

所有信息量相对明确分布 (X,P) 定义。没有分布时,Shannon leakage 数字没有 意义;只能给出 worst-case indistinguishability/simulation 定义。

2. 零错误下界

假设 auditor 从 (V,P) 零错误恢复 Y,即

H(Y | V,P)=0.

因为 Y=F(X,P) 是确定函数,链式法则给出:

I(X;V | P)
 = I(X,Y;V | P)
 = I(Y;V | P) + I(X;V | Y,P)
 >= I(Y;V | P)
 = H(Y | P) - H(Y | V,P)
 = H(Y | P).

定理 SAC-N1(任务输出下界)

任何让 auditor 正确判定 Y 的协议,对其视图的条件互信息泄漏至少为

Leak(X -> V | P) >= H(F(X,P) | P).

这是功能本身不可避免的泄漏,不依赖使用 view key、SNARK、MPC 或可信硬件。

3. 有错误版本

令 Y 的值域大小为 M>=2,auditor 输出 Y_hat(V,P),错误率 Pr[Y_hat != Y] <= epsilon。Fano inequality 给出:

H(Y | V,P) <= h_2(epsilon) + epsilon log_2(M-1),

其中

h_2(epsilon)=-epsilon log_2 epsilon
             -(1-epsilon)log_2(1-epsilon).

代回链式法则:

I(X;V | P)
 >= H(Y | P)-h_2(epsilon)-epsilon log_2(M-1).

对 boolean 合规输出 M=2,下界为 H(Y|P)-h_2(epsilon)。允许误判可降低 必要信息,但监管任务通常不能把假阴性/假阳性隐藏在一个未声明的 epsilon 中。

4. 何谓“达到下界”

4.1 完美 task privacy

若

I(X;V | Y,P)=0,

则给定公开信息和必要任务输出后,view 不再包含关于 X 的额外信息。此时

I(X;V | P)=H(Y|P)

(零错误条件下),协议正好达到下界。

等价 simulation 表述:存在 simulator Sim,仅输入 (P,Y),其输出分布与真实 V 相同。密码学协议通常只能要求 PPT adversary 下计算不可区分:

Real(X,P) ~=_c Sim(P,F(X,P)).

这给出 computational near-optimality,而不是无条件 Shannon 等式。

4.2 worst-case transcript 下界

零错误 deterministic auditor 至少要区分 F 在给定 P 下仍可能产生的输出 等价类。若有 R_P=|{F(x,P)}| 个可达输出,则最坏情况 view 至少需要 log_2 R_P bits 的区分能力。该陈述不等于平均互信息,二者不能混写。

5. 多次披露会组合泄漏

对自适应任务 Y_j=F_j(X,P,V_<j) 和联合视图 V_(1:q),正确回答所有任务时:

I(X;V_(1:q) | P) >= H(Y_1,...,Y_q | P)

(有错误时减去对应 Fano 项)。即使每次证明单独是 task-optimal,多次 boolean 查询也可能逐步定位 X。因此 H-SAC 必须有:

  • capability scope 和 task identifier;
  • 查询/披露预算;
  • expiry 与 revocation;
  • 用户可审计的 disclosure log;
  • 禁止 auditor 把窄任务改写成高基数输出。

revocation 只能阻止未来验证或解密,不能让已知 transcript 从 auditor 记忆中消失。

6. 链上公开信息必须先扣除

P 至少包括链 ID、区块时间、交易大小、fee、commitment、nullifier、公开脚本和 网络层可观察信息。下界使用 H(Y|P) 而不是 H(Y),因为公开链可能已经泄漏 任务输出的一部分或全部。

反过来,零知识 proof 不会自动隐藏 timing、proof size、失败原因、RPC source IP 或 capability 请求模式。这些都属于现实 V,必须进入实现 threat model。

7. H-SAC' 候选关系

公开 statement:

Z=(cid, task_id, task_output Y, scope, expiry, auditor_pk,
   selected_commitments, input_nullifiers, policy_root, inclusion_roots).

私有 witness:

W=(values,blindings,spend_secrets,real_ring_indices,
   ownership_paths,policy_credentials,policy_paths).

电路关系 R_F(Z,W)=1 必须同时约束:

commitment openings correct;
ownership/nullifier relation correct;
selected objects included in authenticated chain state;
credential accepted by policy_root;
scope/task_id/auditor/expiry bound into statement;
F(W,public chain facts)=Y;
transaction balance relation holds where relevant.

协议输出应是 auditor-addressed encrypted capability 加零知识 proof。proof 的 auditor binding 不能替代加密:公开包中出现 auditor_pk 只防止跨 auditor 重放, 不能阻止其他拿到包的人读取明文字段。

若最终证明系统对关系 R_F 满足 completeness、knowledge soundness 和 zero knowledge,并存在只用 (P,Y) 的 transcript simulator,则它在计算意义上接近 SAC-N1 下界。还必须单独证明 chain inclusion、credential issuer 和 encryption。

8. 当前实现离下界有多远

crates/hyphen-wallet/src/audit.rs 的 v0 package 明文公开:

chain_id, txid, output/global index, auditor key, scope, validity,
nonce, commitment, one-time public key, amount, blinding, Schnorr proof.

代码现在通过 DISCLOSED_FIELDS_V0 返回机器可读泄漏清单。该包证明金额 opening 和一次性密钥所有权,但 amount 与 blinding 都直接进入 V。如果任务 F 只需要 一个合规 bit,v0 显然远高于 H(F(X,P)|P) 的理论下界。

当前 proof 也不证明:

  • txid 已包含在 canonical chain;
  • global_index 与输出位置一致;
  • 真实 ring input 或来源路径;
  • policy credential;
  • 现实世界“合法性”;
  • 包只对 auditor 可读。

所以 v0 应称 targeted opening disclosure,不应称完整 audit key 或最优选择性透明。

test-vectors/h-sac-payment-v0.json 保存合约开发网付款的交易字节、签名披露、核验全局索引时的区块和链顶。安装 Python 包 blake3 和 rbcl 后,运行 python scripts/test-h-sac-vector.py 可独立复算交易哈希、Pedersen opening、Schnorr 等式和能力标识。钱包回归测试还会解码交易并核对所选输出。hyphen-audit 通过本地节点数据库核验当前规范链位置。

加上 --wallet-bin PATH_TO_HYPHEN_DISCLOSE 可用开发网公开测试种子让独立钱包重新签发披露。脚本校验新范围和有效期,对照归档核对输出和开封,用 libsodium 验证新的 Schnorr 证明,并检查另一种子被拒绝。

9. 为什么此时不接入一个新 ZK crate

通用 proof system 的选择会固定 field、curve、trusted setup、proof recursion、 电路审计和长期兼容性。主链已有冻结的 hyphen-wire 线格式,但 H-SAC 关系的公开输入 schema、 版本迁移规则及 provenance policy 尚未固定。 在这些输入不稳定时接入任意 proving library,只会产生不能证明目标关系的代码。

生产接入前至少需要:

  1. 固定 F、公开输入和 leakage ledger;
  2. 选取维护中且有外审的证明系统;
  3. 固定 circuit/constraint hash 和参数生成流程;
  4. 发布正负向跨实现 vectors;
  5. 做 soundness、zero-knowledge、side-channel 和 malformed-proof 审查;
  6. 再接交易、区块验证、状态根和 RPC。

当前 circom 2.2.3 可执行文件只证明开发环境能编译 Circom 源码,不代表已经定义 正确关系。现有链使用 Ristretto255/BLAKE3,普通 Circom 位于 BN254 标量域;把 256-bit digest 直接取模为一个 signal 不是单射,无法证明原始 digest 相等。必须 约束完整 bit decomposition、BLAKE3 和 Ristretto 编码/群等式,或引入一个与现有 commitment 有严格 binding proof 的版本化 field-friendly relation。详细门槛见 密码学机制的启用条件。

仓库当前没有 H-SAC Circom 源、R1CS、proving/verifying key、Rust verifier 或正负向 跨实现向量,也没有外部审计报告。因此“经过审计的 H-SAC ZK 电路”这一项当前明确 是未完成,而不是通过文档或单元测试可以内部宣告完成的事项。

10. Prior-art 边界

Monero view key/payment proof、Zcash viewing/payment disclosure、匿名凭证选择性披露、 可撤销凭证和通用 ZK/MPC 都已覆盖“向指定方证明部分事实”的大量设计空间。 当前可核验入口包括:

可研究贡献应落在“给定公开链侧信息后的任务条件泄漏、组合查询预算和达到下界的 simulation 证明”,而不是重新命名 view key。正式新颖性仍需系统文献和专利检索。

Clone this wiki locally