• Narwhal is a DAG-based mempool abstraction protocol

  • It was proposed with the approach of first splitting the concerns of:

    • making transactions available across the network
    • preparing a total-order in consensus with the honest nodes of the network
  • Tusk is the sample consensus protocol made in the Narwhal paper to demonstrate this new way of doing things

  • Blocks of transactions in the narwhal mempool contain not just a serial ordering of transactions but also a serial ordering of past referenced transaction blocks (which can be done with their headers, without the need of the block contents)


  • It uses a key-store to record transaction blocks indexed by their digests (hashes) with the following operations:
    • read(d) returns the block indexed by the provided digest
    • write(d,b) writes a given block to the store
    • read_causal(d) returns the transitive set of all blocks that the block identified by d references (transitive meaning that the definition is recursive and for a block a referenced by a block b referenced by a block c, block a is also a valid element in block c’s defined operation)

  • With the above operations allowed on it, the Narwhall mempool guarantees the following properties:
    1. any two invocations of reading the block for a given digest by honest parties returns the same value (if any value at all)
    2. an honest party that successfully invoked writing a new block will successfully invoke reading that same block for its digest
    3. the set returned from read_causal(d) is an improper superset of the set returned by one of the blocks that the block indexed with d references
    4. the set returned by invoking read_causal(d) returns at least 66% of the blocks written successfully before the invocation of writing them (see point 2)
    5. at least 50% of the blocks returned by an invocation of read_causal(d) were written by honest parties

Source Code

Analysis of source of a reference implementation of Narwhal-Tusk written by Alberto Sonnino, one of the authors of the whitepaper:

Crates

CrateDescription
nodeMain entry point binary cli (node/src/main.rs) that can either generate keys, spawn a primary process (which also starts a consensus thread to run the Tusk consensus protocol) or spawn a worker process
primaryContains the logic to start the primary process which listens for connections from its workers and primary nodes on other validators TODO
workerContains the logic to start the worker process with logic to handle messages from client transactions, from workers on other validators, and finally from the primary on the same validator TODO
consensusContains the logic for the Tusk consensus protocol TODO
storeContains the key-store which receives the following commands:
  • Read(key, channel) “immediately send value corresp. to this key to me”
  • NotifyRead(key, send) “send value corresp. to this key the next time a value is written to it”
  • Write(key, value) “immediately write a value at this key”
networkUtility library for abstracting message sending (unreliable and reliable) and message receiving over a TCP stream
cryptoUtility library for cryptography-relevant types and functions (Digest, Hash, PublicKey & SecretKey, generate_production_keypair, generate_keypair, Signature & SignatureService)
configLogic to read & deserialize a JSON config file to configure Narwhal, including the Committee composition

Links