Child chain anchors (CNOT)
Protocol and consensus12.5.12+

Child chain anchors (CNOT)

Child chain blocks notarized in the coinbase of a Lotus block: layout, index rules and routes.

A Lotus block may notarize a block of a child chain: its coinbase carries the child chain's id, the height and the hash of a block that the node which built it checked. What an anchor says, and does not say: the Child chains and notarization page. It is not consensus: a block without an anchor, or with one that does not decode, is valid like any other.

Byte layout #

One eMPP segment, in an OP_RETURN OP_RESERVED <push> output of the coinbase of its own. Integers are little-endian.

OffsetSizeField
04LOKAD CNOT (43 4e 4f 54)
41version, 1
51type, 1 = tip anchor
61child chain id (1 = Child chain 1)
74child block height
1132child block hash

43 bytes; the output is 55 bytes. Type 2 (a range of blocks with a Merkle root) is reserved and not built.

Rules of the index #

  1. A coinbase carries at most one tip anchor. With two or more, or one of the wrong length, of a chain the network does not have, at or below the fork block, or with a null hash, the index records none for that block.
  2. A segment of another version, or of an unknown type, is ignored.
  3. An anchor counts as a notarization only on a node that checked the child block it names (status notarized); otherwise it is claimed_unchecked.
  4. A Lotus reorganisation removes the anchors of the disconnected blocks. After a child chain reorganisation an anchor stays: branch is left while the node holds that branch (288 blocks), then unknown and claimed_unchecked, unless a Lotus block recorded the header.

Database: childchains.sqlite, in the data directory. Routes: childchains/<name>/anchors, childchains/<name>/notarized/<block>, childchains/anchors/by-block/<block> (12.5.13).

Source files #

  • doc/child-chains.md, src/childchain/, src/api/childchain_handler.cpp
Source doc/protocols/cnot.md in the lotusd repository