Documentation
¶
Index ¶
Constants ¶
View Source
const ( // TaprootMultiSigWitnessSize evaluates to 66 bytes: // - num_witness_elements: 1 byte // - sig_varint_len: 1 byte // - <sig>: 64 bytes TaprootMultiSigWitnessSize = 1 + 1 + 64 // TaprootExpiryScriptSize evaluates to 39 bytes: // - OP_DATA: 1 byte (client_key length) // - <client_key>: 32 bytes // - OP_CHECKSIGVERIFY: 1 byte // - <address_expiry>: 4 bytes // - OP_CHECKSEQUENCEVERIFY: 1 byte TaprootExpiryScriptSize = 1 + 32 + 1 + 4 + 1 // TaprootExpiryWitnessSize evaluates to 140 bytes: // - num_witness_elements: 1 byte // - client_sig_varint_len: 1 byte (client_sig length) // - <trader_sig>: 64 bytes // - witness_script_varint_len: 1 byte (script length) // - <witness_script>: 39 bytes // - control_block_varint_len: 1 byte (control block length) // - <control_block>: 33 bytes TaprootExpiryWitnessSize = 1 + 1 + 64 + 1 + TaprootExpiryScriptSize + 1 + 33 )
Variables ¶
This section is empty.
Functions ¶
func ExpirySpendWeight ¶
func ExpirySpendWeight() int64
ExpirySpendWeight returns the weight of the expiry path spend.
func GenTimeoutPathScript ¶
GenTimeoutPathScript constructs a csv timeout script for the client.
<clientKey> OP_CHECKSIGVERIFY <csvExpiry> OP_CHECKSEQUENCEVERIFY
Types ¶
type StaticAddress ¶
type StaticAddress struct {
// TimeoutScript is the final locking script for the timeout path which
// is available to the sender after the set block height.
TimeoutScript []byte
// TimeoutLeaf is the timeout leaf.
TimeoutLeaf *txscript.TapLeaf
// ScriptTree is the assembled script tree from our timeout leaf.
ScriptTree *txscript.IndexedTapScriptTree
// InternalPubKey is the public key for the keyspend path which bypasses
// the timeout script locking.
InternalPubKey *btcec.PublicKey
// TaprootKey is the taproot public key which is created with the above
// 3 inputs.
TaprootKey *btcec.PublicKey
// RootHash is the root hash of the taptree.
RootHash chainhash.Hash
}
StaticAddress encapsulates the static address script.
func NewStaticAddress ¶
func NewStaticAddress(muSig2Version input.MuSig2Version, csvExpiry int64, clientPubKey, serverPubKey *btcec.PublicKey) (*StaticAddress, error)
NewStaticAddress constructs a static address script.
func (*StaticAddress) GenSuccessWitness ¶
func (s *StaticAddress) GenSuccessWitness(combinedSig []byte) (wire.TxWitness, error)
GenSuccessWitness returns the success witness to spend the static address output with a combined signature.
func (*StaticAddress) GenTimeoutWitness ¶
func (s *StaticAddress) GenTimeoutWitness(senderSig []byte) (wire.TxWitness, error)
GenTimeoutWitness returns the witness to spend the taproot timeout leaf.
func (*StaticAddress) StaticAddressScript ¶
func (s *StaticAddress) StaticAddressScript() ([]byte, error)
StaticAddressScript creates a MuSig2 2-of-2 multisig script with CSV timeout path for the clientKey. This script represents a static loop-in address.
Click to show internal directories.
Click to hide internal directories.