Class InMemorySigner


  • public class InMemorySigner
    extends Object
    A simple implementation of Sign 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()
        Private key of anchor tx
      • set_funding_key

        public void set_funding_key​(byte[] val)
        Private key of anchor tx
      • 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 HTLC tx
      • set_delayed_payment_base_key

        public void set_delayed_payment_base_key​(byte[] val)
        Holder secret key used in HTLC tx
      • get_htlc_base_key

        public byte[] get_htlc_base_key()
        Holder htlc secret key used in commitment tx htlc outputs
      • set_htlc_base_key

        public void set_htlc_base_key​(byte[] val)
        Holder htlc secret key used in commitment tx 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)
        Create a new InMemorySigner
      • counterparty_pubkeys

        public ChannelPublicKeys counterparty_pubkeys()
        Counterparty pubkeys. Will panic if ready_channel wasn't called.
      • counterparty_selected_contest_delay

        public short counterparty_selected_contest_delay()
        The contest_delay value specified by our counterparty and applied on holder-broadcastable transactions, ie the amount of time that we have to wait to recover our funds if we broadcast a transaction. Will panic if ready_channel wasn't called.
      • holder_selected_contest_delay

        public short holder_selected_contest_delay()
        The contest_delay value specified by us and applied on transactions broadcastable by our counterparty, ie the amount of time that they have to wait to recover their funds if they broadcast a transaction. Will panic if ready_channel wasn't called.
      • is_outbound

        public boolean is_outbound()
        Whether the holder is the initiator Will panic if ready_channel wasn't called.
      • funding_outpoint

        public OutPoint funding_outpoint()
        Funding outpoint Will panic if ready_channel wasn't called.
      • get_channel_parameters

        public ChannelTransactionParameters get_channel_parameters()
        Obtain a ChannelTransactionParameters for this channel, to be used when verifying or building transactions. Will panic if ready_channel wasn't called.
      • 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 Err if the input at input_idx does not exist, has a non-empty script_sig, or is not spending the outpoint described by `descriptor.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 Err 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 does not have a sequence set to `descriptor.to_self_delay`.
      • as_BaseSign

        public BaseSign as_BaseSign()
        Constructs a new BaseSign which calls the relevant methods on this_arg. This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
      • as_Sign

        public Sign as_Sign()
        Constructs a new Sign which calls the relevant methods on this_arg. This copies the `inner` pointer in this_arg and thus the returned Sign 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