taproot

package
v0.0.0-...-581a61f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package taproot builds Simplicity P2TR addresses for Elements/Liquid.

Simplicity uses leaf version 0xBE (not 0xC4 which is standard Elements tapscript). The internal key is a NUMS point (key-path spend disabled).

Index

Constants

View Source
const SimplicityLeafVersion txscript.TapscriptLeafVersion = 0xBE

SimplicityLeafVersion is the Simplicity tapscript leaf version on Elements.

Variables

This section is empty.

Functions

func Address

func Address(cmrBytes []byte, net *network.Network) (string, error)

Address derives the P2TR bech32m address for a Simplicity contract. cmrBytes must be the 32-byte Commitment Merkle Root — this is what goes in the taproot leaf, NOT the full program binary.

func AddressDual

func AddressDual(cmr1, cmr2 []byte, net *network.Network) (string, error)

AddressDual derives a P2TR address for a 2-leaf Simplicity taproot tree. Both cmr1 and cmr2 are 32-byte Simplicity CMRs (e.g., swap and remove variants). The resulting UTXO can be spent using either program.

func ControlBlock

func ControlBlock(cmrBytes []byte) ([]byte, error)

ControlBlock returns the serialised taproot control block for a Simplicity spend. cmrBytes must be the 32-byte CMR used as the taproot leaf script.

func ControlBlockDual

func ControlBlockDual(cmr1, cmr2, targetCMR []byte) ([]byte, error)

ControlBlockDual returns the control block for spending the leaf identified by targetCMR from a 2-leaf tree built from (cmr1, cmr2).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL