Storage
Midnight is built using the Polkadot SDK (formerly Substrate), and uses ParityDB as its default database backend.
- ParityDB: A fast key-value store designed for blockchain use cases, storing all on-chain state.
- Merkle-Patricia Trie: Used as the underlying data structure for state commitments. This structure ensures state integrity and efficient proofs of inclusion for any on-chain data (e.g., contract state or account balances).
- twoxhash: A non-cryptographic hash function used to generate storage keys within the trie. It is optimized for speed and low collision rates, making it ideal for internal key-value lookups. While not suitable for cryptographic guarantees, it significantly improves trie performance.
All state transitions are committed into this trie and persisted via ParityDB.