pub fn from_block_and_index(block: &Block, index: usize) -> Self {
		let tx: &Transaction =
			block.txdata.get(index).expect("Invalid tx index");

		let txids: Vec<BitcoinTxId> =
			block.txdata.iter().map(|tx| tx.txid()).collect();
		let merkle_tree = BitcoinMerkleTree::new(&txids);
		let merkle_path = merkle_tree
			.proof(index)
			.expect("FATAL: index is out-of-bounds");

		Self {
			reversed_txid: tx.txid(),
			tx_index: index as u32,
			block_height: block
				.bip34_block_height()
				.expect("Failed to get block height"),
			block_header: block.header,
			merkle_path: merkle_path.into_iter().map(|h| h.to_vec()).collect(),
			merkle_root: hex::encode(merkle_tree.root().unwrap()),
		}
	}
Create a new proof from a bitcoin transaction and a block
romeo/src/proof_data.rs