Transactions
object Transactions
Content copied to clipboard
Created by PM on 15/12/2016.
Types
Commitment Output Link
Link copied to clipboard
data class CommitmentOutputLink<T : CommitmentOutput>(output: TxOut, redeemScript: List<ScriptElt>, commitmentOutput: T) : Comparable<Transactions.CommitmentOutputLink<T>>
Content copied to clipboard
Represent a link between a commitment spec item (to-local, to-remote, htlc) and the actual output in the commit tx
Transaction With Input Info
Link copied to clipboard
sealed class TransactionWithInputInfo
Content copied to clipboard
Tx Generation Skipped
Link copied to clipboard
sealed class TxGenerationSkipped
Content copied to clipboard
Functions
add Sigs
Link copied to clipboard
fun addSigs(claimHtlcDelayedPenalty: Transactions.TransactionWithInputInfo.ClaimHtlcDelayedOutputPenaltyTx, revocationSig: ByteVector64): Transactions.TransactionWithInputInfo.ClaimHtlcDelayedOutputPenaltyTx
Content copied to clipboard
fun addSigs(claimHtlcTimeoutTx: Transactions.TransactionWithInputInfo.ClaimHtlcTx.ClaimHtlcTimeoutTx, localSig: ByteVector64): Transactions.TransactionWithInputInfo.ClaimHtlcTx.ClaimHtlcTimeoutTx
Content copied to clipboard
fun addSigs(claimLocalDelayed: Transactions.TransactionWithInputInfo.ClaimLocalDelayedOutputTx, localSig: ByteVector64): Transactions.TransactionWithInputInfo.ClaimLocalDelayedOutputTx
Content copied to clipboard
fun addSigs(claimRemoteDelayed: Transactions.TransactionWithInputInfo.ClaimRemoteCommitMainOutputTx.ClaimRemoteDelayedOutputTx, localSig: ByteVector64): Transactions.TransactionWithInputInfo.ClaimRemoteCommitMainOutputTx.ClaimRemoteDelayedOutputTx
Content copied to clipboard
fun addSigs(mainPenaltyTx: Transactions.TransactionWithInputInfo.MainPenaltyTx, revocationSig: ByteVector64): Transactions.TransactionWithInputInfo.MainPenaltyTx
Content copied to clipboard
fun addSigs(claimHtlcSuccessTx: Transactions.TransactionWithInputInfo.ClaimHtlcTx.ClaimHtlcSuccessTx, localSig: ByteVector64, paymentPreimage: ByteVector32): Transactions.TransactionWithInputInfo.ClaimHtlcTx.ClaimHtlcSuccessTx
Content copied to clipboard
fun addSigs(claimP2WPKHOutputTx: Transactions.TransactionWithInputInfo.ClaimRemoteCommitMainOutputTx.ClaimP2WPKHOutputTx, localPaymentPubkey: PublicKey, localSig: ByteVector64): Transactions.TransactionWithInputInfo.ClaimRemoteCommitMainOutputTx.ClaimP2WPKHOutputTx
Content copied to clipboard
fun addSigs(htlcPenaltyTx: Transactions.TransactionWithInputInfo.HtlcPenaltyTx, revocationSig: ByteVector64, revocationPubkey: PublicKey): Transactions.TransactionWithInputInfo.HtlcPenaltyTx
Content copied to clipboard
fun addSigs(htlcTimeoutTx: Transactions.TransactionWithInputInfo.HtlcTx.HtlcTimeoutTx, localSig: ByteVector64, remoteSig: ByteVector64): Transactions.TransactionWithInputInfo.HtlcTx.HtlcTimeoutTx
Content copied to clipboard
fun addSigs(htlcSuccessTx: Transactions.TransactionWithInputInfo.HtlcTx.HtlcSuccessTx, localSig: ByteVector64, remoteSig: ByteVector64, paymentPreimage: ByteVector32): Transactions.TransactionWithInputInfo.HtlcTx.HtlcSuccessTx
Content copied to clipboard
fun addSigs(closingTx: Transactions.TransactionWithInputInfo.ClosingTx, localFundingPubkey: PublicKey, remoteFundingPubkey: PublicKey, localSig: ByteVector64, remoteSig: ByteVector64): Transactions.TransactionWithInputInfo.ClosingTx
Content copied to clipboard
fun addSigs(commitTx: Transactions.TransactionWithInputInfo.CommitTx, localFundingPubkey: PublicKey, remoteFundingPubkey: PublicKey, localSig: ByteVector64, remoteSig: ByteVector64): Transactions.TransactionWithInputInfo.CommitTx
Content copied to clipboard
check Sig
Link copied to clipboard
fun checkSig(txinfo: Transactions.TransactionWithInputInfo, sig: ByteVector64, pubKey: PublicKey, sigHash: Int = SigHash.SIGHASH_ALL): Boolean
Content copied to clipboard
check Spendable
Link copied to clipboard
fun checkSpendable(txinfo: Transactions.TransactionWithInputInfo): Try<Unit>
Content copied to clipboard
commit Tx Fee
Link copied to clipboard
commit Tx Fee Msat
Link copied to clipboard
fun commitTxFeeMsat(dustLimit: Satoshi, spec: CommitmentSpec): MilliSatoshi
Content copied to clipboard
While fees are generally computed in Satoshis (since this is the smallest on-chain unit), it may be useful in some cases to calculate it in MilliSatoshi to avoid rounding issues. If you are adding multiple fees together for example, you should always add them in MilliSatoshi and then round down to Satoshi.
decode Tx Number
Link copied to clipboard
encode Tx Number
Link copied to clipboard
This is a trick to split and encode a 48-bit txnumber into the sequence and locktime fields of a tx
fee2rate
Link copied to clipboard
get Commit Tx Number
Link copied to clipboard
fun getCommitTxNumber(commitTx: Transaction, isFunder: Boolean, localPaymentBasePoint: PublicKey, remotePaymentBasePoint: PublicKey): Long
Content copied to clipboard
htlc Output Fee
Link copied to clipboard
Fee for an un-trimmed HTLC.
make Claim Delayed Output Penalty Txs
Link copied to clipboard
fun makeClaimDelayedOutputPenaltyTxs(delayedOutputTx: Transaction, localDustLimit: Satoshi, localRevocationPubkey: PublicKey, toLocalDelay: CltvExpiryDelta, localDelayedPaymentPubkey: PublicKey, localFinalScriptPubKey: ByteArray, feerate: FeeratePerKw): List<Transactions.TxResult<Transactions.TransactionWithInputInfo.ClaimHtlcDelayedOutputPenaltyTx>>
Content copied to clipboard
make Claim Htlc Success Tx
Link copied to clipboard
fun makeClaimHtlcSuccessTx(commitTx: Transaction, outputs: TransactionsCommitmentOutputs, localDustLimit: Satoshi, localHtlcPubkey: PublicKey, remoteHtlcPubkey: PublicKey, remoteRevocationPubkey: PublicKey, localFinalScriptPubKey: ByteArray, htlc: UpdateAddHtlc, feerate: FeeratePerKw): Transactions.TxResult<Transactions.TransactionWithInputInfo.ClaimHtlcTx.ClaimHtlcSuccessTx>
Content copied to clipboard
make Claim Htlc Timeout Tx
Link copied to clipboard
fun makeClaimHtlcTimeoutTx(commitTx: Transaction, outputs: TransactionsCommitmentOutputs, localDustLimit: Satoshi, localHtlcPubkey: PublicKey, remoteHtlcPubkey: PublicKey, remoteRevocationPubkey: PublicKey, localFinalScriptPubKey: ByteArray, htlc: UpdateAddHtlc, feerate: FeeratePerKw): Transactions.TxResult<Transactions.TransactionWithInputInfo.ClaimHtlcTx.ClaimHtlcTimeoutTx>
Content copied to clipboard
make Claim Local Delayed Output Tx
Link copied to clipboard
fun makeClaimLocalDelayedOutputTx(delayedOutputTx: Transaction, localDustLimit: Satoshi, localRevocationPubkey: PublicKey, toLocalDelay: CltvExpiryDelta, localDelayedPaymentPubkey: PublicKey, localFinalScriptPubKey: ByteArray, feerate: FeeratePerKw): Transactions.TxResult<Transactions.TransactionWithInputInfo.ClaimLocalDelayedOutputTx>
Content copied to clipboard
make Claim P2WPKHOutput Tx
Link copied to clipboard
fun makeClaimP2WPKHOutputTx(delayedOutputTx: Transaction, localDustLimit: Satoshi, localPaymentPubkey: PublicKey, localFinalScriptPubKey: ByteArray, feerate: FeeratePerKw): Transactions.TxResult<Transactions.TransactionWithInputInfo.ClaimRemoteCommitMainOutputTx.ClaimP2WPKHOutputTx>
Content copied to clipboard
make Claim Remote Delayed Output Tx
Link copied to clipboard
fun makeClaimRemoteDelayedOutputTx(commitTx: Transaction, localDustLimit: Satoshi, localPaymentPubkey: PublicKey, localFinalScriptPubKey: ByteVector, feerate: FeeratePerKw): Transactions.TxResult<Transactions.TransactionWithInputInfo.ClaimRemoteCommitMainOutputTx.ClaimRemoteDelayedOutputTx>
Content copied to clipboard
make Closing Tx
Link copied to clipboard
fun makeClosingTx(commitTxInput: Transactions.InputInfo, localScriptPubKey: ByteArray, remoteScriptPubKey: ByteArray, localIsFunder: Boolean, dustLimit: Satoshi, closingFee: Satoshi, spec: CommitmentSpec): Transactions.TransactionWithInputInfo.ClosingTx
Content copied to clipboard
make Commit Tx
Link copied to clipboard
fun makeCommitTx(commitTxInput: Transactions.InputInfo, commitTxNumber: Long, localPaymentBasePoint: PublicKey, remotePaymentBasePoint: PublicKey, localIsFunder: Boolean, outputs: TransactionsCommitmentOutputs): Transactions.TransactionWithInputInfo.CommitTx
Content copied to clipboard
make Commit Tx Outputs
Link copied to clipboard
fun makeCommitTxOutputs(localFundingPubkey: PublicKey, remoteFundingPubkey: PublicKey, localIsFunder: Boolean, localDustLimit: Satoshi, localRevocationPubkey: PublicKey, toLocalDelay: CltvExpiryDelta, localDelayedPaymentPubkey: PublicKey, remotePaymentPubkey: PublicKey, localHtlcPubkey: PublicKey, remoteHtlcPubkey: PublicKey, spec: CommitmentSpec): TransactionsCommitmentOutputs
Content copied to clipboard
make Htlc Penalty Tx
Link copied to clipboard
fun makeHtlcPenaltyTx(commitTx: Transaction, htlcOutputIndex: Int, redeemScript: ByteArray, localDustLimit: Satoshi, localFinalScriptPubKey: ByteArray, feerate: FeeratePerKw): Transactions.TxResult<Transactions.TransactionWithInputInfo.HtlcPenaltyTx>
Content copied to clipboard
We already have the redeemScript, no need to build it
make Htlc Txs
Link copied to clipboard
fun makeHtlcTxs(commitTx: Transaction, localDustLimit: Satoshi, localRevocationPubkey: PublicKey, toLocalDelay: CltvExpiryDelta, localDelayedPaymentPubkey: PublicKey, feerate: FeeratePerKw, outputs: TransactionsCommitmentOutputs): List<Transactions.TransactionWithInputInfo.HtlcTx>
Content copied to clipboard
make Main Penalty Tx
Link copied to clipboard
fun makeMainPenaltyTx(commitTx: Transaction, localDustLimit: Satoshi, remoteRevocationPubkey: PublicKey, localFinalScriptPubKey: ByteArray, toRemoteDelay: CltvExpiryDelta, remoteDelayedPaymentPubkey: PublicKey, feerate: FeeratePerKw): Transactions.TxResult<Transactions.TransactionWithInputInfo.MainPenaltyTx>
Content copied to clipboard
obscured Commit Tx Number
Link copied to clipboard
fun obscuredCommitTxNumber(commitTxNumber: Long, isFunder: Boolean, localPaymentBasePoint: PublicKey, remotePaymentBasePoint: PublicKey): Long
Content copied to clipboard
offered Htlc Trim Threshold
Link copied to clipboard
fun offeredHtlcTrimThreshold(dustLimit: Satoshi, spec: CommitmentSpec): Satoshi
Content copied to clipboard
Offered HTLCs below this amount will be trimmed.
received Htlc Trim Threshold
Link copied to clipboard
fun receivedHtlcTrimThreshold(dustLimit: Satoshi, spec: CommitmentSpec): Satoshi
Content copied to clipboard
Received HTLCs below this amount will be trimmed.
sign
Link copied to clipboard
fun sign(txinfo: Transactions.TransactionWithInputInfo, key: PrivateKey, sigHash: Int = SigHash.SIGHASH_ALL): ByteVector64
Content copied to clipboard
trim Offered Htlcs
Link copied to clipboard
fun trimOfferedHtlcs(dustLimit: Satoshi, spec: CommitmentSpec): List<OutgoingHtlc>
Content copied to clipboard
trim Received Htlcs
Link copied to clipboard
fun trimReceivedHtlcs(dustLimit: Satoshi, spec: CommitmentSpec): List<IncomingHtlc>
Content copied to clipboard
weight2fee
Link copied to clipboard
Properties
claimAnchorOutputWeight
Link copied to clipboard
claimHtlcDelayedWeight
Link copied to clipboard
claimHtlcSuccessWeight
Link copied to clipboard
claimHtlcTimeoutWeight
Link copied to clipboard
claimP2WPKHOutputWeight
Link copied to clipboard
htlcPenaltyWeight
Link copied to clipboard
mainPenaltyWeight
Link copied to clipboard
PlaceHolderPubKey
Link copied to clipboard
PlaceHolderSig
Link copied to clipboard