Skip to main content

Storage Node

banner

The Storage node has a singular responsibility: storing the complete blockchain history. Though seemingly straightforward, this task involves various components within the AIBlock system, detailed below.

Storage Node Structure

The Storage node consists of two main components:

  • StorageNode: Data structure.
  • StorageInterface: A trait defining many externally-facing methods.

A limited number of Storage nodes, currently under direct management, handle the blockchain's storage. Public miners or users may request to become new Storage nodes, but it's not mandatory for system operation.

The ring of Storage nodes operates collectively under RAFT consensus, receiving blocks from Mempool nodes and ensuring consistency among transactions.

Receiving Blocks

The primary role of the Storage node is receiving blocks through the receive_block method, which involves:

  • Comparing block IDs against received blocks.
  • Matching transactions between blocks with the same ID, flagging non-matching blocks as invalid.
  • Performing RAFT consensus with peer Storage nodes.
  • Saving all valid blocks to the database.

Receiving UNiCORN Values

To validate the correctness of blocks, AIBlock's blockchain utilizes a special value called UNiCORN in combination with a block hash. The Storage nodes handle the preservation of UNiCORN values through the receive_unicorn_table method:

  • Using the UNiCORN's evaluation function to prove the validity of inputs for the provided UNiCORN value.
  • Performing RAFT consensus with peer Storage nodes.
  • Saving the block to the database.

Receiving DRUIDs

Recording the history of DRUIDs is crucial for auditing asset trades. The Storage nodes, via the receive_druids method, handle the storage of DRUIDs by saving them directly to disk. No validation requirement is currently planned for these saves.

Separate storage of DRUID histories is a future plan, and users can manually construct these histories by searching for DRUID-related transactions within the same block.

Storage Node Consensus

For a new block to be successfully added to the blockchain, it must be found valid and replicated across all Storage nodes