Package org.ldk.structs
Class InMemorySigner
- java.lang.Object
-
- org.ldk.structs.InMemorySigner
-
public class InMemorySigner extends Object
A simple implementation of [`WriteableEcdsaChannelSigner`] that just keeps the private keys in memory. This implementation performs no policy checks and is insufficient by itself as a secure external signer.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelSigner
as_ChannelSigner()
Constructs a new ChannelSigner which calls the relevant methods on this_arg.EcdsaChannelSigner
as_EcdsaChannelSigner()
Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg.EntropySource
as_EntropySource()
Constructs a new EntropySource which calls the relevant methods on this_arg.WriteableEcdsaChannelSigner
as_WriteableEcdsaChannelSigner()
Constructs a new WriteableEcdsaChannelSigner which calls the relevant methods on this_arg.InMemorySigner
clone()
Creates a copy of the InMemorySignerChannelPublicKeys
counterparty_pubkeys()
Returns the counterparty's pubkeys.short
counterparty_selected_contest_delay()
Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable transactions, i.e., the amount of time that we have to wait to recover our funds if we broadcast a transaction.protected void
finalize()
OutPoint
funding_outpoint()
Funding outpoint Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.ChannelTransactionParameters
get_channel_parameters()
Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or building transactions.byte[]
get_commitment_seed()
Commitment seed.byte[]
get_delayed_payment_base_key()
Holder secret key used in an HTLC transaction.byte[]
get_funding_key()
Holder secret key in the 2-of-2 multisig script of a channel.byte[]
get_htlc_base_key()
Holder HTLC secret key used in commitment transaction HTLC outputs.byte[]
get_payment_key()
Holder secret key used for our balance in counterparty-broadcasted commitment transactions.byte[]
get_revocation_base_key()
Holder secret key for blinded revocation pubkey.short
holder_selected_contest_delay()
Returns the `contest_delay` value specified by us and applied on transactions broadcastable by our counterparty, i.e., the amount of time that they have to wait to recover their funds if they broadcast a transaction.boolean
is_outbound()
Returns whether the holder is the initiator.static InMemorySigner
of(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id, byte[] rand_bytes_unique_start)
Creates a new [`InMemorySigner`].boolean
opt_anchors()
Returns whether anchors should be used.static Result_InMemorySignerDecodeErrorZ
read(byte[] ser, EntropySource arg)
Read a InMemorySigner from a byte array, created by InMemorySigner_writevoid
set_commitment_seed(byte[] val)
Commitment seed.void
set_delayed_payment_base_key(byte[] val)
Holder secret key used in an HTLC transaction.void
set_funding_key(byte[] val)
Holder secret key in the 2-of-2 multisig script of a channel.void
set_htlc_base_key(byte[] val)
Holder HTLC secret key used in commitment transaction HTLC outputs.void
set_payment_key(byte[] val)
Holder secret key used for our balance in counterparty-broadcasted commitment transactions.void
set_revocation_base_key(byte[] val)
Holder secret key for blinded revocation pubkey.Result_CVec_CVec_u8ZZNoneZ
sign_counterparty_payment_input(byte[] spend_tx, long input_idx, StaticPaymentOutputDescriptor descriptor)
Sign the single input of `spend_tx` at index `input_idx`, which spends the output described by `descriptor`, returning the witness stack for the input.Result_CVec_CVec_u8ZZNoneZ
sign_dynamic_p2wsh_input(byte[] spend_tx, long input_idx, DelayedPaymentOutputDescriptor descriptor)
Sign the single input of `spend_tx` at index `input_idx` which spends the output described by `descriptor`, returning the witness stack for the input.byte[]
write()
Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
get_funding_key
public byte[] get_funding_key()
Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the holder's anchor output in a commitment transaction, if one is present.
-
set_funding_key
public void set_funding_key(byte[] val)
Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the holder's anchor output in a commitment transaction, if one is present.
-
get_revocation_base_key
public byte[] get_revocation_base_key()
Holder secret key for blinded revocation pubkey.
-
set_revocation_base_key
public void set_revocation_base_key(byte[] val)
Holder secret key for blinded revocation pubkey.
-
get_payment_key
public byte[] get_payment_key()
Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
-
set_payment_key
public void set_payment_key(byte[] val)
Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
-
get_delayed_payment_base_key
public byte[] get_delayed_payment_base_key()
Holder secret key used in an HTLC transaction.
-
set_delayed_payment_base_key
public void set_delayed_payment_base_key(byte[] val)
Holder secret key used in an HTLC transaction.
-
get_htlc_base_key
public byte[] get_htlc_base_key()
Holder HTLC secret key used in commitment transaction HTLC outputs.
-
set_htlc_base_key
public void set_htlc_base_key(byte[] val)
Holder HTLC secret key used in commitment transaction HTLC outputs.
-
get_commitment_seed
public byte[] get_commitment_seed()
Commitment seed.
-
set_commitment_seed
public void set_commitment_seed(byte[] val)
Commitment seed.
-
clone
public InMemorySigner clone()
Creates a copy of the InMemorySigner
-
of
public static InMemorySigner of(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id, byte[] rand_bytes_unique_start)
Creates a new [`InMemorySigner`].
-
counterparty_pubkeys
public ChannelPublicKeys counterparty_pubkeys()
Returns the counterparty's pubkeys. Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
-
counterparty_selected_contest_delay
public short counterparty_selected_contest_delay()
Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable transactions, i.e., the amount of time that we have to wait to recover our funds if we broadcast a transaction. Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
-
holder_selected_contest_delay
public short holder_selected_contest_delay()
Returns the `contest_delay` value specified by us and applied on transactions broadcastable by our counterparty, i.e., the amount of time that they have to wait to recover their funds if they broadcast a transaction. Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
-
is_outbound
public boolean is_outbound()
Returns whether the holder is the initiator. Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
-
funding_outpoint
public OutPoint funding_outpoint()
Funding outpoint Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
-
get_channel_parameters
public ChannelTransactionParameters get_channel_parameters()
Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or building transactions. Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
-
opt_anchors
public boolean opt_anchors()
Returns whether anchors should be used. Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
-
sign_counterparty_payment_input
public Result_CVec_CVec_u8ZZNoneZ sign_counterparty_payment_input(byte[] spend_tx, long input_idx, StaticPaymentOutputDescriptor descriptor)
Sign the single input of `spend_tx` at index `input_idx`, which spends the output described by `descriptor`, returning the witness stack for the input. Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, is not spending the outpoint described by [`descriptor.outpoint`], or if an output descriptor `script_pubkey` does not match the one we can spend. [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint
-
sign_dynamic_p2wsh_input
public Result_CVec_CVec_u8ZZNoneZ sign_dynamic_p2wsh_input(byte[] spend_tx, long input_idx, DelayedPaymentOutputDescriptor descriptor)
Sign the single input of `spend_tx` at index `input_idx` which spends the output described by `descriptor`, returning the witness stack for the input. Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, is not spending the outpoint described by [`descriptor.outpoint`], does not have a sequence set to [`descriptor.to_self_delay`], or if an output descriptor `script_pubkey` does not match the one we can spend. [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay
-
as_EntropySource
public EntropySource as_EntropySource()
Constructs a new EntropySource which calls the relevant methods on this_arg. This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
-
as_ChannelSigner
public ChannelSigner as_ChannelSigner()
Constructs a new ChannelSigner which calls the relevant methods on this_arg. This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is
-
as_EcdsaChannelSigner
public EcdsaChannelSigner as_EcdsaChannelSigner()
Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg. This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is
-
as_WriteableEcdsaChannelSigner
public WriteableEcdsaChannelSigner as_WriteableEcdsaChannelSigner()
Constructs a new WriteableEcdsaChannelSigner which calls the relevant methods on this_arg. This copies the `inner` pointer in this_arg and thus the returned WriteableEcdsaChannelSigner must be freed before this_arg is
-
write
public byte[] write()
Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
-
read
public static Result_InMemorySignerDecodeErrorZ read(byte[] ser, EntropySource arg)
Read a InMemorySigner from a byte array, created by InMemorySigner_write
-
-