This tutorial introduces the background of BingX Proof-of-Reserves and how to verify individual liabilities in Merkle Tree. Both Bitcoin and Ethereum use Merkle trees.
BingX Proof-of-Reserves utilizes the technique of Merkle Tree, a data structure designed to encrypt blockchain data securely. This technique allows individual users to verify that their funds are included in the attestation.
Merkle root is a straightforward mathematical technique for verifying the data on a Merkle tree. Users can verify the data by calculating their Merkle leafs with Merkle path to get the Merkle root. If the result matches the expected root, you get the proof-of-inclusion.
Users can get the Merkle leaf in BingX proof-of-reserves page, and skip to the Verification. Users can also calculate their Merkle leaf with the following steps below.
Hash your BingX UID with SHA256. All UID of the individuals will be hashed with SHA256 before generating the Merkle tree or handing it over to the auditor. This will ensure independent auditor only sees the users' hashed UID and never any personally identifiable information.
- Check your balance in BingX proof-of-reserves page.
- Combine users' hashed User ID with their assets in the following format. Assets are in the order below.
{Hashed UID},{Asset1}:{Balance1},{Asset2}:{Balance2},{Asset3}:{Balance3},{Asset4}:{Balance4},Total:{TotalValueInUsd}
e.g.
abcdefg,BTC:1.132142,ETH:2.54469871,USDT:20384,USDC:50.3,Total:49875.12599
Use the following number formatting rules to format the balance:
- No Scientific Notation
- Remove trailing zeros: 0.58390000 » 0.5839
- 0 is 0.0: 0.00000000 » 0.0
- Number must start with 0 if the value is between 0 and 1: .532 » 0.532
- Hash the output of step 2 with SHA256
- Get your Merkle path from BingX proof-of-reserves page.
- Get the Merkle root from BingX proof-of-reserves page.
- Run the Python script with the Merkle path
Python 3.4 or above
- Generate the Hashed UID
python por.py hash {uid}
- Generate the Merkle leaf
python por.py hash {asset string}
e.g.
python por.py hash abcdefg,BTC:1.132142,ETH:2.54469871,USDT:20384,USDC:50.3,Total:49875.12599
- Verify the inclusion of the Merkle leaf, compare the result with the Merkle root
python por.py verify {Merkle leaf} {Merkle path}