Documentation ¶
Index ¶
- Variables
- func AddConditionWitness(inIndex int, ptx *psbt.Packet, witness wire.TxWitness) error
- func AddCosignerKey(inIndex int, ptx *psbt.Packet, key *secp256k1.PublicKey) error
- func AggregateKeys(pubkeys []*btcec.PublicKey, scriptRoot []byte) (*musig2.AggregateKey, error)
- func BuildForfeitTxs(connectorTx *psbt.Packet, vtxoInput *wire.OutPoint, ...) (forfeitTxs []*psbt.Packet, err error)
- func BuildRedeemTx(vtxos []common.VtxoInput, outputs []*wire.TxOut) (string, error)
- func BuildVtxoTree(initialInput *wire.OutPoint, cosigners []*secp256k1.PublicKey, ...) (tree.VtxoTree, error)
- func CraftSharedOutput(cosigners []*secp256k1.PublicKey, server *secp256k1.PublicKey, ...) ([]byte, int64, error)
- func GetConditionWitness(in psbt.PInput) (wire.TxWitness, error)
- func GetCosignerKeys(in psbt.PInput) ([]*secp256k1.PublicKey, error)
- func UnspendableKey() *secp256k1.PublicKey
- func ValidateTreeSigs(scriptRoot []byte, finalAggregatedKey *btcec.PublicKey, ...) error
- func ValidateVtxoTree(vtxoTree tree.VtxoTree, roundTx string, serverPubkey *secp256k1.PublicKey, ...) error
- type CoordinatorSession
- type Musig2Nonce
- type SignerSession
- type TapscriptsVtxoScript
- type TreeNonces
- type TreePartialSigs
- type VtxoScript
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingVtxoTree = errors.New("missing vtxo tree") ErrMissingAggregateKey = errors.New("missing aggregate key") )
View Source
var ( COSIGNER_PSBT_KEY_PREFIX = []byte("cosigner") CONDITION_WITNESS_KEY_PREFIX = []byte(tree.ConditionWitnessKey) )
View Source
var ( ErrInvalidRoundTx = fmt.Errorf("invalid round transaction") ErrInvalidRoundTxOutputs = fmt.Errorf("invalid number of outputs in round transaction") ErrEmptyTree = fmt.Errorf("empty vtxo tree") ErrInvalidRootLevel = fmt.Errorf("root level must have only one node") ErrNoLeaves = fmt.Errorf("no leaves in the tree") ErrNodeTxEmpty = fmt.Errorf("node transaction is empty") ErrNodeTxidEmpty = fmt.Errorf("node txid is empty") ErrNodeParentTxidEmpty = fmt.Errorf("node parent txid is empty") ErrNodeTxidDifferent = fmt.Errorf("node txid differs from node transaction") ErrNumberOfInputs = fmt.Errorf("node transaction should have only one input") ErrNumberOfOutputs = fmt.Errorf("node transaction should have only three or two outputs") ErrParentTxidInput = fmt.Errorf("parent txid should be the input of the node transaction") ErrNumberOfChildren = fmt.Errorf("node branch transaction should have two children") ErrLeafChildren = fmt.Errorf("leaf node should have max 1 child") ErrInvalidChildTxid = fmt.Errorf("invalid child txid") ErrNumberOfTapscripts = fmt.Errorf("input should have 1 tapscript leaf") ErrInternalKey = fmt.Errorf("invalid taproot internal key") ErrInvalidTaprootScript = fmt.Errorf("invalid taproot script") ErrInvalidControlBlock = fmt.Errorf("invalid control block") ErrInvalidTaprootScriptLen = fmt.Errorf("invalid taproot script length (expected 32 bytes)") ErrInvalidLeafTaprootScript = fmt.Errorf("invalid leaf taproot script") ErrInvalidAmount = fmt.Errorf("children amount is different from parent amount") ErrInvalidSweepSequence = fmt.Errorf("invalid sweep sequence") ErrInvalidServer = fmt.Errorf("invalid server") ErrMissingFeeOutput = fmt.Errorf("missing fee output") ErrInvalidLeftOutput = fmt.Errorf("invalid left output") ErrInvalidRightOutput = fmt.Errorf("invalid right output") ErrMissingSweepTapscript = fmt.Errorf("missing sweep tapscript") ErrInvalidLeaf = fmt.Errorf("leaf node shouldn't have children") ErrWrongRoundTxid = fmt.Errorf("the input of the tree root is not the round tx's shared output") )
Functions ¶
func AddConditionWitness ¶
func AddCosignerKey ¶
func AggregateKeys ¶
func AggregateKeys( pubkeys []*btcec.PublicKey, scriptRoot []byte, ) (*musig2.AggregateKey, error)
func BuildForfeitTxs ¶
func BuildRedeemTx ¶
func BuildVtxoTree ¶
func BuildVtxoTree( initialInput *wire.OutPoint, cosigners []*secp256k1.PublicKey, server *secp256k1.PublicKey, receivers []tree.VtxoLeaf, feeSatsPerNode uint64, roundLifetime common.RelativeLocktime, ) (tree.VtxoTree, error)
BuildVtxoTree creates all the tree's transactions
func CraftSharedOutput ¶
func CraftSharedOutput( cosigners []*secp256k1.PublicKey, server *secp256k1.PublicKey, receivers []tree.VtxoLeaf, feeSatsPerNode uint64, roundLifetime common.RelativeLocktime, ) ([]byte, int64, error)
CraftSharedOutput returns the taproot script and the amount of the initial root output
func GetCosignerKeys ¶
func UnspendableKey ¶
func UnspendableKey() *secp256k1.PublicKey
func ValidateTreeSigs ¶
func ValidateVtxoTree ¶
func ValidateVtxoTree( vtxoTree tree.VtxoTree, roundTx string, serverPubkey *secp256k1.PublicKey, roundLifetime common.RelativeLocktime, ) error
ValidateVtxoTree checks if the given vtxo tree is valid roundTxid & roundTxIndex & roundTxAmount are used to validate the root input outpoint serverPubkey & roundLifetime are used to validate the sweep tapscript leaves besides that, the function validates: - the number of nodes - the number of leaves - children coherence with parent - every control block and taproot output scripts - input and output amounts
Types ¶
type CoordinatorSession ¶
type CoordinatorSession interface { AddNonce(*btcec.PublicKey, TreeNonces) error AggregateNonces() (TreeNonces, error) AddSig(*btcec.PublicKey, TreePartialSigs) error // SignTree combines the signatures and add them to the tree's psbts SignTree() (tree.VtxoTree, error) }
type Musig2Nonce ¶
type Musig2Nonce struct {
PubNonce [66]byte
}
type SignerSession ¶
type SignerSession interface { GetNonces() (TreeNonces, error) // generate tree nonces for this session SetKeys([]*btcec.PublicKey) error // set the cosigner public keys for this session SetAggregatedNonces(TreeNonces) error // set the aggregated nonces Sign() (TreePartialSigs, error) // sign the tree }
func NewTreeSignerSession ¶
func NewTreeSignerSession( signer *btcec.PrivateKey, roundSharedOutputAmount int64, vtxoTree tree.VtxoTree, scriptRoot []byte, ) SignerSession
type TapscriptsVtxoScript ¶
type TapscriptsVtxoScript struct {
tree.TapscriptsVtxoScript
}
func (*TapscriptsVtxoScript) TapTree ¶
func (v *TapscriptsVtxoScript) TapTree() (*secp256k1.PublicKey, bitcoinTapTree, error)
type TreeNonces ¶
type TreeNonces [][]*Musig2Nonce // public nonces
func DecodeNonces ¶
func DecodeNonces(r io.Reader) (TreeNonces, error)
type TreePartialSigs ¶
type TreePartialSigs [][]*musig2.PartialSignature
func DecodeSignatures ¶
func DecodeSignatures(r io.Reader) (TreePartialSigs, error)
type VtxoScript ¶
type VtxoScript common.VtxoScript[bitcoinTapTree, tree.Closure]
func NewDefaultVtxoScript ¶
func NewDefaultVtxoScript(owner, server *secp256k1.PublicKey, exitDelay common.RelativeLocktime) VtxoScript
func ParseVtxoScript ¶
func ParseVtxoScript(scripts []string) (VtxoScript, error)
Click to show internal directories.
Click to hide internal directories.