Verification

Or: What’s a valid Nimiq blockchain?

Blockchain Verification

Of the three client types, a full client synchonizes the entire chain, while nano and light clients can skip major parts of chain due to a chain proof based on NIPoPoW—Non-Interactive Proofs of Proof-of-Work. The chain verification is split in two parts. First, during the suffix part, the client will build a complete list of 120 blocks starting from the header block. Nano clients will also drop the body part of each block to reduce load. From the last block of the suffix, the prefix will start by using the interlink to connect to the genesis block via the most difficult blocks in the chain and this way skipping major parts of the remaining blockchain.

After intializing, a node will keep listening for new blocks to keep up with the blockchain. In case it receives more than one node as the immediate successor, it will choose the more difficult one (cf. difficulty adjustment for details).

Verify Block Order

Every block needs to be a valid successor of another block (besides the genesis block).

A block is a valid successor if it is the immediate successor of the known previous block (and the interlink is valid, cf. verify interlink.

Verify Immediate Successor

Each block needs to be an immediate successor of the previous block.

Rules comparing this block with the previous block:

Rules to verify if this block has a valid predecessor in the interlink:

Verify

Verify Block

See block for all the fields of a block.

Rules

Verify Header

Verfiy Body

Transaction Order

Transaction fields are compared by in following order:

  1. Recipient
  2. Validity start height: low first
  3. Fee: higher first
  4. Value: higher first
  5. Sender
  6. Recipient type
  7. Sender type
  8. Flags

As soon as one field is not the same, the block can be ordered accordingly. Unless the field is a paricular number, the order is detemind by the bytes in the field, lower first (e.g. addresses, types, flags).

Verify Transaction

Valid Incoming and Outgoing Transactions

Basic accounts accept any kind of transaction. Outgoing transactions must have a valid signature for all the fields of a extended transaction, without type, proof length, and proof.

Verify Signature Proof