Versions in this module Expand all Collapse all v1 v1.0.0 May 10, 2019 Changes in this version + const AcceptedHtlcPenaltyWitnessSize + const AcceptedHtlcScriptSize + const AcceptedHtlcSuccessWitnessSize + const AcceptedHtlcTimeoutWitnessSize + const BaseCommitmentTxSize + const BaseCommitmentTxWeight + const BaseTxSize + const CommitWeight + const CommitmentDelayOutput + const CommitmentKeyHashOutput + const FundingInputSize + const HTLCSize + const HTLCWeight + const HtlcSuccessWeight + const HtlcTimeoutWeight + const HtlcWeight + const InputSize + const MaxHTLCNumber + const MultiSigSize + const OfferedHtlcPenaltyWitnessSize + const OfferedHtlcScriptSize + const OfferedHtlcSuccessWitnessSize + const OfferedHtlcTimeoutWitnessSize + const P2PKHOutputSize + const P2PKHScriptSigSize + const P2SHOutputSize + const P2WKHOutputSize + const P2WKHWitnessSize + const P2WPKHSize + const P2WSHOutputSize + const P2WSHSize + const ToLocalPenaltyWitnessSize + const ToLocalScriptSize + const ToLocalTimeoutWitnessSize + const WitnessCommitmentTxWeight + const WitnessHeaderSize + const WitnessSize + var ErrTweakOverdose = errors.New("sign descriptor should only have one tweak") + var SequenceLockTimeSeconds = uint32(1 << 22) + func CommitScriptToSelf(csvTimeout uint32, selfKey, revokeKey *btcec.PublicKey) ([]byte, error) + func CommitScriptUnencumbered(key *btcec.PublicKey) ([]byte, error) + func CommitSpendNoDelay(signer Signer, signDesc *SignDescriptor, sweepTx *wire.MsgTx) (wire.TxWitness, error) + func CommitSpendRevoke(signer Signer, signDesc *SignDescriptor, sweepTx *wire.MsgTx) (wire.TxWitness, error) + func CommitSpendTimeout(signer Signer, signDesc *SignDescriptor, sweepTx *wire.MsgTx) (wire.TxWitness, error) + func ComputeCommitmentPoint(commitSecret []byte) *btcec.PublicKey + func DeriveRevocationPrivKey(revokeBasePriv *btcec.PrivateKey, commitSecret *btcec.PrivateKey) *btcec.PrivateKey + func DeriveRevocationPubkey(revokeBase, commitPoint *btcec.PublicKey) *btcec.PublicKey + func EstimateCommitTxWeight(count int, prediction bool) int64 + func FindScriptOutputIndex(tx *wire.MsgTx, script []byte) (bool, uint32) + func GenFundingPkScript(aPub, bPub []byte, amt int64) ([]byte, *wire.TxOut, error) + func GenMultiSigScript(aPub, bPub []byte) ([]byte, error) + func HtlcSecondLevelSpend(signer Signer, signDesc *SignDescriptor, sweepTx *wire.MsgTx) (wire.TxWitness, error) + func HtlcSpendRevoke(signer Signer, signDesc *SignDescriptor, revokeTx *wire.MsgTx) (wire.TxWitness, error) + func HtlcSpendSuccess(signer Signer, signDesc *SignDescriptor, sweepTx *wire.MsgTx, csvDelay uint32) (wire.TxWitness, error) + func LockTimeToSequence(isSeconds bool, locktime uint32) uint32 + func ReadSignDescriptor(r io.Reader, sd *SignDescriptor) error + func ReceiverHTLCScript(cltvExpiry uint32, ...) ([]byte, error) + func ReceiverHtlcSpendRedeem(senderSig, paymentPreimage []byte, signer Signer, signDesc *SignDescriptor, ...) (wire.TxWitness, error) + func ReceiverHtlcSpendRevoke(signer Signer, signDesc *SignDescriptor, sweepTx *wire.MsgTx) (wire.TxWitness, error) + func ReceiverHtlcSpendRevokeWithKey(signer Signer, signDesc *SignDescriptor, revokeKey *btcec.PublicKey, ...) (wire.TxWitness, error) + func ReceiverHtlcSpendTimeout(signer Signer, signDesc *SignDescriptor, sweepTx *wire.MsgTx, cltvExpiry int32) (wire.TxWitness, error) + func Ripemd160H(d []byte) []byte + func SecondLevelHtlcScript(revocationKey, delayKey *btcec.PublicKey, csvDelay uint32) ([]byte, error) + func SenderHTLCScript(senderHtlcKey, receiverHtlcKey, revocationKey *btcec.PublicKey, ...) ([]byte, error) + func SenderHtlcSpendRedeem(signer Signer, signDesc *SignDescriptor, sweepTx *wire.MsgTx, ...) (wire.TxWitness, error) + func SenderHtlcSpendRevoke(signer Signer, signDesc *SignDescriptor, sweepTx *wire.MsgTx) (wire.TxWitness, error) + func SenderHtlcSpendRevokeWithKey(signer Signer, signDesc *SignDescriptor, revokeKey *btcec.PublicKey, ...) (wire.TxWitness, error) + func SenderHtlcSpendTimeout(receiverSig []byte, signer Signer, signDesc *SignDescriptor, ...) (wire.TxWitness, error) + func SingleTweakBytes(commitPoint, basePoint *btcec.PublicKey) []byte + func SpendMultiSig(witnessScript, pubA, sigA, pubB, sigB []byte) [][]byte + func TweakPrivKey(basePriv *btcec.PrivateKey, commitTweak []byte) *btcec.PrivateKey + func TweakPubKey(basePoint, commitPoint *btcec.PublicKey) *btcec.PublicKey + func TweakPubKeyWithTweak(pubKey *btcec.PublicKey, tweakBytes []byte) *btcec.PublicKey + func WitnessScriptHash(witnessScript []byte) ([]byte, error) + func WriteSignDescriptor(w io.Writer, sd *SignDescriptor) error + type BaseInput struct + func MakeBaseInput(outpoint *wire.OutPoint, witnessType WitnessType, ...) BaseInput + func NewBaseInput(outpoint *wire.OutPoint, witnessType WitnessType, ...) *BaseInput + func (bi *BaseInput) BlocksToMaturity() uint32 + func (bi *BaseInput) CraftInputScript(signer Signer, txn *wire.MsgTx, hashCache *txscript.TxSigHashes, txinIdx int) (*Script, error) + func (i *BaseInput) HeightHint() uint32 + func (i *BaseInput) OutPoint() *wire.OutPoint + func (i *BaseInput) SignDesc() *SignDescriptor + func (i *BaseInput) WitnessType() WitnessType + type HtlcSucceedInput struct + func MakeHtlcSucceedInput(outpoint *wire.OutPoint, signDescriptor *SignDescriptor, preimage []byte, ...) HtlcSucceedInput + func (h *HtlcSucceedInput) BlocksToMaturity() uint32 + func (h *HtlcSucceedInput) CraftInputScript(signer Signer, txn *wire.MsgTx, hashCache *txscript.TxSigHashes, txinIdx int) (*Script, error) + func (i *HtlcSucceedInput) HeightHint() uint32 + func (i *HtlcSucceedInput) OutPoint() *wire.OutPoint + func (i *HtlcSucceedInput) SignDesc() *SignDescriptor + func (i *HtlcSucceedInput) WitnessType() WitnessType + type Input interface + BlocksToMaturity func() uint32 + CraftInputScript func(signer Signer, txn *wire.MsgTx, hashCache *txscript.TxSigHashes, txinIdx int) (*Script, error) + HeightHint func() uint32 + OutPoint func() *wire.OutPoint + SignDesc func() *SignDescriptor + WitnessType func() WitnessType + type MockSigner struct + NetParams *chaincfg.Params + Privkeys []*btcec.PrivateKey + func (m *MockSigner) ComputeInputScript(tx *wire.MsgTx, signDesc *SignDescriptor) (*Script, error) + func (m *MockSigner) SignOutputRaw(tx *wire.MsgTx, signDesc *SignDescriptor) ([]byte, error) + type Script struct + SigScript []byte + Witness wire.TxWitness + type SignDescriptor struct + DoubleTweak *btcec.PrivateKey + HashType txscript.SigHashType + InputIndex int + KeyDesc keychain.KeyDescriptor + Output *wire.TxOut + SigHashes *txscript.TxSigHashes + SingleTweak []byte + WitnessScript []byte + type Signer interface + ComputeInputScript func(tx *wire.MsgTx, signDesc *SignDescriptor) (*Script, error) + SignOutputRaw func(tx *wire.MsgTx, signDesc *SignDescriptor) ([]byte, error) + type TxWeightEstimator struct + func (twe *TxWeightEstimator) AddNestedP2WKHInput() *TxWeightEstimator + func (twe *TxWeightEstimator) AddNestedP2WSHInput(witnessSize int) *TxWeightEstimator + func (twe *TxWeightEstimator) AddP2PKHInput() *TxWeightEstimator + func (twe *TxWeightEstimator) AddP2PKHOutput() *TxWeightEstimator + func (twe *TxWeightEstimator) AddP2SHOutput() *TxWeightEstimator + func (twe *TxWeightEstimator) AddP2WKHInput() *TxWeightEstimator + func (twe *TxWeightEstimator) AddP2WKHOutput() *TxWeightEstimator + func (twe *TxWeightEstimator) AddP2WSHOutput() *TxWeightEstimator + func (twe *TxWeightEstimator) AddWitnessInput(witnessSize int) *TxWeightEstimator + func (twe *TxWeightEstimator) VSize() int + func (twe *TxWeightEstimator) Weight() int + type WitnessGenerator func(tx *wire.MsgTx, hc *txscript.TxSigHashes, inputIndex int) (*Script, error) + type WitnessType uint16 + const CommitmentNoDelay + const CommitmentRevoke + const CommitmentTimeLock + const HtlcAcceptedRemoteSuccess + const HtlcAcceptedRevoke + const HtlcAcceptedSuccessSecondLevel + const HtlcOfferedRemoteTimeout + const HtlcOfferedRevoke + const HtlcOfferedTimeoutSecondLevel + const HtlcSecondLevelRevoke + const NestedWitnessKeyHash + const WitnessKeyHash + func (wt WitnessType) GenWitnessFunc(signer Signer, descriptor *SignDescriptor) WitnessGenerator + func (wt WitnessType) String() string