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

Function generateP2TRNoteAddress

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

Source from the content-addressed store, hash-verified

124
125// Pay to Taproot Witness Script address, where the redeem script is NOTE protocol address
126export function generateP2TRNoteAddress(
127 pubkey: Buffer,
128 network: bitcoin.Network
129): IAddressObject {
130 // Output script address
131 const {scriptP2TR} = generateP2TRNoteInfo(pubkey, network);
132
133 const script = scriptP2TR.output!.toString("hex");
134 // with SHA256 hash
135 const scriptHash = calcScriptHash(scriptP2TR.output!);
136
137 const type: AddressType = "P2TR-NOTE";
138
139 return {
140 address: scriptP2TR.address!,
141 script,
142 scriptHash,
143 type,
144 };
145}
146
147// Pay to Taproot Witness Script address with full Payload embedding, where the redeem script contains the entire NOTE Payload
148export function generateP2TRCommitDataAddress(

Callers 1

createAccountMethod · 0.90

Calls 2

generateP2TRNoteInfoFunction · 0.90
calcScriptHashFunction · 0.90

Tested by

no test coverage detected