Class 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 Detail

      • 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.
      • 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