Beersy
BRC-60

Simplifying State Machine Event Chains in Bitcoin

Recording a long series of events on chain by chaining one transaction to the next gets expensive and slow. This describes carrying the same history as a chain of hashes inside a single transaction that keeps being updated instead.

Ty Everett4 min read
event1event2event3

Summary

Why
Chaining every event as its own dependent transaction becomes computationally expensive and unwieldy as an event sequence grows long.
What
BRC-60 describes a method for recording long event sequences using a single non-final Bitcoin transaction whose outputs form a , instead of a chain of dependent transactions.
How
Each event is written into an output of one transaction with an incrementing sequence number and a hash of the previous event, so the outputs link together into a verifiable hash chain that anyone holding the events can check.

What this lets you do

  • Record many sequential events using only one on-chain transaction
  • Detect tampering because changing any event breaks the hash chain
  • Avoid the cost of creating a new transaction per event
  • Audit the full event history by replaying the hash chain
  • Scale event tracking without growing on-chain transaction count

Written by claude-sonnet-5 from the specification text. Where the two differ, the original is correct.

Reference for an AI

Everything an assistant needs to answer questions about BRC-60 accurately, including what it depends on.

The specification

Abstract

This document explores an alternative approach to managing long chains of events on Bitcoin's blockchain: using a single coupled with a , rather than creating lengthy chains of dependent transactions. By incrementing sequence numbers and including the hash of preceding events in subsequent events, this approach significantly reduces computational requirements and transaction costs while preserving auditability. The inherent security of hash chains further ensures the integrity of event chains, making this method more efficient and reliable compared to the conventional approach.

Introduction

The proliferation of blockchain technology, especially Bitcoin, has spawned a myriad of innovative use-cases. A prominent one is tracking long chains of events on the blockchain to create an auditable, immutable record. Historically, this has been achieved by creating chains of dependent transactions, where each event in the chain corresponds to a spend of a (UTXO) that represents the event chain. While effective for some use-cases, this model encounters challenges when applied to very large sequences of events. It also imposes significant computational burdens on network nodes, resulting in escalating transaction costs.

In this document, we propose a more efficient and cost-effective method to achieve the same objectives by utilizing a simple hash chain within a non-final transaction, rather than creating long chains of dependent transactions. The primary advantage lies in its ability to deliver the same benefits - traceability, auditability, and immutability - with reduced complexity and cost.

Background

Bitcoin's blockchain technology is essentially a distributed ledger that stores a chain of blocks, each containing a list of transactions. A long chain of dependent transactions is a model in which every event in an event chain is appended as a new transaction consuming and recreating a UTXO.

The UTXO (Unspent Transaction Output) model is used in Bitcoin to track ownership of coins. In this model, transactions consume one or more UTXOs and create one or more new UTXOs.

A hash chain is a succession of data hashes where each hash contains the hash of its predecessor. This creates an immutable sequence, as altering any element in the chain would necessitate recomputing all following hashes, a computationally impractical task.

Discussion: Hash Chains versus Dependent Transactions

In our proposed model, rather than appending each new event as a spend of a UTXO, a non-final transaction is created for the entire chain of events. The first event is put into an output of the transaction, and for each subsequent event, the sequence number is incremented, and a hash of the previous event is included in the new event. Consequently, the transaction is continually updated with new events, building a hash chain. The final output includes the final event's data and the hash of the previous event.

This method implies that only one transaction is registered on-chain, but anyone with the correct set of events can easily validate that the events in the chain were properly recorded. No one can tamper with the set of events in the chain because this would break the hash chain. This method simplifies the recording of long chains of events on-chain, without the need for large sets of dependent transactions.

The key advantages of this approach are:

  1. Computational Efficiency: Creating a hash chain within a single transaction drastically reduces the computational load compared to creating a long chain of dependent transactions. This efficiency directly translates to a reduction in transaction costs and improved scalability.

  2. Integrity and Security: The immutable nature of the hash chain ensures the integrity and security of the event sequence. Any attempts to alter the events would disrupt the hash chain, making tampering evident and practically impossible.

  3. Auditability: Similar to the traditional approach, the proposed method preserves the ability to trace back and validate the history of each event in the sequence. This auditability is essential for many applications of blockchain technology.

  4. Reduced Complexity: By consolidating the event chain into a single transaction, the process is simplified and more manageable. This reduction in complexity not only improves efficiency but also makes it easier for users and developers to interact with and understand the event chain.

  5. Scalability: As the number of events in the chain grows, the relative benefit of using this approach over dependent transactions increases, making it a more scalable solution for large event chains.

In conclusion, by replacing long chains of dependent transactions with a single non-final transaction and a hash chain, we present a more efficient and cost-effective approach to record long chains of events on Bitcoin's blockchain. This model exhibits the same traceability, auditability, and immutability as the conventional approach but with significantly reduced complexity and transaction costs. This simplification of event chains on Bitcoin offers promising potential for a wide array of applications, including smart contracts, supply chain tracking, and digital identity verification. As blockchain technology continues to evolve, the exploration and adoption of such innovative solutions will be crucial for improving efficiency and scalability.

Was this helpful?

Search Beersy

Search standards by number, title, author or topic