neo-project/proposals

Merkle State Proofs

igormcoelho opened this issue · 3 comments

We are proudly to propose a first draft on how Merkle State Proofs could be easily used to validate storage and voting information, also to provide a simple transition to a Neo blockchain without UTXO model.
We would be happy to have more names in this NEP, so if you want to contribute, please join us :)

#74

The general outline of the proposal is to use Merkle Patricia Trees (MPT) to control three different informations: asset balances, voting counts and contract storages.
A Global MPT (GMPT) root hash would be put on block header, mapping scripthashes to Global State (GS) structures. Each GS contains four MPT root hashes: Storage MPT (SMPT), Assets MPT (AMPT), Notifications MPT (NMPT) and Votes MPT (VMPT).

SMPT would map storage keys of that contract to the storage value (and features: constant, ...). Any node can prove that a specific information exists by informing the hash of value in a leaf of the SMPT tree, together with hashes of the up-tree path until SMPT root. So, only a fraction of the Storage is necessary to demonstrate a given NEP-5 balance.

VMPT would map public keys of candidate consensus nodes to a fixed8 value (vote count).

AMPT would map global asset hashes on a fixed8 pair (unspent, direct), which informs total unspent utxo of that asset and available balance for direct transfer (no utxo). Initially, balance is empty for all assets, but transactions including an extra informative byte would direct utxo asset outputs directly to a scripthash balance. After that, it could also be used as input on utxo model (in a specific transaction format: scripthash 20B + zero padding 12B).

Finally, we also propose a Notifications MPT (NMPT), which maps a transaction (of the given scripthash) to the hash of a notification list. This way, any user can prove that a notification occurred in a given transaction.

This proposal needs to be updated, as Global Assets will be removed on Neo 3.0.

We have MPT-based state data now, so this seems to be solved to me.