How does Merkle Tree Proof-of-Reserves?

Tokenview.io
5 min readNov 29, 2022

--

The collapse of FTX caused yet another collapse of trust in centralised institutions. On November 9, Binance CEO CZ posted that all crypto exchanges should do merkle-tree proof-of-reserves. Then some crypto trading platforms also announced to adopt the Merkle Tree to improve the transparency of platform funds. To the average user, the concept of a Merkle Tree may be unknown.

In fact, before CZ’s suggestion, two trading platforms, Gate and Kraken, had already used Merkle Tree to prove their reserves, and users could verify whether the reserves were sufficient by themselves, but the industry consensus had not been reached. But using Merkle Tree to proof reserves has yet to reach industry consensus.

What is a Merkle tree and why can be used to verify that a centralized organization has 100% reserves? I’ll explain next.

What is Merkle Tree?

Merkle Tree is the basic building block of blockchain technology. Merkle Tree is a structure that allows efficient and secure validation of contents in large amounts of data. This structure helps verify data consistency. Both Bitcoin and Ethereum use Merkle tree.

By separating the validation of data from the data itself, Merkle tree can verify data integrity at a small cost.

Merkle tree has three main benefits:

  1. They provide a way to prove the integrity and validity of data.
  2. They require little memory or disk space because the computation of proofs is simple and fast.
  3. Their certification and management require only a small amount of information to be transferred between networks.

How does MerkleTree work?

Let’s take the example of Merkle tree in Bitcoin and explain how Merkle trees work. This is how Merkle Tree is described in the white paper.

An important scalability feature of Bitcoin is that the block is stored in a multi-level data structure. The “hash” of a block is actually only the hash of the block header, a roughly 200-byte piece of data that contains the timestamp, nonce, previous block hash and the root hash of a data structure called the Merkle tree storing all transactions in the block. A Merkle tree is a type of binary tree, composed of a set of nodes with a large number of leaf nodes at the bottom of the tree containing the underlying data, a set of intermediate nodes where each node is the hash of its two children, and finally a single root node, also formed from the hash of its two children, representing the “top” of the tree.

An important scalability feature of Bitcoin is that the block is stored in a multi-level data structure. The “hash” of a block is actually only the hash of the block header, a roughly 200-byte piece of data that contains the timestamp, nonce, previous block hash and the root hash of a data structure called the Merkle tree storing all transactions in the block.

A Merkle tree is a type of binary tree, composed of a set of nodes with a large number of leaf nodes at the bottom of the tree containing the underlying data, a set of intermediate nodes where each node is the hash of its two children, and finally a single root node, also formed from the hash of its two children, representing the “top” of the tree.

As shown in the figure, A block contains four transactions, A, B, C, and D. Each transaction is hashed to generate hashes A, B, C, and D, which are stored in each leaf node. After that, the pair of leaves node is aggregated into the parent node by hash A and hash B to get the hash AB. Similarly, hash C and hash D, get hash CD. These two hashes (hash AB and hash CD) are then hashed again to generate root hashes (Merkle roots).

Merkle Root

The purpose of the Merkle tree is to allow the data in a block to be delivered piecemeal: a node can download only the header of a block from one source, the small part of the tree relevant to them from another source, and still be assured that all of the data is correct. The reason why this works is that hashes propagate upward: if a malicious user attempts to swap in a fake transaction into the bottom of a Merkle tree, this change will cause a change in the node above, and then a change in the node above that, finally changing the root of the tree and therefore the hash of the block, causing the protocol to register it as a completely different block (almost certainly with an invalid proof-of-work), according to BTC white paper.

Merkle Tree proof-of-reserve

The collapse of FTX dealt another fatal blow to trust in centralised institutions. It also exposes a serious problem of asymmetric information between users and centralized organizations. Where user assets have gone, whether they have been misappropriated, and how to verify the trading platform’s capital reserves.

The existing certificate of reserves is audited by a trusted third party, certifying that the certificate of reserves of the centralized institution is consistent with the certificate of liabilities of the user assets.

In the case of FTX’s collapse, users had no idea whether money they had deposited on the trading platform had been misappropriated.

As an ordinary user, to verify whether the reserve of the current trading platform has changed, we can refer to the principle of Merkle tree and regard each account as a node, and the amount of the account is equivalent to the node data. Users can run a hash calculation on their account to find their node location and the location of adjacent nodes. And then you hashed a root hash.Compare your calculated root hashes with the on-chain data published by the trading platform. If they match, the reserves are correct.This proves that the platform works safely.

Using Merkle Tree to verify the authenticity of CEX reserves is one way to ensure transparency.From the current situation of the crypto industry, using Merkle Tree do prove of reserve seems to be a good choice to improve the user trust problem.

--

--

Tokenview.io
Tokenview.io

Written by Tokenview.io

Our mission is to build Freedom Safe Easy Web3/Crypto world. visit us at https://tokenview.io for General Multi-chain Explorer and Blockchain APIs entrance.

No responses yet