Skip to content

Commit

Permalink
Update types.go
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyunyun0 authored Apr 17, 2024
1 parent aaaac75 commit 4010202
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion btcstaking/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@ func DeriveTaprootAddress(
net *chaincfg.Params) (*btcutil.AddressTaproot, error) {

tapScriptRootHash := tapScriptTree.RootNode.TapHash()

fmt.Println("tapScriptRootHash=",tapScriptRootHash.String())
outputKey := txscript.ComputeTaprootOutputKey(
internalPubKey, tapScriptRootHash[:],
)
fmt.Println("outputKey=",hex.EncodeToString(outputKey.SerializeCompressed()))


address, err := btcutil.NewAddressTaproot(
schnorr.SerializePubKey(outputKey), net)
fmt.Println("address=",address.EncodeAddress())

if err != nil {
return nil, fmt.Errorf("error encoding Taproot address: %v", err)
Expand Down

0 comments on commit 4010202

Please sign in to comment.