hirosystems / ordhook

Build indexers, standards and protocols on top of Ordinals and Inscriptions (BRC20, etc).
Apache License 2.0
186 stars 55 forks source link

Introducing `inscriptions-sequence-consensus-hash` #223

Open lgalabru opened 10 months ago

lgalabru commented 10 months ago

Following up on https://github.com/ordinals/ord/issues/2574.

Objective

The primary objective is to create a robust mechanism for ensuring data integrity and consistency across ordinal indexers. This involves introducing a consensus hash built using a Merkle root, derived from blockchain events. This enhancement aims to address the current limitations in the ordinals protocol, particularly in improving provability.

Problem

The current system is lacking of a consensus hash, limiting capabilities in detecting regressions and indexing divergences. To overcome these limitations, we propose the generation of a Merkle root. This root will be derived from specific blockchain events, namely inscription reveals and transfers. By employing cryptographic consensus hashes in the form of a Merkle root, ordinal indexers can enhance their upgrade process, establish verifiable checkpoints, and prevent the publication of inaccurate indexes.

Proposed Protocol

Event Types for Consideration

Inscription events

A satoshi being inscribed per the rules of a given sequence, would be augmenting the said sequence:

0        1        2                18               52              72                   74                  82
|--------|--------|-----------------|----------------|---------------|--------------------|-------------------|
 Sequence  Action   Ordinal Number    Inscription ID   Content hash    Output post-reveal  Offset post-reveal  

Transfer events

0        1        2                  36                         80                         124
|--------|--------|-------------------|-------------------------|---------------------------|
 Sequence  Action    Inscription ID      Satpoint pre-transfer      Satpoint post-transfer      

Outcome

Implementing this protocol will lead to:

raphjaph commented 10 months ago

How would the Merkle tree be built exactly?

Just the hash of these events paired up sequentially by the order they occur?