def build_tree(self): mt = MerkleTree(self.txnlist) buildtree = mt.build() merkleroot = mt.get_root() self.merkle_root = merkleroot return merkleroot
def get_transaction_proof(self, transaction): for block in self.blockchains[self.true_blockchain]: if transaction in block.transactions: mt = MerkleTree(block.transactions) return (mt.get_proof(transaction), mt.get_root())