merkle-proof-validation

Merkle Proof Validation Skill

16 stars

Best use case

merkle-proof-validation is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Merkle Proof Validation Skill

Teams using merkle-proof-validation should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/merkle-proof-validation/SKILL.md --create-dirs "https://raw.githubusercontent.com/plurigrid/asi/main/plugins/asi/skills/merkle-proof-validation/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/merkle-proof-validation/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How merkle-proof-validation Compares

Feature / Agentmerkle-proof-validationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Merkle Proof Validation Skill

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# merkle-proof-validation Skill


> *"Trust but verify. Every leaf proves its tree."*

## Overview

**Merkle Proof Validation** implements cryptographic verification of inclusion proofs. Given a leaf and a path, validate membership in a Merkle tree without the full tree.

## GF(3) Role

| Aspect | Value |
|--------|-------|
| Trit | -1 (MINUS) |
| Role | VALIDATOR |
| Function | Validates Merkle inclusion proofs |

## Core Algorithm

```python
import hashlib

def hash_pair(left: bytes, right: bytes) -> bytes:
    """Hash two nodes together."""
    return hashlib.sha256(left + right).digest()

def verify_merkle_proof(
    leaf: bytes,
    proof: list[tuple[bytes, str]],  # (sibling_hash, position)
    root: bytes
) -> bool:
    """
    Verify a Merkle inclusion proof.

    Args:
        leaf: The leaf value to verify
        proof: List of (sibling_hash, 'left'|'right') pairs
        root: Expected Merkle root

    Returns:
        True if leaf is in tree with given root
    """
    current = hashlib.sha256(leaf).digest()

    for sibling, position in proof:
        if position == 'left':
            current = hash_pair(sibling, current)
        else:
            current = hash_pair(current, sibling)

    return current == root
```

## Move Implementation

```move
module merkle::validation {
    use std::vector;
    use aptos_std::aptos_hash;

    const E_INVALID_PROOF: u64 = 1;

    struct MerkleProof has store, drop {
        leaf: vector<u8>,
        siblings: vector<vector<u8>>,
        positions: vector<bool>,  // true = sibling on left
        root: vector<u8>,
    }

    public fun verify(proof: &MerkleProof): bool {
        let current = aptos_hash::sha3_256(proof.leaf);
        let len = vector::length(&proof.siblings);
        let i = 0;

        while (i < len) {
            let sibling = vector::borrow(&proof.siblings, i);
            let is_left = *vector::borrow(&proof.positions, i);

            current = if (is_left) {
                hash_pair(*sibling, current)
            } else {
                hash_pair(current, *sibling)
            };
            i = i + 1;
        };

        current == proof.root
    }

    fun hash_pair(left: vector<u8>, right: vector<u8>): vector<u8> {
        let combined = vector::empty<u8>();
        vector::append(&mut combined, left);
        vector::append(&mut combined, right);
        aptos_hash::sha3_256(combined)
    }
}
```

## Proof Structure

```
                    Root
                   /    \
                  /      \
                H01      H23
               /   \    /   \
              H0   H1  H2   H3
              |    |   |    |
             L0   L1  L2   L3  ← Leaves

Proof for L1: [(H0, left), (H23, right)]
Verify: hash(H0 || hash(L1)) → H01
        hash(H01 || H23) → Root ✓
```

## GF(3) Integration

```python
class GF3MerkleValidator:
    """Merkle validation with GF(3) conservation."""

    TRIT = -1  # VALIDATOR role

    def validate_batch(self, proofs: list) -> dict:
        """
        Validate batch of proofs.
        Each validation is a MINUS operation.
        """
        results = []
        for proof in proofs:
            valid = self.verify(proof)
            results.append({
                'leaf': proof.leaf,
                'valid': valid,
                'trit': self.TRIT  # -1 for validation
            })

        # GF(3) check: need balancing generators
        trit_sum = len(proofs) * self.TRIT
        return {
            'results': results,
            'trit_sum': trit_sum,
            'needs_generators': -trit_sum  # To balance
        }
```

## IECsat Integration

For hierarchical tile validation:

```python
def validate_tile_inclusion(
    tile_code: str,      # e.g., "9C3XGV2F+QQ"
    tile_hash: bytes,
    root_tile: str,      # e.g., "9C3XGV2F+"  (10-char)
    proof: list
) -> bool:
    """
    Validate that a fine tile belongs to a root tile's Merkle tree.

    On-chain: 10-char root tiles with Merkle roots
    Off-chain: 11-17 char tiles with proofs
    """
    # Verify the Plus Code hierarchy
    assert tile_code.startswith(root_tile.rstrip('+'))

    # Verify Merkle inclusion
    return verify_merkle_proof(tile_hash, proof, get_root(root_tile))
```

## GF(3) Triads

```
merkle-proof-validation (-1) ⊗ iecsat-storage (0) ⊗ aptos-gf3-society (+1) = 0 ✓
merkle-proof-validation (-1) ⊗ datalog-fixpoint (0) ⊗ anoma-intents (+1) = 0 ✓
merkle-proof-validation (-1) ⊗ spi-parallel-verify (0) ⊗ polyglot-spi (+1) = 0 ✓
```

## Commands

```bash
# Generate Merkle proof (Python)
python3 -c "
from merkle import MerkleTree
tree = MerkleTree(leaves)
proof = tree.get_proof(leaf_index)
print(proof.to_json())
"

# Verify on-chain (Move)
aptos move run --function merkle::validation::verify --args ...
```

---

**Skill Name**: merkle-proof-validation
**Type**: Cryptographic Verification
**Trit**: -1 (MINUS - VALIDATOR)
**GF(3)**: Validates inclusion proofs


## Scientific Skill Interleaving

This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:

### Graph Theory
- **networkx** [○] via bicomodule
  - Universal graph hub

### Bibliography References

- `cryptography`: 1 citations in bib.duckdb

## Cat# Integration

This skill maps to Cat# = Comod(P) as a bicomodule in the Prof home:

```
Trit: 0 (ERGODIC)
Home: Prof (profunctors/bimodules)
Poly Op: ⊗ (parallel composition)
Kan Role: Adj (adjunction bridge)
```

### GF(3) Naturality

The skill participates in triads where:
```
(-1) + (0) + (+1) ≡ 0 (mod 3)
```

This ensures compositional coherence in the Cat# equipment structure.

Related Skills

wycheproof

16
from plurigrid/asi

Google's Wycheproof test vectors for cryptographic implementation testing.

skill-validation-gf3

16
from plurigrid/asi

Skill Validation GF(3) - SLAVE (-1)

proof-of-frog

16
from plurigrid/asi

Proof-of-Frog Skill 🐸

paperproof-validator

16
from plurigrid/asi

Formal Proof Visualization and Verification for Lean 4

narya-proofs

16
from plurigrid/asi

Mechanically verified proofs from Narya event logs. Verifies queue consistency, replay determinism, non-leakage, and GF(3) conservation. Use for proving system invariants, audit trails, or formal verification of event-sourced systems.

lean-proof-walk

16
from plurigrid/asi

GF(3)-balanced random walk through Lean proof states. Use when generating formal proof chains with parallel triad verification. Invokes 3 agents (Generator +1, Coordinator 0, Validator -1) to traverse proof space via prime geodesics.

implementing-zero-knowledge-proof-for-authentication

16
from plurigrid/asi

Zero-Knowledge Proofs (ZKPs) allow a prover to demonstrate knowledge of a secret (such as a password or private key) without revealing the secret itself. This skill implements the Schnorr identificati

implementing-proofpoint-email-security-gateway

16
from plurigrid/asi

Deploy and configure Proofpoint Email Protection as a secure email gateway to detect and block phishing, malware, BEC, and spam before messages reach user inboxes.

implementing-email-sandboxing-with-proofpoint

16
from plurigrid/asi

Email sandboxing detonates suspicious attachments and URLs in isolated environments to detect zero-day malware and evasive phishing payloads. Proofpoint Targeted Attack Protection (TAP) is an industry

implementing-continuous-security-validation-with-bas

16
from plurigrid/asi

Deploy Breach and Attack Simulation tools to continuously validate security control effectiveness by safely emulating real-world attack techniques across the kill chain.

implementing-api-schema-validation-security

16
from plurigrid/asi

Implement API schema validation using OpenAPI specifications and JSON Schema to enforce input/output contracts and prevent injection, data exposure, and mass assignment attacks.

self-validation-loop

16
from plurigrid/asi

Run self-validation loops for triadic color systems using prediction vs observation and error minimization.