Implementation Details for UTXO Set Snapshots

Detailed technical implementation of UTXO set authentication using AVL+ tree and comprehensive workflow for pruned full node operation.

Overview

The UTXO set authentication uses an AVL+ tree, outlined in the research paper and available in the Scrypto framework on GitHub. Snapshots are taken every 51,200 blocks (~72 days), specifically after a block where h % 51200 == 51199.

Research Paper

AVL+ tree implementation details and security analysis.

View Research Paper →

Scrypto Framework

Implementation available in the Scrypto framework.

View on GitHub →

Security Analysis

This research paper indicates that this method can be as secure as processing all blocks under certain statistical assumptions.

View Security Analysis →

Implementation Details

Chunk Format

To be provided

Manifest Format

To be provided

Networking Layer

To be provided

Bootstrapping

To be provided

Node Configuration

Bootstrapping with a UTXO set snapshot is enabled by setting ergo.node.utxoBootstrap = true in the configuration.

View Configuration Details →

Sync Info V3

To be provided

Technical Workflow (WIP)

A pruned client downloads all headers, validates proofs-of-work, and links structures, followed by downloading a UTXO snapshot from peers and the full blocks succeeding it. The process is as follows:

1. ErgoSyncInfo

Message to connected peers.

2. Receive INV Message

Receive INV message with better block ids.

3. Request Headers

Request headers for received ids.

4. On Header Reception

if(History.apply(header).isSuccess) {
    if(!(localScore == networkScore)) GOTO 1
    else GOTO 5
} else {
    blacklist peer
}

5. Request UTXOManifest

Request UTXOManifest for at least BlocksToKeep back.

6. On UTXOSnapshotManifest Reception

UTXOSnapshotManifest.chunks.foreach { chunk =>
    request chunk from sender() //Or from random full node
}

7. On UTXOSnapshotChunk Reception

State.applyChunk(UTXOSnapshotChunk) match {
     case Success(Some(newMinimalState)) => GOTO 8
     case Success(None) => stay at 7
     //Request missed chunks periodically
     case Failure(e) => ???
     //Invalid hash or state
}

8. Request BlockTransactions

Request BlockTransactions starting from available State.

History.headersStartingFromId(State.headerId).foreach { header =>
    send message(GetBlockTransactionsForHeader(header)) to Random full node
}

9. On BlockTransactions Reception

Same as Fullnode.7.

10. Operate as Fullnode

Node is now fully operational.

Workflow Summary

This revised workflow streamlines the operation of a pruned full node, emphasizing efficiency and security, positioning Ergo and similar blockchains for broader adoption within the constraints of typical hardware. For a deeper dive into nipopows, you can explore the research paper.

View NiPoPoWS Research Paper →