This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {BlockRepository, RepositoryFactoryHttp, UInt64} from "nem2-sdk"; | |
import {sha3_256} from "js-sha3"; | |
const validateTransactionInBlock = async (leaf: string, height: UInt64, blockHttp: BlockRepository) => { | |
// 1.Calculate H(B) (leaf) | |
// 2. Obtain HRoot; in Symbol, this is stored in the block header. | |
const HRoot = (await blockHttp.getBlockByHeight(height).toPromise()).blockTransactionsHash; | |
console.log('Hroot', HRoot); | |
// 3. Request merkle path H(A), HCD, HEE2. | |
const merklePath = (await blockHttp.getMerkleTransaction(height, leaf).toPromise()).merklePath; |