From 4abeb06f655f84794715b9cb15609538eac8c5e6 Mon Sep 17 00:00:00 2001 From: Jason <185968242+Allenqel@users.noreply.github.com> Date: Wed, 11 Dec 2024 00:34:48 -0800 Subject: [PATCH] Create Bitget import hashlib def sha256_hash(data): """Hashes the input data using SHA-256.""" return hashlib.sha256(data.encode('utf-8')).hexdigest() def build_merkle_root(leaf_hashes): """Builds the Merkle root from a list of leaf hashes.""" if len(leaf_hashes) == 1: return leaf_hashes[0] # Root reached # If odd number of leaves, duplicate the last one if len(leaf_hashes) % 2 != 0: leaf_hashes.append(leaf_hashes[-1]) # Pairwise hash leaves parent_hashes = [] for i in range(0, len(leaf_hashes), 2): combined_hash = sha256_hash(leaf_hashes[i] + leaf_hashes[i + 1]) parent_hashes.append(combined_hash) return build_merkle_root(parent_hashes) # Provided Merkle leaves (from the data) merkle_leaves = [ "8cf0243a2c76fe0b", # Path 1 "8306844dff98ba79", # Path 2 "94d0d60f7cdce5fe", # Path 3 "cb575fb1eb6462f9", # Self ] # Compute Merkle Root calculated_merkle_root = build_merkle_root(merkle_leaves) print(f"Calculated Merkle Root: {calculated_merkle_root}") --- Bitget | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Bitget diff --git a/Bitget b/Bitget new file mode 100644 index 0000000..4f3e064 --- /dev/null +++ b/Bitget @@ -0,0 +1,52 @@ +{ + "path": [ + { + "auditId": "Au20221125", + "balances": { + "BTC": 4.6115136, + "ETH": 0, + "USDT": 4372722.80025793 + }, + "encryptUid": "58b8f244a465335eb0c67e0d5c13a66b52c76abc1e41a6373763da35f5ce7ce1", + "level": 3, + "merkelLeaf": "8cf0243a2c76fe0b", + "nonce": "gblzjurybs7fiptqdaez6t3pegazguye77fhsr6q4tbqkndubnjf1962csg54em4", + "role": 2 + }, + { + "auditId": "Au20221125", + "balances": { + "BTC": 0.000098, + "ETH": 0, + "USDT": 9000.30237189 + }, + "level": 2, + "merkelLeaf": "8306844dff98ba79", + "role": 2 + }, + { + "auditId": "Au20221125", + "balances": { + "BTC": 2001254.40269617, + "ETH": 1999998.0656526, + "USDT": 993781612.22955519 + }, + "level": 1, + "merkelLeaf": "94d0d60f7cdce5fe", + "role": 3 + } + ], + "self": { + "auditId": "Au20221125", + "balances": { + "BTC": 2001249.79108457, + "ETH": 1999998.0656526, + "USDT": 989399889.12692537 + }, + "encryptUid": "8c3358cd4d2572cf01de53f41717e72a91b4c6da53ce1232113c91e5cf192dd4", + "level": 3, + "merkelLeaf": "cb575fb1eb6462f9", + "nonce": "fi9honco6fww8afc4t2se8aml3i46pzfwjgepy3n2bbvuouns4tfiasz60klcm1p", + "role": 1 + } +}