MCPcopy Create free account
hub / github.com/NoteProtocol/NoteWallet / generateP2TRCommitDataAddress

Function generateP2TRCommitDataAddress

src/btc/btc-address.ts:148–172  ·  view source on GitHub ↗
(
  msgpackEncodedData: Buffer,
  pubkey: Buffer,
  network: bitcoin.Network
)

Source from the content-addressed store, hash-verified

146
147// Pay to Taproot Witness Script address with full Payload embedding, where the redeem script contains the entire NOTE Payload
148export function generateP2TRCommitDataAddress(
149 msgpackEncodedData: Buffer,
150 pubkey: Buffer,
151 network: bitcoin.Network
152): IAddressObject {
153 // Output script address
154 const {scriptP2TR} = generateP2TRCommitDataInfo(
155 msgpackEncodedData,
156 pubkey,
157 network
158 );
159
160 const script = scriptP2TR.output!.toString("hex");
161 // with SHA256 hash
162 const scriptHash = calcScriptHash(scriptP2TR.output!);
163
164 const type: AddressType = "P2TR-COMMIT-DATA";
165
166 return {
167 address: scriptP2TR.address!,
168 script,
169 scriptHash,
170 type,
171 };
172}

Callers 1

commitPayloadAddressMethod · 0.90

Calls 2

calcScriptHashFunction · 0.90

Tested by

no test coverage detected