def get_merklepath(self, txn): # Get Tree information from minernode proof = None for block in self.blockchain.blockchain: if txn in block[0].txnlist: merkletree = MerkleTree(block[0].txnlist) merkletree.build() arrayTree = merkletree.tree # Get merkle path proof = merkletree.get_proof(txn) return proof
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())