The merkle binary tree hash of an n-element list D[n] is then defined recursively spil where || is concatenation and D[k1:k2] denotes the list of length (k2 – k1) .

Introduction

This is a specification of the semantic gegevens structures used by blocks and transactions. Thesis gegevens structures and rules are used for validation and hashing. This format is independent from the format for transaction wire serialization.

Block

Transaction

A transaction is composed of a set of entries. Each transaction vereiste include one and only one transaction header, which references other entries te the transaction, which ter turn can reference extra entries.

Every entry is identified by its Entry ID. No two entries ter a transaction may have the same [Entry ID].

Types

LEB128

Little Endian Base 128 encoding for unsigned integers typically used to specify length prefixes for arrays and strings. Values te range [0, 127] are encoded ter one byte. Larger values use two or more bytes.

Rechtschapen

A LEB128 rechtschapen with a maximum permitted value of 0x7fffffffffffffff (Two 63 – 1) and a ondergrens of 0. A varint63 fits into a signed 64-bit oprecht.

String

A binary string with a LEB128 prefix specifying its length te bytes. The maximum permitted length of the underlying string is 0x7fffffff (Two 31 – 1).

The empty string is encoded spil a single byte 0x00, a one-byte string is encoded with two bytes 0x01 0xNN, a two-byte string is 0x02 0xNN 0xMM, etc.

String32

A fixed-length 32-byte string typically used to encode hashes.

SHA3 refers to the SHA3-256 function spil defined te FIPS202 with a fixed-length 32-byte output.

This hash function is used across all gegevens structures and algorithms ter this spec, with the exception of SHA-512 (see FIPS180) used internally spil function H inwards Ed25519 (see RFC8032).

A List is encoded spil a Integer-prefixed list of serialized items, one by one, spil defined by the schema. The length prefix indicates the number of items that go after.

Struct

A Struct is encoded spil a concatenation of all its serialized fields.

Public Key

Te this document, a public key is the 32-byte binary encoding of an Ed25519 (EdDSA) public key, spil defined te RFC8032.

Signature

Ter this document, a signature is the 64-byte binary encoding of an Ed25519 (EdDSA) signature, spil defined te RFC8032.

Auxiliary gegevens structures

Auxiliary gegevens structures are Structs that are not entries by themselves, but used spil fields within the entries.

Extension Struct

An Extension Struct is encoded spil a single 32-byte string. Future versions of the protocol may add extra fields spil Extension Structs that will be compressed ter a single hash for rearwards compatibility.

Pointer

A Pointer is encoded spil a String32, and identifies another entry by its ID.

Pointer restricts the possible acceptable types: Pointer<,X>, voorwaarde refer to an entry of type X .

A Pointer can be nil (not pointing to any entry), te which case it is represented by the all-zero 32-byte hash:

Program

Program encapsulates the version of the VM and the bytecode that should be executed by that VM.

Program Validation

  1. program,
  2. arguments (list of strings),
  3. transaction version (oprecht).
  1. If the VM Version is greater than 1:
  1. If the transaction version is 1, validation fails.
  2. If the transaction version is greater than 1, validation succeeds.
  • If the VM Version is equal to 1:
    1. Instantiate VM version 1 with initial state and expansion flag set to true iff transaction version is greater than 1.
    2. Evaluate the Bytecode with the given arguments.
    3. If the program evaluates successfully, validation succeeds. If the program fails evaluation, validation fails.
    4. Asset Definition

      Asset ID

      Asset ID is a globally unique identifier of a given asset across all blockchains.

      Asset ID is defined spil the SHA3-256 of the Asset Definition:

      Asset Amount 1

      AssetAmount1 struct encapsulates the number of units of an asset together with its asset ID.

      Value Source 1

      An Entry uses a ValueSource to refer to other Entries that provide the value for it.

      Value Source 1 Validation

      1. Verify that Ref is present and valid.
      2. Define RefDestination spil goes after:
      1. If Ref is an Issuance or Spend:
      1. Verify that Position is 0.
      2. Define RefDestination spil Ref.Destination .
    5. If Ref is a Mux :
      1. Verify that Mux.Destinations contains at least Position + 1 ValueDestinations.
      2. Define RefDestination spil Mux.Destinations[Position] .
      3. Verify that RefDestination.Ref is equal to the ID of the current entry.
      4. Verify that RefDestination.Position is equal to SourcePosition , where SourcePosition is defined spil goes after:
        1. If the current entry being validated is an Output1 or Retirement1, SourcePosition is 0.
        2. If the current entry being validated is a Mux , SourcePosition is the index of this ValueSource te the current entry&rsquo,s Sources .
        3. Verify that RefDestination.Value is equal to Value .
        4. Value Destination 1

          An Entry uses a ValueDestination to refer to other entries that receive value from the current Entry.

          Value Destination 1 Validation

          1. Verify that Ref is present. (This means it vereiste be reachable by traversing Results and Sources embarking from the TxHeader.)
          2. Define RefSource spil goes after:
          1. If Ref is an Output or Retirement :
          1. Verify that Position is 0.
          2. Define RefSource spil Ref.Source .
        5. If Ref is a Mux :
          1. Verify that Ref.Sources contains at least Position + 1 ValueSources.
          2. Define RefSource spil Ref.Sources[Position] .
          3. Verify that RefSource.Ref is equal to the ID of the current entry.
          4. Verify that RefSource.Position is equal to DestinationPosition , where DestinationPosition is defined spil goes after:
            1. If the current entry being validated is an Issuance or Spend , DestinationPosition is 0.
            2. If the current entry being validated is a Mux , DestinationPosition is the index of this ValueDestination ter the current entry&rsquo,s Destinations .
            3. Verify that RefSource.Value is equal to Value .
            4. Merkle Root

              A top hash of a merkle tree (binary or patricia). Merkle roots are used within blocks to commit to a set of transactions and accomplish state of the blockchain. They are also used ter merkleized programs and may also be used for structured reference gegevens commitments.

              Merkle Binary Tree

              The protocol uses a binary merkle hash tree for efficient proofs of validity. The construction is from RFC 6962 Section Two.1, but using SHA3–256 instead of SHA2–256. It is reproduced here, edited to update the hashing algorithm.

              The input to the merkle binary tree hash (MBTH) is a list of gegevens entries, thesis entries will be hashed to form the leaves of the merkle hash tree. The output is a single 32-byte hash value. Given an ordered list of n inputs, D[n] = , the MBTH is thus defined spil goes after:

              The hash of an empty list is the hash of an empty string:

              The hash of a list with one entry (also known spil a leaf hash) is:

              For n >, 1, let k be the largest power of two smaller than n (i.e., k <, n ≤ 2k). The merkle binary tree hash of an n-element list D[n] is then defined recursively spil

              where || is concatenation and D[k1:k2] denotes the list of length (k2 – k1) . (Note that the hash calculations for leaves and knots differ. This domain separation is required to give 2nd preimage resistance.)

              Note that wij do not require the length of the input list to be a power of two. The resulting merkle binary tree may thus not be balanced, however, its form is uniquely determined by the number of leaves.

              Merkle Patricia Tree

              The protocol uses a binary radix tree with variable-length branches to implement a merkle patricia tree. This tree structure is used for efficient mededinger updates of the assets merkle root and klein recency proofs for unspent outputs.

              The input to the merkle patricia tree hash (MPTH) is a list of key-value pairs of binary strings of arbitrary length ordered lexicographically by keys. Keys are unique bitstrings of a immovable length (length specified for each example of the tree). Values are bitstrings of arbitrary length and are not required to be unique. Given a list of sorted key-value pairs, the MPTH is thus defined spil goes after:

              The hash of an empty list is a 32-byte all-zero string:

              The hash of a list with one entry (also known spil a leaf hash) is:

              Te case a list contains numerous items, all keys have a common bit-prefix extracted and the list is split ter two lists A and B with elements te each list sharing at least one prefix bit of their keys. This way the top level hash may have an empty common prefix, but nested hashes never have an empty prefix. The hash of numerous items is defined recursively:

              Transactions Merkle Root

              Root hash of the merkle binary hash tree formed by the transaction IDs of all transactions included te the block.

              Assets Merkle Root

              Root hash of the merkle patricia tree formed by unspent outputs version 1 after applying the block. Permits bootstrapping knots from latest blocks and an archived copy of the corresponding merkle patricia tree without processing all historical transactions.

              The tree contains unspent outputs version 1 (one or more vanaf asset ID) where both key and value are the same value — the Output ID of the unspent output.

              Related movie: Bitcoin ATMs Launching te Canada


              Leave your comment