Skip to content

Latest commit

 

History

History
87 lines (60 loc) · 3.25 KB

ecmh-utxo-commitment-0.mediawiki

File metadata and controls

87 lines (60 loc) · 3.25 KB

  BIP: utxo-commitment-0
  Title: UtxoCommitment version 0
  Author: Tomas van der Wansem <[email protected]>
  Created: 2018-05-31
  License: PD

Table of Contents

Abstract

This BIP describes the construction of a 32-byte hash that is uniquely defined for a UTXO set, that is, the set of all unspent transaction outputs that exist at a certain block in the blockchain. It also includes a recommendation for its inclusion in blocks.

The recommended UTXO commitment is considered version 0. It is recommended to be included but is not verified as part of the block validation rules and is therefore purely informational.

Motivation

Currently full nodes need to download all historical blocks in order to construct the current UTXO state. The UTXO state is needed in order to verify incoming transactions. This proposal works towards a model where new full nodes can download only the UTXO state, and verify its correctness against recent blocks.

The changes required to enable fast syncing can be divided in 4 stages:

  1. Maintain and include an informational UTXO commitment in the coinbase.
  2. Implement utxo/getutxo P2P messages to allow transfer of UTXO subsets
  3. Verify the UTXO commitment as part of the block validation rules.
  4. Implement a fast-syncing bootstrap method.
This specification covers the first step.

Specification

We define the UTXO set of a block X, as the set of all transaction outputs that are unspent before processing of block X and for which

  • the redeemScript of the output is at most 10000 bytes.
  • the first byte of the redeemScript is not 0x6a (OP_RETURN).
Note that these criteria are included to prevent storing unspendable outputs, and match the current behaviour of implementations.

The serialized UTXO set is the set of byte sequences constructed by serializing each output of the UTXO set as:

Field Size Description Data type Comments
32 txid char[32] The id of the transaction
4 index uint32_t The index of the output within the transaction
4 height, is_coinbase VARINT The least significant bit is set if this is a coinbase output. The other 31 bits represent the height
8 value int64_t The amount in satoshi
4 pk_script_len VARINT The size in bytes of pk_script
? pk_script uchar[] The Bitcoin script that defines the conditions to claim this output.

Note that the serialization is not compressed, but compression can be used in transferring UTXO sets and proofs.

The UTXO commitment for block X is the ECMH commitment of the serialized UTXO set as defined in [1].

Block X contains a UTXO commitment version 0 if its coinbase transaction has an output whose redeemScript consists of the 38 bytes

  • 0x6a (OP_RETURN)
  • 0x24 (OP_PUSHDATA36)
  • 0x55 0x54 0x58 0x30 (MAGIC)
  • 32 byte hash
The UTXO commitment is a valid UTXO commitment version 0 if the hash equals the UTXO commitment for the block. If a block contains an invalid UTXO commitment it should still be accepted, although the implementation may issue appropriate warnings.

Implementation

https://reviews.bitcoinabc.org/D1474

References

[1] https://github.com/tomasvdw/bips/blob/master/ecmh.mediawiki

Copyright

This document is placed in the public domain.