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

Function generateP2TRNoteAddressV1

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

Source from the content-addressed store, hash-verified

102}
103
104export function generateP2TRNoteAddressV1(
105 pubkey: Buffer,
106 network: bitcoin.Network
107): IAddressObject {
108 // Output script address
109 const {scriptP2TR} = generateP2TRNoteInfoV1(pubkey, network);
110
111 const script = scriptP2TR.output!.toString("hex");
112 // with SHA256 hash
113 const scriptHash = calcScriptHash(scriptP2TR.output!);
114
115 const type: AddressType = "P2TR-NOTE-V1";
116
117 return {
118 address: scriptP2TR.address!,
119 script,
120 scriptHash,
121 type,
122 };
123}
124
125// Pay to Taproot Witness Script address, where the redeem script is NOTE protocol address
126export function generateP2TRNoteAddress(

Callers 1

createAccountMethod · 0.90

Calls 2

generateP2TRNoteInfoV1Function · 0.90
calcScriptHashFunction · 0.90

Tested by

no test coverage detected