Skip to main content

Module: relay

Interfaces

Functions

getBitcoinTxInfo

getBitcoinTxInfo(electrsClient, txId): Promise<BitcoinTxInfo>

Retrieves information about a Bitcoin transaction, such as version, input vector, output vector, and locktime.

Parameters

NameTypeDescription
electrsClientElectrsClientAn ElectrsClient instance for interacting with the Electrum server.
txIdstringThe ID of the Bitcoin transaction.

Returns

Promise<BitcoinTxInfo>

A promise that resolves to a BitcoinTxInfo object.

Example

const BITCOIN_NETWORK = "regtest";
const electrsClient = new DefaultElectrsClient(BITCOIN_NETWORK);
const txId = "279121610d9575d132c95312c032116d6b8a58a3a31f69adf9736b493de96a16"; //enter the transaction id here
const info = await getBitcoinTxInfo(electrsClient, txId);

Defined in

relay.ts:43


getBitcoinTxProof

getBitcoinTxProof(electrsClient, txId, txProofDifficultyFactor): Promise<BitcoinTxProof>

Retrieves a proof for a Bitcoin transaction, including the merkle proof, transaction index in the block, and Bitcoin headers.

Parameters

NameTypeDescription
electrsClientElectrsClientAn ElectrsClient instance for interacting with the Electrum server.
txIdstringThe ID of the Bitcoin transaction.
txProofDifficultyFactornumberThe number of block headers to retrieve for proof verification.

Returns

Promise<BitcoinTxProof>

Example

const BITCOIN_NETWORK = "regtest";
const electrsClient = new DefaultElectrsClient(BITCOIN_NETWORK);
const txId = "279121610d9575d132c95312c032116d6b8a58a3a31f69adf9736b493de96a16";//enter the transaction id here
const txProofDifficultyFactor = "1";//enter the difficulty factor
const info = await getBitcoinTxProof(electrsClient, txId, txProofDifficultyFactor);

Defined in

relay.ts:97