package
0.18.4-beta.rc2
Repository: https://github.com/lightningnetwork/lnd.git
Documentation: pkg.go.dev
# Functions
CommitScriptAnchor constructs the script for the anchor output spendable by the given key immediately, or by anyone after 16 confirmations.
CommitScriptToRemoteConfirmed constructs the script for the output on the commitment transaction paying to the remote party of said commitment transaction.
CommitScriptToSelf constructs the public key script for the output on the commitment transaction paying to the "owner" of said commitment transaction.
CommitScriptUnencumbered constructs the public key script on the commitment transaction paying to the "other" party.
CommitSpendAnchor constructs a valid witness allowing a node to spend their anchor output on the commitment transaction using their funding key.
CommitSpendAnchorAnyone constructs a witness allowing anyone to spend the anchor output after it has gotten 16 confirmations.
CommitSpendNoDelay constructs a valid witness allowing a node to spend their settled no-delay output on the counterparty's commitment transaction.
CommitSpendRevoke constructs a valid witness allowing a node to sweep the settled output of a malicious counterparty who broadcasts a revoked commitment transaction.
CommitSpendTimeout constructs a valid witness allowing the owner of a particular commitment transaction to spend the output returning settled funds back to themselves after a relative block timeout.
CommitSpendToRemoteConfirmed constructs a valid witness allowing a node to spend their settled output on the counterparty's commitment transaction when it has one confirmetion.
ComputeCommitmentPoint generates a commitment point given a commitment secret.
DeriveRevocationPrivKey derives the revocation private key given a node's commitment private key, and the preimage to a previously seen revocation hash.
DeriveRevocationPubkey derives the revocation public key given the counterparty's commitment key, and revocation preimage derived via a pseudo-random-function.
DeserializePartialSignature decodes a partial signature from a byte slice.
EstimateCommitTxWeight estimate commitment transaction weight depending on the precalculated weight of base transaction, witness data, which is needed for paying for funding tx, and htlc weight multiplied by their count.
FindScriptOutputIndex finds the index of the public key script output matching 'script'.
GenerateP2PKH generates a pay-to-public-key-hash public key script paying to the passed serialized public key.
GenerateP2SH generates a pay-to-script-hash public key script paying to the passed redeem script.
GenerateUnknownWitness generates the maximum-sized witness public key script consisting of a version push and a 40-byte data push.
GenFundingPkScript creates a redeem script, and its matching p2wsh output for the funding transaction.
GenMultiSigScript generates the non-p2sh'd multisig script for 2 of 2 pubkeys.
GenTaprootFundingScript constructs the taproot-native funding output that uses MuSig2 to create a single aggregated key to anchor the channel.
HtlcSecondLevelSpend exposes the public witness generation function for spending an HTLC success transaction, either due to an expiring time lock or having had the payment preimage.
HtlcSpendRevoke spends a second-level HTLC output.
HtlcSpendSuccess spends a second-level HTLC output.
IsHtlcSpendRevoke is used to determine if the passed spend is spending a HTLC output using the revocation key.
LeaseCommitScriptToRemoteConfirmed constructs the script for the output on the commitment transaction paying to the remote party of said commitment transaction.
LeaseCommitScriptToSelf constructs the public key script for the output on the commitment transaction paying to the "owner" of said commitment transaction.
LeaseSecondLevelHtlcScript is the uniform script that's used as the output for the second-level HTLC transactions.
LockTimeToSequence converts the passed relative locktime to a sequence number in accordance to BIP-68.
MakeBaseInput assembles a new BaseInput that can be used to construct a sweep transaction.
MakeHtlcSecondLevelSuccessAnchorInput creates an input allowing the sweeper to spend the HTLC output on our commit using the second level success transaction.
MakeHtlcSecondLevelSuccessTaprootInput creates an input that allows the sweeper to spend an HTLC output to the second level on our taproot commitment transaction.
MakeHtlcSecondLevelTimeoutAnchorInput creates an input allowing the sweeper to spend the HTLC output on our commit using the second level timeout transaction.
MakeHtlcSecondLevelTimeoutTaprootInput creates an input that allows the sweeper to spend an HTLC output to the second level on our commitment transaction.
MakeHtlcSucceedInput assembles a new redeem input that can be used to construct a sweep transaction.
MakeTaprootCtrlBlock takes a leaf script, the internal key (usually the revoke key), and a script tree and creates a valid control block for a spend of the leaf.
MakeTaprootHtlcSucceedInput creates a new HtlcSucceedInput that can be used to spend an HTLC output for a taproot channel on the remote party's commitment transaction.
MultiPrevOutFetcher returns a txscript.MultiPrevOutFetcher for the given set of inputs.
MuSig2CombineKeys combines the given set of public keys into a single combined MuSig2 combined public key, applying the given tweaks.
MuSig2CombineSig calls the CombineSig() method on the given versioned signing session and returns the result in the most recent version of the MuSig2 API.
MuSig2CreateContext creates a new MuSig2 signing context.
MuSig2ParsePubKeys parses a list of raw public keys as the signing keys of a MuSig2 signing session.
MuSig2Sign calls the Sign() method on the given versioned signing session and returns the result in the most recent version of the MuSig2 API.
MustParsePubKey parses a hex encoded public key string into a public key and panic if parsing fails.
NewAnchorScriptTree makes a new script tree for an anchor output with the passed anchor key.
NewBaseInput allocates and assembles a new *BaseInput that can be used to construct a sweep transaction.
NewCsvInput assembles a new csv-locked input that can be used to construct a sweep transaction.
NewCsvInputWithCltv assembles a new csv and cltv locked input that can be used to construct a sweep transaction.
NewLocalCommitScriptTree returns a new CommitScript tree that can be used to create and spend the commitment output for the local party.
NewMockSigner returns a new instance of the MockSigner given a set of backing private keys.
NewMuSig2SessionID returns the unique ID of a MuSig2 session by using the combined key and the local public nonces and hashing that data.
NewMusigSessionManager creates a new musig manager given an abstract key fetcher.
NewRemoteCommitScriptTree constructs a new script tree for the remote party to sweep their funds after a hard coded 1 block delay.
NewTxSigHashesV0Only returns a new txscript.TxSigHashes instance that will only calculate the sighash midstate values for segwit v0 inputs and can therefore never be used for transactions that want to spend segwit v1 (taproot) inputs.
NoneTapLeaf returns an empty optional tapscript leaf.
ParseSignature parses a raw signature into an input.Signature instance.
PayToTaprootScript creates a new script to pay to a version 1 (taproot) witness program.
ReadSignDescriptor deserializes a SignDescriptor struct from the passed io.Reader stream.
ReceiverHTLCScript constructs the public key script for an incoming HTLC output payment for the receiver's version of the commitment transaction.
ReceiverHTLCScriptTaproot constructs the taproot witness program (schnor key) for an incoming HTLC on the receiver's version of the commitment transaction.
ReceiverHTLCScriptTaprootRedeem creates a valid witness needed to redeem a receiver taproot HTLC with the pre-image.
ReceiverHTLCScriptTaprootRevoke creates a valid witness needed to spend the revocation path of the HTLC from the PoV of the sender (offerer) of the HTLC.
ReceiverHTLCScriptTaprootTimeout creates a valid witness needed to timeout an HTLC on the receiver's commitment transaction after the timeout has elapsed.
ReceiverHtlcSpendRedeem constructs a valid witness allowing the receiver of an HTLC to redeem the conditional payment in the event that their commitment transaction is broadcast.
ReceiverHtlcSpendRevoke constructs a valid witness allowing the sender of an HTLC within a previously revoked commitment transaction to re-claim the pending funds in the case that the receiver broadcasts this revoked commitment transaction.
ReceiverHtlcSpendRevokeWithKey constructs a valid witness allowing the sender of an HTLC within a previously revoked commitment transaction to re-claim the pending funds in the case that the receiver broadcasts this revoked commitment transaction.
ReceiverHtlcSpendTimeout constructs a valid witness allowing the sender of an HTLC to recover the pending funds after an absolute timeout in the scenario that the receiver of the HTLC broadcasts their version of the commitment transaction.
ReceiverHtlcTapLeafSuccess returns the full tapscript leaf for the success path for an HTLC on the receiver's commitment transaction.
ReceiverHtlcTapLeafTimeout returns the full tapscript leaf for the timeout path of the sender HTLC.
Ripemd160H calculates the ripemd160 of the passed byte slice.
SecondLevelHtlcScript is the uniform script that's used as the output for the second-level HTLC transactions.
SecondLevelHtlcTapscriptTree construct the indexed tapscript tree needed to generate the tap tweak to create the final output and also control block.
SenderHTLCScript constructs the public key script for an outgoing HTLC output payment for the sender's version of the commitment transaction.
SenderHTLCScriptTaproot constructs the taproot witness program (schnorr key) for an outgoing HTLC on the sender's version of the commitment transaction.
SenderHTLCScriptTaprootRedeem creates a valid witness needed to redeem a sender taproot HTLC with the pre-image.
SenderHTLCScriptTaprootRevoke creates a valid witness needed to spend the revocation path of the HTLC.
SenderHTLCScriptTaprootTimeout creates a valid witness needed to timeout an HTLC on the sender's commitment transaction.
SenderHtlcSpendRedeem constructs a valid witness allowing the receiver of an HTLC to redeem the pending output in the scenario that the sender broadcasts their version of the commitment transaction.
SenderHtlcSpendRevoke constructs a valid witness allowing the receiver of an HTLC to claim the output with knowledge of the revocation private key in the scenario that the sender of the HTLC broadcasts a previously revoked commitment transaction.
SenderHtlcSpendRevokeWithKey constructs a valid witness allowing the receiver of an HTLC to claim the output with knowledge of the revocation private key in the scenario that the sender of the HTLC broadcasts a previously revoked commitment transaction.
SenderHtlcSpendTimeout constructs a valid witness allowing the sender of an HTLC to activate the time locked covenant clause of a soon to be expired HTLC.
SenderHTLCTapLeafSuccess returns the full tapscript leaf for the success path of the sender HTLC.
SenderHTLCTapLeafTimeout returns the full tapscript leaf for the timeout path of the sender HTLC.
SerializePartialSignature encodes the partial signature to a fixed size byte array.
SingleTweakBytes computes set of bytes we call the single tweak.
SpendMultiSig generates the witness stack required to redeem the 2-of-2 p2wsh multi-sig output.
TaprootAnchorSpend constructs a valid witness allowing a node to sweep their anchor output.
TaprootAnchorSpendAny constructs a valid witness allowing anyone to sweep the anchor output after 16 blocks.
TaprootCommitRemoteSpend allows the remote party to sweep their output into their wallet after an enforced 1 block delay.
TaprootCommitScriptToRemote constructs a taproot witness program for the output on the commitment transaction for the remote party.
TaprootCommitScriptToSelf creates the taproot witness program that commits to the revocation (script path) and delay path (script path) in a single taproot output key.
TaprootCommitSpendRevoke constructs a valid witness allowing a node to sweep the revoked taproot output of a malicious peer.
TaprootCommitSpendSuccess constructs a valid witness allowing a node to sweep the settled taproot output after the delay has passed for a force close.
TaprootHtlcSpendRevoke spends a second-level HTLC output via the revocation path.
TaprootHtlcSpendSuccess spends a second-level HTLC output via the redemption path.
TaprootLocalCommitDelayScript builds the tap leaf with the CSV delay script for the to-local output.
TaprootLocalCommitRevokeScript builds the tap leaf with the revocation path for the to-local output.
TaprootOutputKeyAnchor returns the segwit v1 (taproot) witness program that encodes the anchor output spending conditions: the passed key can be used for keyspend, with the OP_CSV 16 clause living within an internal tapscript leaf.
TaprootSecondLevelHtlcScript is the uniform script that's used as the output for the second-level HTLC transaction.
TaprootSecondLevelScriptTree constructs the tapscript tree used to spend the second level HTLC output.
TaprootSecondLevelTapLeaf constructs the tap leaf used as the sole script path for a second level HTLC spend.
TapscriptFullKeyOnly creates a waddrmgr.Tapscript for the given full Taproot key.
TapscriptFullTree creates a waddrmgr.Tapscript for the given internal key and tree leaves.
TapscriptPartialReveal creates a waddrmgr.Tapscript for the given internal key and revealed script.
TapscriptRootHashOnly creates a waddrmgr.Tapscript for the given internal key and root hash.
TweakPrivKey tweaks the private key of a public base point given a per commitment point.
TweakPubKey tweaks a public base point given a per commitment point.
TweakPubKeyWithTweak is the exact same as the TweakPubKey function, however it accepts the raw tweak bytes directly rather than the commitment point.
WithResolutionBlob is an option that can be used to set a resolution blob on for an input.
WitnessPubKeyHash generates a pay-to-witness-pubkey-hash public key script paying to a version 0 witness program containing the passed serialized public key.
WitnessScriptHash generates a pay-to-witness-script-hash public key script paying to a version 0 witness program paying to the passed redeem script.
WriteSignDescriptor serializes a SignDescriptor struct into the passed io.Writer stream.
# Constants
AcceptedHtlcPenaltyWitnessSize 250 bytes - number_of_witness_elements: 1 byte - revocation_sig_length: 1 byte - revocation_sig: 73 bytes - revocation_key_length: 1 byte - revocation_key: 33 bytes - witness_script_length: 1 byte - witness_script (accepted_htlc_script).
AcceptedHtlcPenaltyWitnessSizeConfirmed 253 bytes.
AcceptedHtlcScriptSize 140 bytes - OP_DUP: 1 byte - OP_HASH160: 1 byte - OP_DATA: 1 byte (RIPEMD160(SHA256(revocationkey)) length) - RIPEMD160(SHA256(revocationkey)): 20 bytes - OP_EQUAL: 1 byte - OP_IF: 1 byte - OP_CHECKSIG: 1 byte - OP_ELSE: 1 byte - OP_DATA: 1 byte (remotekey length) - remotekey: 33 bytes - OP_SWAP: 1 byte - OP_SIZE: 1 byte - OP_DATA: 1 byte (32 length) - 32: 1 byte - OP_EQUAL: 1 byte - OP_IF: 1 byte - OP_HASH160: 1 byte - OP_DATA: 1 byte (RIPEMD160(payment_hash) length) - RIPEMD160(payment_hash): 20 bytes - OP_EQUALVERIFY: 1 byte - 2: 1 byte - OP_SWAP: 1 byte - OP_DATA: 1 byte (localkey length) - localkey: 33 bytes - 2: 1 byte - OP_CHECKMULTISIG: 1 byte - OP_ELSE: 1 byte - OP_DROP: 1 byte - OP_DATA: 1 byte (cltv_expiry length) - cltv_expiry: 4 bytes - OP_CHECKLOCKTIMEVERIFY: 1 byte - OP_DROP: 1 byte - OP_CHECKSIG: 1 byte - OP_ENDIF: 1 byte - OP_1: 1 byte // These 3 extra bytes are only - OP_CSV: 1 byte // present for the confirmed - OP_DROP: 1 byte // HTLC script types.
AcceptedHtlcScriptSizeConfirmed 143 bytes.
AcceptedHtlcSuccessWitnessSize 324 bytes - number_of_witness_elements: 1 byte - nil_length: 1 byte - sig_alice_length: 1 byte - sig_alice: 73 bytes - sig_bob_length: 1 byte - sig_bob: 73 bytes - preimage_length: 1 byte - preimage: 32 bytes - witness_script_length: 1 byte - witness_script (accepted_htlc_script)
Input to second level success tx, spending non-delayed HTLC output.
AcceptedHtlcSuccessWitnessSizeConfirmed 327 bytes
Input to second level success tx, spending 1 CSV delayed HTLC output.
AcceptedHtlcTimeoutWitnessSize 217 bytes - number_of_witness_elements: 1 byte - sender_sig_length: 1 byte - sender_sig: 73 bytes - nil_length: 1 byte - witness_script_length: 1 byte - witness_script: (accepted_htlc_script).
AcceptedHtlcTimeoutWitnessSizeConfirmed 220 bytes.
AnchorCommitWeight 1124 weight.
AnchorScriptSize 40 bytes - pubkey_length: 1 byte - pubkey: 33 bytes - OP_CHECKSIG: 1 byte - OP_IFDUP: 1 byte - OP_NOTIF: 1 byte - OP_16: 1 byte - OP_CSV 1 byte - OP_ENDIF: 1 byte.
AnchorWitnessSize 116 bytes - number_of_witnes_elements: 1 byte - signature_length: 1 byte - signature: 73 bytes - witness_script_length: 1 byte - witness_script (anchor_script).
BaseAnchorCommitmentTxSize 225 + 43 * num-htlc-outputs bytes - Version: 4 bytes - WitnessHeader <---- part of the witness data - CountTxIn: 1 byte - TxIn: 41 bytes FundingInput - CountTxOut: 3 byte - TxOut: 4*43 + 43 * num-htlc-outputs bytes OutputPayingToThem, OutputPayingToUs, AnchorPayingToThem, AnchorPayingToUs, ....HTLCOutputs..
BaseAnchorCommitmentTxWeight 900 weight.
BaseCommitmentTxSize 125 + 43 * num-htlc-outputs bytes - Version: 4 bytes - WitnessHeader <---- part of the witness data - CountTxIn: 1 byte - TxIn: 41 bytes FundingInput - CountTxOut: 1 byte - TxOut: 74 + 43 * num-htlc-outputs bytes OutputPayingToThem, OutputPayingToUs, ....HTLCOutputs..
BaseCommitmentTxWeight 500 weight.
BaseOutputSize 9 bytes - value: 8 bytes - var_int: 1 byte (pkscript_length).
BaseTaprootCommitmentTxWeight 225 + 43 * num-htlc-outputs bytes - Version: 4 bytes - WitnessHeader <---- part of the witness data - CountTxIn: 1 byte - TxIn: 41 bytes FundingInput - CountTxOut: 3 byte - TxOut: 172 + 43 * num-htlc-outputs bytes OutputPayingToThem, OutputPayingToUs, ....HTLCOutputs..
BaseTxSize 8 bytes - Version: 4 bytes - LockTime: 4 bytes.
CommitmentAnchor is a witness that allows us to spend our anchor on the commitment transaction.
CommitmentAnchorOutput 43 bytes - Value: 8 bytes - VarInt: 1 byte (PkScript length) - PkScript (P2WSH).
CommitmentDelayOutput 43 bytes - Value: 8 bytes - VarInt: 1 byte (PkScript length) - PkScript (P2WSH).
CommitmentKeyHashOutput 31 bytes - Value: 8 bytes - VarInt: 1 byte (PkScript length) - PkScript (P2WPKH).
CommitmentNoDelay is a witness that allows us to spend a settled no-delay output immediately on a counterparty's commitment transaction.
CommitmentRevoke is a witness that allows us to sweep the settled output of a malicious counterparty's who broadcasts a revoked commitment transaction.
CommitmentTimeLock is a witness that allows us to spend our output on our local commitment transaction after a relative lock-time lockout.
CommitmentToRemoteConfirmed is a witness that allows us to spend our output on the counterparty's commitment transaction after a confirmation.
CommitSpendNoDelayTweakless is similar to the CommitSpendNoDelay type, but it omits the tweak that randomizes the key we need to spend with a channel peer supplied set of randomness.
CommitWeight 724 weight.
FundingInputSize 41 bytes FundingInputSize represents the size of an input to a funding transaction, and is equivalent to the size of a standard segwit input as calculated above.
HtlcAcceptedRemoteSuccess is a witness that allows us to sweep an HTLC that was offered to us by the remote party.
HtlcAcceptedRevoke is a witness that allows us to sweep an HTLC output sent to us in the case that the remote party broadcasts a revoked commitment state.
HtlcAcceptedSuccessSecondLevel is a witness that allows us to sweep an HTLC output that was offered to us, and for which we have a payment preimage.
HtlcAcceptedSuccessSecondLevelInputConfirmed is a witness that allows us to sweep an HTLC output that was offered to us, and for which we have a payment preimage.
HtlcConfirmedScriptOverhead 3 bytes HtlcConfirmedScriptOverhead is the extra length of an HTLC script that requires confirmation before it can be spent.
HtlcOfferedRemoteTimeout is a witness that allows us to sweep an HTLC that we offered to the remote party which lies in the commitment transaction of the remote party.
HtlcOfferedRevoke is a witness that allows us to sweep an HTLC which we offered to the remote party in the case that they broadcast a revoked commitment state.
HtlcOfferedTimeoutSecondLevel is a witness that allows us to sweep an HTLC output that we extended to a party, but was never fulfilled.
HtlcOfferedTimeoutSecondLevelInputConfirmed is a witness that allows us to sweep an HTLC output that we extended to a party, but was never fulfilled.
HtlcSecondLevelRevoke is a witness that allows us to sweep an HTLC from the remote party's commitment transaction in the case that the broadcast a revoked commitment, but then also immediately attempt to go to the second level to claim the HTLC.
HTLCSize 43 bytes - Value: 8 bytes - VarInt: 1 byte (PkScript length) - PkScript (PW2SH).
HtlcSuccessWeight 703 weight HtlcSuccessWeight is the weight of the HTLC success transaction which will transition an incoming HTLC to the delay-and-claim state.
HtlcSuccessWeightConfirmed 706 weight HtlcSuccessWeightConfirmed is the weight of the HTLC success transaction which will transition an incoming HTLC to the delay-and-claim state, for the confirmed HTLC outputs.
HtlcTimeoutWeight 663 weight HtlcTimeoutWeight is the weight of the HTLC timeout transaction which will transition an outgoing HTLC to the delay-and-claim state.
HtlcTimeoutWeightConfirmed 666 weight HtlcTimeoutWeightConfirmed is the weight of the HTLC timeout transaction which will transition an outgoing HTLC to the delay-and-claim state, for the confirmed HTLC outputs.
HTLCWeight 172 weight.
InputSize 41 bytes - PreviousOutPoint: - Hash: 32 bytes - Index: 4 bytes - OP_DATA: 1 byte (ScriptSigLength) - ScriptSig: 0 bytes - Witness <---- we use "Witness" instead of "ScriptSig" for transaction validation, but "Witness" is stored separately and weight for it size is smaller.
LeaseCommitmentTimeLock is a witness that allows us to spend our output on our local commitment transaction after a relative and absolute lock-time lockout as part of the script enforced lease commitment type.
LeaseCommitmentToRemoteConfirmed is a witness that allows us to spend our output on the counterparty's commitment transaction after a confirmation and absolute locktime as part of the script enforced lease commitment type.
LeaseHtlcAcceptedSuccessSecondLevel is a witness that allows us to sweep an HTLC output that was offered to us, and for which we have a payment preimage.
LeaseHtlcOfferedTimeoutSecondLevel is a witness that allows us to sweep an HTLC output that we extended to a party, but was never fulfilled.
LeaseWitnessScriptSizeOverhead represents the size overhead in bytes of the witness scripts used within script enforced lease commitments.
MaxHTLCNumber 966 MaxHTLCNumber is the maximum number HTLCs which can be included in a commitment transaction.
MultiSigSize 71 bytes - OP_2: 1 byte - OP_DATA: 1 byte (pubKeyAlice length) - pubKeyAlice: 33 bytes - OP_DATA: 1 byte (pubKeyBob length) - pubKeyBob: 33 bytes - OP_2: 1 byte - OP_CHECKMULTISIG: 1 byte.
MultiSigWitnessSize 222 bytes - NumberOfWitnessElements: 1 byte - NilLength: 1 byte - sigAliceLength: 1 byte - sigAlice: 73 bytes - sigBobLength: 1 byte - sigBob: 73 bytes - WitnessScriptLength: 1 byte - WitnessScript (MultiSig).
MuSig2PartialSigSize is the size of a MuSig2 partial signature.
MuSig2Version040 is version 0.4.0 of the MuSig2 BIP draft.
MuSig2Version100RC2 is version 1.0.0rc2 of the MuSig2 BIP draft.
NestedP2WPKHSize 23 bytes - OP_DATA: 1 byte (P2WPKHSize) - P2WPKHWitnessProgram: 22 bytes.
NestedP2WSHSize 35 bytes - OP_DATA: 1 byte (P2WSHSize) - P2WSHWitnessProgram: 34 bytes.
NestedWitnessKeyHash is a witness type that allows us to sweep an output that sends to a nested P2SH script that pays to a key solely under our control.
OfferedHtlcPenaltyWitnessSize 243 bytes - number_of_witness_elements: 1 byte - revocation_sig_length: 1 byte - revocation_sig: 73 bytes - revocation_key_length: 1 byte - revocation_key: 33 bytes - witness_script_length: 1 byte - witness_script (offered_htlc_script).
OfferedHtlcPenaltyWitnessSizeConfirmed 246 bytes.
OfferedHtlcScriptSize 133 bytes - OP_DUP: 1 byte - OP_HASH160: 1 byte - OP_DATA: 1 byte (RIPEMD160(SHA256(revocationkey)) length) - RIPEMD160(SHA256(revocationkey)): 20 bytes - OP_EQUAL: 1 byte - OP_IF: 1 byte - OP_CHECKSIG: 1 byte - OP_ELSE: 1 byte - OP_DATA: 1 byte (remotekey length) - remotekey: 33 bytes - OP_SWAP: 1 byte - OP_SIZE: 1 byte - OP_DATA: 1 byte (32 length) - 32: 1 byte - OP_EQUAL: 1 byte - OP_NOTIF: 1 byte - OP_DROP: 1 byte - 2: 1 byte - OP_SWAP: 1 byte - OP_DATA: 1 byte (localkey length) - localkey: 33 bytes - 2: 1 byte - OP_CHECKMULTISIG: 1 byte - OP_ELSE: 1 byte - OP_HASH160: 1 byte - OP_DATA: 1 byte (RIPEMD160(payment_hash) length) - RIPEMD160(payment_hash): 20 bytes - OP_EQUALVERIFY: 1 byte - OP_CHECKSIG: 1 byte - OP_ENDIF: 1 byte - OP_1: 1 byte // These 3 extra bytes are only - OP_CSV: 1 byte // present for the confirmed - OP_DROP: 1 byte // HTLC script types.
OfferedHtlcScriptSizeConfirmed 136 bytes.
OfferedHtlcSuccessWitnessSize 242 bytes - number_of_witness_elements: 1 byte - receiver_sig_length: 1 byte - receiver_sig: 73 bytes - payment_preimage_length: 1 byte - payment_preimage: 32 bytes - witness_script_length: 1 byte - witness_script (offered_htlc_script).
OfferedHtlcSuccessWitnessSizeConfirmed 245 bytes.
OfferedHtlcTimeoutWitnessSize 285 bytes - number_of_witness_elements: 1 byte - nil_length: 1 byte - sig_alice_length: 1 byte - sig_alice: 73 bytes - sig_bob_length: 1 byte - sig_bob: 73 bytes - nil_length: 1 byte - witness_script_length: 1 byte - witness_script (offered_htlc_script)
Input to second level timeout tx, spending non-delayed HTLC output.
OfferedHtlcTimeoutWitnessSizeConfirmed 288 bytes
Input to second level timeout tx, spending 1 CSV delayed HTLC output.
P2PKHOutputSize 34 bytes - value: 8 bytes - var_int: 1 byte (pkscript_length) - pkscript (p2pkh): 25 bytes.
P2PKHScriptSigSize 108 bytes - OP_DATA: 1 byte (signature length) - signature - OP_DATA: 1 byte (pubkey length) - pubkey.
P2PKHSize 25 bytes.
P2SHOutputSize 32 bytes - value: 8 bytes - var_int: 1 byte (pkscript_length) - pkscript (p2sh): 23 bytes.
P2SHSize 23 bytes.
P2TROutputSize 43 bytes - value: 8 bytes - var_int: 1 byte (pkscript_length) - pkscript (p2tr): 34 bytes.
P2TRSize 34 bytes - OP_0: 1 byte - OP_DATA: 1 byte (x-only public key length) - x-only public key length: 32 bytes.
P2WKHOutputSize 31 bytes - value: 8 bytes - var_int: 1 byte (pkscript_length) - pkscript (p2wpkh): 22 bytes.
P2WKHWitnessSize 109 bytes - number_of_witness_elements: 1 byte - signature_length: 1 byte - signature - pubkey_length: 1 byte - pubkey.
P2WPKHSize 22 bytes - OP_0: 1 byte - OP_DATA: 1 byte (PublicKeyHASH160 length) - PublicKeyHASH160: 20 bytes.
P2WSHOutputSize 43 bytes - value: 8 bytes - var_int: 1 byte (pkscript_length) - pkscript (p2wsh): 34 bytes.
P2WSHSize 34 bytes - OP_0: 1 byte - OP_DATA: 1 byte (WitnessScriptSHA256 length) - WitnessScriptSHA256: 32 bytes.
PubKeyFormatCompressedOdd is the identifier prefix byte for a public key whose Y coordinate is odd when serialized in the compressed format per section 2.3.4 of [SEC1](https://secg.org/sec1-v2.pdf#subsubsection.2.3.4).
ScriptPathDelay is a script path used when a contract has relative delay that must elapse before it can be swept.
ScriptPathRevocation is a script path used when a contract has been breached.
ScriptPathSuccess is a script path that can be taken only with some secret data.
ScriptPathTimeout is a script path that can be taken only after a timeout has elapsed.
TaprootAcceptedRevokeWitnessSize: - number_of_witness_elements: 1 byte - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default)nolint:lll.
TaprootAnchorSweepSpend is the witness type we'll use for spending our own anchor output.
TaprootAnchorWitnessSize: 67 bytes
In this case, we use the custom sighash size to give the most pessemistic estimate.
TaprootBaseControlBlockWitnessSize 33 bytes - leafVersionAndParity: 1 byte - schnorrPubKey: 32 byte.
TaprootCommitmentAnchorOutput 43 bytes - Value: 8 bytes - VarInt: 1 byte (PkScript length) - PkScript (P2TR).
TaprootCommitmentOutput 43 bytes - Value: 8 bytes - VarInt: 1 byte (PkScript length) - PkScript (P2TR).
TaprootCommitmentRevoke is a witness that allows us to sweep the settled output of a malicious counterparty's who broadcasts a revoked taproot commitment transaction.
TaprootCommitWeight 968 weight.
TaprootHtlcAcceptedLocalSuccess is a witness type that allows us to sweep the HTLC offered to us on our local commitment transaction.
TaprootHtlcAcceptedLocalSuccessScriptSize: - OP_SIZE: 1 byte - OP_DATA: 1 byte - 32: 1 byte - OP_EQUALVERIFY: 1 byte - OP_HASH160: 1 byte - OP_DATA: 1 byte (RIPEMD160(payment_hash) length) - RIPEMD160(payment_hash): 20 bytes - OP_EQUALVERIFY: 1 byte - OP_DATA: 1 byte (pub key len) - local_key: 32 bytes - OP_CHECKSIGVERIFY: 1 byte - OP_DATA: 1 byte (pub key len) - remote_key: 32 bytes - OP_CHECKSIG: 1 byte.
TaprootHtlcAcceptedLocalSuccessWitnessSize: - number_of_witness_elements: 1 byte - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default) - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default) - payment_preimage_length: 1 byte - payment_preimage: 32 bytes - script_len: 1 byte - taproot_accepted_htlc_script_success_size: - ctrl_block_len: 1 byte - base_control_block_size: 33 bytes - sibilng_merkle_proof: 32 bytes.
TaprootHtlcAcceptedRemoteSuccess is a witness that allows us to sweep an HTLC that was offered to us by the remote party for a taproot channels.
TaprootHtlcAcceptedRemoteSuccessScriptSize: - OP_SIZE: 1 byte - OP_DATA: 1 byte - 32: 1 byte - OP_EQUALVERIFY: 1 byte - OP_HASH160: 1 byte - OP_DATA: 1 byte (RIPEMD160(payment_hash) length) - RIPEMD160(payment_hash): 20 bytes - OP_EQUALVERIFY: 1 byte - OP_DATA: 1 byte (pub key len) - remote_key: 32 bytes - OP_CHECKSIG: 1 byte - OP_1: 1 byte - OP_CSV: 1 byte - OP_DROP: 1 byte.
TaprootHtlcAcceptedRemoteSuccessScriptSize: - number_of_witness_elements: 1 byte - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default) - payment_preimage_length: 1 byte - payment_preimage: 32 bytes - script_len: 1 byte - taproot_offered_htlc_script_success_size: - ctrl_block_len: 1 byte - base_control_block_size: 33 bytes - sibilng_merkle_proof: 32 bytes.
TaprootHtlcAcceptedRevoke is a witness that allows us to sweep an HTLC sent to us by the remote party in the event that they broadcast a revoked state.
TaprootHtlcAcceptedSuccessSecondLevel is a witness that allows us to sweep an HTLC we accepted on our commitment transaction after we go to the second level on chain.
TaprootHtlcLocalOfferedTimeout is a witness type that allows us to sign the second level HTLC timeout transaction when spending from an HTLC residing on our local commitment transaction.
TaprootHtlcOfferedLocalTmeoutScriptSize: - OP_DATA: 1 byte (pub key len) - local_key: 32 bytes - OP_CHECKSIGVERIFY: 1 byte - OP_DATA: 1 byte (pub key len) - remote_key: 32 bytes - OP_CHECKSIG: 1 byte.
TaprootHtlcOfferedRemoteTimeout is a witness that allows us to sweep an HTLC we offered to the remote party that lies on the commitment transaction for the remote party.
TaprootHtlcOfferedRemoteTimeoutScriptSize: 42 bytes - OP_DATA: 1 byte (pub key len) - local_key: 32 bytes - OP_CHECKSIG: 1 byte - OP_1: 1 byte - OP_DROP: 1 byte - OP_CHECKSEQUENCEVERIFY: 1 byte - OP_DATA: 1 byte (cltv_expiry length) - cltv_expiry: 4 bytes - OP_CHECKLOCKTIMEVERIFY: 1 byte - OP_DROP: 1 byte.
TaprootHtlcOfferedRemoteTimeoutwitSize: 176 bytes - number_of_witness_elements: 1 byte - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default) - script_len: 1 byte - taproot_offered_htlc_script_size: 42 bytes - ctrl_block_len: 1 byte - base_control_block_size: 33 bytes - sibilng_merkle_proof: 32 bytes.
TaprootHtlcOfferedRevoke is a witness that allows us to sweep an HTLC we offered to the remote party if they broadcast a revoked commitment.
TaprootHtlcOfferedTimeoutSecondLevel is a witness that allows us to timeout an HTLC we offered to the remote party on our commitment transaction.
TaprootHtlcSecondLevelRevoke is a witness that allows us to sweep an HTLC on the revoked transaction of the remote party that goes to the second level.
TaprootHtlcSuccessWeight is the total weight of the taproot HTLC success transaction.
TaprootHtlcTimeoutWeight is the total weight of the taproot HTLC timeout transaction.
TaprootKeyPathCustomSighashWitnessSize 67 bytes - NumberOfWitnessElements: 1 byte - sigLength: 1 byte - sig: 64 bytes - sighashFlag: 1 byte.
TaprootKeyPathWitnessSize 66 bytes - NumberOfWitnessElements: 1 byte - sigLength: 1 byte - sig: 64 bytes.
TaprootKeySpendBIP0086SignMethod denotes that a SegWit v1 (p2tr) input should be signed by using the BIP0086 method (commit to internal key only).
TaprootKeySpendSignMethod denotes that a SegWit v1 (p2tr) input should be signed by using a given taproot hash to commit to in addition to the internal key.
TaprootLocalCommitSpend is a witness type that allows us to spend our settled local commitment after a CSV delay when we force close the channel.
TaprootNUMSHex is the hex encoded version of the taproot NUMs key.
TaprootOfferedLocalTimeoutWitnessSize - number_of_witness_elements: 1 byte - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default) - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default) - script_len: 1 byte - taproot_offered_htlc_script_timeout_size: - ctrl_block_len: 1 byte - base_control_block_size: 33 bytes - sibilng_merkle_proof: 32 bytes.
TaprootOfferedRevokeWitnessSize: - number_of_witness_elements: 1 byte - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default).
TaprootPubKeySpend is a witness type that allows us to spend a regular p2tr output that's sent to an output which is under complete control of the backing wallet.
TaprootRemoteCommitSpend is a witness type that allows us to spend our settled local commitment after a CSV delay when the remote party has force closed the channel.
TaprootScriptSpendSignMethod denotes that a SegWit v1 (p2tr) input should be spent using the script path and that a specific leaf script should be signed for.
TaprootSecondLevelHtlcScriptSize: 41 bytes - OP_DATA: 1 byte (pub key len) - local_key: 32 bytes - OP_CHECKSIG: 1 byte - OP_DATA: 1 byte (csv delay) - csv_delay: 4 bytes (worst case) - OP_CSV: 1 byte - OP_DROP: 1 byte.
TaprootSecondLevelHtlcWitnessSize: - number_of_witness_elements: 1 byte - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default) - script_len: 1 byte - taproot_second_level_htlc_script_size: 40 bytes - ctrl_block_len: 1 byte - base_control_block_size: 33 bytes.
TaprootSecondLevelRevokeWitnessSize - number_of_witness_elements: 1 byte - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default)nolint:lll.
TaprootSignatureWitnessSize 65 bytes - sigLength: 1 byte - sig: 64 bytes.
TaprootToLocalRevokeScriptSize: 68 bytes - OP_DATA: 1 byte - local key: 32 bytes - OP_DROP: 1 byte - OP_DATA: 1 byte - revocation key: 32 bytes - OP_CHECKSIG: 1 byte.
TaprootToLocalRevokeWitnessSize: 202 bytes - NumberOfWitnessElements: 1 byte - sigLength: 1 byte - sweep sig: 65 bytes - script len: 1 byte - revocation script size: 68 bytes - ctrl block size: 1 byte - base control block: 33 bytes - merkle proof: 32.
TaprootToLocalScriptSize - OP_DATA: 1 byte (pub key len) - local_key: 32 bytes - OP_CHECKSIG: 1 byte - OP_DATA: 1 byte (csv delay) - csv_delay: 4 bytes (worst case estimate) - OP_CSV: 1 byte - OP_DROP: 1 byte.
TaprootToLocalWitnessSize: 175 bytes - number_of_witness_elements: 1 byte - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default) - script_len: 1 byte - taproot_to_local_script_size: 41 bytes - ctrl_block_len: 1 byte - base_control_block_size: 33 bytes - sibling_merkle_hash: 32 bytes.
TaprootToRemoteScriptSize - OP_DATA: 1 byte - remote key: 32 bytes - OP_CHECKSIG: 1 byte - OP_1: 1 byte - OP_CHECKSEQUENCEVERIFY: 1 byte - OP_DROP: 1 byte.
TaprootToRemoteWitnessSize: - number_of_witness_elements: 1 byte - sig_len: 1 byte - sweep_sig: 65 bytes (worst case w/o sighash default) - script_len: 1 byte - taproot_to_local_script_size: 36 bytes - ctrl_block_len: 1 byte - base_control_block_size: 33 bytes.
ToLocalPenaltyWitnessSize 157 bytes - number_of_witness_elements: 1 byte - revocation_sig_length: 1 byte - revocation_sig: 73 bytes - OP_TRUE_length: 1 byte - OP_TRUE: 1 byte - witness_script_length: 1 byte - witness_script (to_local_script).
ToLocalScriptSize 79 bytes - OP_IF: 1 byte - OP_DATA: 1 byte - revoke_key: 33 bytes - OP_ELSE: 1 byte - OP_DATA: 1 byte - csv_delay: 4 bytes - OP_CHECKSEQUENCEVERIFY: 1 byte - OP_DROP: 1 byte - OP_DATA: 1 byte - delay_key: 33 bytes - OP_ENDIF: 1 byte - OP_CHECKSIG: 1 byte.
ToLocalTimeoutWitnessSize 156 bytes - number_of_witness_elements: 1 byte - local_delay_sig_length: 1 byte - local_delay_sig: 73 bytes - zero_length: 1 byte - witness_script_length: 1 byte - witness_script (to_local_script).
ToRemoteConfirmedScriptSize 37 bytes - OP_DATA: 1 byte - to_remote_key: 33 bytes - OP_CHECKSIGVERIFY: 1 byte - OP_1: 1 byte - OP_CHECKSEQUENCEVERIFY: 1 byte.
ToRemoteConfirmedWitnessSize 113 bytes - number_of_witness_elements: 1 byte - sig_length: 1 byte - sig: 73 bytes - witness_script_length: 1 byte - witness_script (to_remote_delayed_script).
UnknownWitnessSize 42 bytes - OP_x: 1 byte - OP_DATA: 1 byte (max-size length) - max-size: 40 bytes.
WitnessCommitmentTxWeight 224 weight.
WitnessHeaderSize 2 bytes - Flag: 1 byte - Marker: 1 byte.
WitnessKeyHash is a witness type that allows us to spend a regular p2wkh output that's sent to an output which is under complete control of the backing wallet.
WitnessV0SignMethod denotes that a SegWit v0 (p2wkh, np2wkh, p2wsh) input script should be signed.
# Variables
EmptyOutPoint is a zeroed outpoint.
ErrTweakOverdose signals a SignDescriptor is invalid because both of its SingleTweak and DoubleTweak are non-nil.
ErrUnknownScriptType is returned when an unknown script type is encountered.
SequenceLockTimeSeconds is the 22nd bit which indicates the lock time is in seconds.
TaprootNUMSKey is a NUMS key (nothing up my sleeves number) that has no known private key.
# Structs
AnchorScriptTree holds all the contents needed to sweep a taproot anchor output on chain.
BaseInput contains all the information needed to sweep a basic output (CSV/CLTV/no time lock).
CommitScriptTree holds the taproot output key (in this case the revocation key, or a NUMs point for the remote output) along with the tapscript leaf that can spend the output after a delay.
HtlcAuxLeaf is a type that represents an auxiliary leaf for an HTLC output.
HtlcScriptTree holds the taproot output key, as well as the two script path leaves that every taproot HTLC script depends on.
HtlcSecondLevelAnchorInput is an input type used to spend HTLC outputs using a re-signed second level transaction, either via the timeout or success paths.
HtlcSucceedInput constitutes a sweep input that needs a pre-image.
MockInput implements the `Input` interface and is used by other packages for mock testing.
MockInputSigner is a mock implementation of the Signer interface.
MockSigner is a simple implementation of the Signer interface.
MockWitnessType implements the `WitnessType` interface and is used by other packages for mock testing.
MuSig2SessionInfo is a struct for keeping track of a signing session information in memory.
MuSig2State is a struct that holds on to the internal signing session state of a MuSig2 session.
MuSig2Tweaks is a struct that contains all tweaks that can be applied to a MuSig2 combined public key.
MusigSessionMusigSessionManager houses the state needed to manage concurrent musig sessions.
Script represents any script inputs required to redeem a previous output.
ScriptTree holds the contents needed to spend a script within a tapscript tree.
SecondLevelScriptTree is a tapscript tree used to spend the second level HTLC output after the CSV delay has passed.
SignDescriptor houses the necessary information required to successfully sign a given segwit output.
SignDetails is a struct containing information needed to resign certain inputs.
TxInfo describes properties of a parent tx that are relevant for CPFP.
TxWeightEstimator is able to calculate weight estimates for transactions based on the input and output types.
# Interfaces
Input represents an abstract UTXO which is to be spent using a sweeping transaction.
MuSig2Context is an interface that is an abstraction over the MuSig2 signing context.
MuSig2Session is an interface that is an abstraction over the MuSig2 signing session.
MuSig2Signer is an interface that declares all methods that a MuSig2 compatible signer needs to implement.
ScriptDescriptor is an interface that abstracts over the various ways a pkScript can be spent from an output.
Signature is an interface for objects that can populate signatures during witness construction.
Signer represents an abstract object capable of generating raw signatures as well as full complete input scripts given a valid SignDescriptor and transaction.
TapscriptDescriptor is a super-set of the normal script multiplexer that adds in taproot specific details such as the control block, or top-level tap tweak.
WitnessType determines how an output's witness will be generated.
# Type aliases
HtlcAuxLeaves is a type alias for a map of optional tapscript leaves.
HtlcIndex represents the monotonically increasing counter that is used to identify HTLCs created by a peer.
InputOpt is a functional option that can be used to modify the default input options.
MuSig2SessionID is a type for a session ID that is just a hash of the MuSig2 combined key and the local public nonces.
MuSig2Version is a type that defines the different versions of the MuSig2 as defined in the BIP draft: (https://github.com/jonasnick/bips/blob/musig2/bip-musig2.mediawiki).
PrivKeyFetcher is used to fetch a private key that matches a given key desc.
ScriptPath is used to indicate the spending path of a given script.
SignMethod defines the different ways a signer can sign, given a specific input.
StandardWitnessType is a numeric representation of standard pre-defined types of witness configurations.
WitnessGenerator represents a function that is able to generate the final witness for a particular public key script.