Skip to content

Latest commit

 

History

History
80 lines (52 loc) · 6.64 KB

0095.md

File metadata and controls

80 lines (52 loc) · 6.64 KB

BRC-95: Atomic BEEF Transactions

Ty Everett ([email protected])

Abstract

This BRC defines Atomic Background Evaluation Extended Format (Atomic BEEF) Transactions, a variant of the BEEF transaction format (as defined in BRC-62) that focuses on atomicity—specifically, ensuring that all the data within a BEEF structure relates to a single "subject transaction." This format disallows unrelated transactions within the BEEF structure, reinforcing a clear, minimalistic data set for transaction validation while maintaining efficiency in bandwidth usage.

Atomic BEEF is designed to solve problems arising from multiple graphs of unrelated transactions being aggregated into a single BEEF, which can complicate validation and increase data complexity. Atomic BEEF introduces a strict structure optimized for single-transaction use cases, ensuring that every transaction in the BEEF relates to a defined subject transaction. This format is particularly suited for applications where the verification of a singular transaction and its direct ancestry is critical.

Motivation

The introduction of the BEEF format (BRC-62) provided a solution for transmitting transaction data in a binary format to allow Simplified Payment Verification (SPV) with minimal bandwidth. However, BEEF allows the inclusion of multiple, potentially unrelated transactions aggregated within the same structure, making it flexible but not ideal for cases where strict atomicity is needed.

Atomic BEEF is motivated by the following challenges:

  1. Transaction Ambiguity: In BEEF, there is no explicit constraint to keep transactions related to a single subject transaction. This can lead to ambiguity when unrelated transaction graphs are included in the same BEEF structure, making validation and verification more complex.
  2. Simplified Use Cases: Many use cases of SPV revolve around validating a single payment or transaction, not multiple. Atomic BEEF optimizes for this by focusing entirely on the recursive transaction graph relevant to a specific transaction.
  3. Data Minimalism: For micropayments or systems requiring highly efficient data transfer, limiting the number of transactions included in the BEEF to only the required set for validation of a single subject transaction reduces unnecessary overhead.
  4. Streamlined Validation: By restricting the BEEF to a single subject transaction and its dependencies, Atomic BEEF reduces the complexity of the validation process, as there is a clear expectation of the data's scope.

In response to these motivations, Atomic BEEF introduces a new mechanism for enforcing the atomicity of BEEF transactions.

Specification

Atomic BEEF is an extension of BEEF (BRC-62) with specific structural and validation rules that ensure atomicity. It adheres to the same encoding and transaction structure principles, with the following additional constraints:

Header Structure

Atomic BEEF introduces a unique header prefix that ensures the atomicity of the BEEF structure. The Atomic BEEF format starts with a constant prefix followed by the TXID of the "subject transaction." This TXID serves as the reference transaction that the entire BEEF structure must relate to.

  • Prefix: The first 4 bytes of the Atomic BEEF structure must be 0x01010101, a fixed constant to indicate Atomic BEEF.
  • Subject TXID: The next 32 bytes are the TXID of the "subject transaction"—the primary transaction that the rest of the structure must validate and verify.
Field Description Size
Atomic Prefix Fixed constant 0x01010101, indicates the start of an Atomic BEEF structure 4 bytes
Subject TXID The TXID of the subject transaction that this BEEF structure will validate 32 bytes

Transaction Inclusion Rules

Atomic BEEF strictly enforces that all transactions included in the structure must be part of the subject transaction's dependency graph. This means that every transaction in the BEEF structure must either be:

  1. The subject transaction itself, or
  2. An ancestor transaction required to validate the inputs of the subject transaction.

Transactions that fall outside of this graph, or are unrelated, are not allowed in Atomic BEEF. This ensures that the BEEF is entirely focused on a single, verifiable transaction and its direct dependencies.

Validation Process

The validation of an Atomic BEEF structure follows these steps:

  1. Subject Transaction Identification:

    • The first step in validation is to extract the subject TXID from the header. If the BEEF structure does not include the subject transaction or if any unrelated transactions are present, the validation fails.
  2. Transaction Graph Validation:

    • The BEEF structure must contain all transactions necessary to validate the subject transaction, recursively including all ancestor transactions up to the point where each input can be confirmed with a Merkle proof.
    • The structure must not contain any transactions that are not part of the subject transaction's dependency graph.
  3. Merkle Proof Validation:

    • As with the original BEEF format, any included transactions that have been mined must be accompanied by BSV Universal Merkle Path (BUMP) data to prove their inclusion in the longest chain of blocks.
    • The Merkle roots derived from the BUMP data are verified against the local header service.
  4. Final Transaction Validation:

    • The final validation is complete when all necessary transactions (including script evaluations) and proofs have been processed, and the subject transaction is confirmed to be valid based on its dependencies.

Error Conditions

Atomic BEEF introduces two specific error conditions that must cause validation to fail:

  1. Missing Subject Transaction: If the BEEF structure does not include the subject transaction identified by the subject TXID in the header, validation fails.
  2. Unrelated Transactions: If any transactions within the BEEF structure fall outside the dependency graph of the subject transaction, validation fails.

These error conditions ensure that Atomic BEEF maintains strict atomicity and avoids the ambiguity and complexity of unrelated transactions within the same structure.

Bytewise Breakdown:

01010101 // Atomic BEEF Prefix
2222222222222222222222222222222222222222222222222222222222222222 // Subject TXID
0100beef // Start of standard BEEF structure...
...