Data Insertion Mechanism

Understanding how Pay2Ingot embeds data into the Tondi network

Data Insertion Mechanism

Overview

Ingot employs the Pay2Ingot output type to embed data into the Tondi network, ensuring efficient data storage and avoiding UTXO bloat, thereby maintaining the network's scalability and longevity.

Pay2Ingot Output Type

Pay2Ingot is a new transaction output type identified by ScriptPublicKey.version = 2. It acts as a container for digital assets, committing to payload data, authentication policies, and metadata.

Output Structure

The Pay2Ingot output contains the following fields:

pub struct IngotOutput {
    pub version: u8,              // Version (0x01, fixed)
    pub schema_id: Hash,          // Schema ID (32B blake3 hash)
    pub hash_payload: Hash,       // Payload hash (32B blake3 hash)
    pub flags: IngotFlags,        // Flags (u16, bit 0=REVEAL_REQUIRED)
    pub lock: Lock,               // Locking mechanism
    pub mast_root: Option<Hash>,  // MAST root (32B, optional)
}

Field Descriptions

  • version: Protocol version identifier (currently 0x01)
  • schema_id: 32-byte hash identifying the asset schema (routes to state machine)
  • hash_payload: 32-byte BLAKE3 hash committing to the payload data
  • flags: Control bits (currently only REVEAL_REQUIRED flag)
  • lock: Authentication mechanism (None, PubKey, ScriptHash, or MastOnly)
  • mast_root: Optional Merkle root for privacy-preserving spending paths

Commit-Reveal Pattern

Ingot supports a two-phase commit-reveal pattern for large payloads:

Phase 1: Commit

In the commit phase, a small transaction is broadcast containing only the Pay2Ingot output header with REVEAL_REQUIRED=false:

  • Contains only the output structure (Schema ID, Hash Payload, Flags, Lock)
  • Establishes asset commitment on-chain with minimal fees
  • High propagation success rate due to small size
  • Asset ownership is secured immediately

Phase 2: Reveal

In the reveal phase, the full payload is revealed in a later transaction:

  • Spends the committed Ingot UTXO
  • Reveals full payload data in witness
  • Can use CPFP (Child-Pays-For-Parent) or RBF (Replace-By-Fee) for fee optimization
  • Large payload size may require fee optimization strategies

Benefits:

  • Separates commitment (immediate, cheap) from revelation (deferrable, optimized)
  • Enables creators to establish asset ownership quickly
  • Allows deferring full data publication until fees are optimal

Hash Commitment

All payload data is committed using BLAKE3 hashing:

HASH_PAYLOAD = blake3("Ingot/payload" || canonical_bytes)

Where canonical_bytes is the DAG-CBOR normalized encoding of the payload.

Validation

L1 consensus layer validates:

  • blake3(payload) == hash_payload (commit-reveal integrity)
  • Payload hash must match between output and witness
  • Hash mismatch results in transaction rejection

Payload Structure

Payloads are encoded using DAG-CBOR (Deterministic CBOR) with TLV (Type-Length-Value) format:

TLV Encoding Rules

  • Type ascending: TLV types sorted by numerical value ascending
  • Same Type multiple values: Sorted by value lexicographically
  • Integer encoding: Uniformly use little-endian (LE)
  • Prohibit zero prefix: Integers cannot have leading zeros
  • String encoding: UTF-8 encoding

Payload Limits

  • L2 Recommended: โ‰ค 84.5 KiB payload
  • Physical Constraint: Tondi mass โ‰ค 100,000 (automatically limits actual size)
  • L1 Validation: Only verifies hash, doesn't enforce size limits

Resource Efficiency

Avoiding UTXO Bloat

Unlike protocols that contribute to UTXO bloat, Ingot:

  • Uses a single Pay2Ingot output per transaction (L1 consensus rule)
  • Commits to data via hash rather than storing all data in UTXO set
  • Supports commit-reveal pattern to minimize initial transaction size
  • Leverages Tondi's DAG architecture for efficient block propagation

Fee Calculation

Fees are calculated based on transaction size:

  • Default: fee = base_fee + rate * total_bytes(tx)
  • Includes header, witness, and Pay2Ingot payload bytes
  • Byte-based billing ensures fair resource allocation
  • High fees cannot bypass hard limits

Integration with Tondi

Mixed Transactions

Ingot outputs can be mixed with traditional Value UTXOs in the same transaction:

  • Pay fees using Value UTXOs
  • Create Ingot outputs for asset data
  • Support change outputs
  • Full compatibility with existing Tondi transaction model

Network Activation

Ingot activates via hard fork:

  • Mainnet: v1.0 @ 51,840,000 DAA (activates ~2 months later, 10 BPS)
  • Testnet: v1.0 @ 100,000 DAA (activates ~2.8 hours later, 10 BPS)
  • Devnet: v1.0 @ 0 (activates immediately from genesis)

Security Considerations

Fail-Closed Principle

Ingot follows a fail-closed security model:

  • Unknown fields/enums โ†’ transaction rejected
  • Unknown version โ†’ transaction rejected
  • Reserved bits set โ†’ transaction rejected
  • Ensures security by rejecting anything unfamiliar

Hash Integrity

All payload data is protected by cryptographic hashing:

  • Payload hash committed in output
  • Witness must reveal matching payload
  • Hash verification at L1 consensus level
  • Prevents tampering and ensures data integrity

Previous: Introduction | Next: oUTXO Model