Interface PayChannelObject

All Superinterfaces:
LedgerObject
All Known Implementing Classes:
ImmutablePayChannelObject

@Immutable public interface PayChannelObject extends LedgerObject
The PayChannel object type represents a payment channel. Payment channels enable small, rapid off-ledger payments of XRP that can be later reconciled with the consensus ledger. A payment channel holds a balance of XRP that can only be paid out to a specific destination address until the channel is closed. Any unspent XRP is returned to the channel's owner (the source address that created and funded it) when the channel closes.

The PaymentChannelCreate transaction type creates a PayChannel object. The PaymentChannelFund and PaymentChannelClaim transaction types modify existing PayChannel objects.

When a payment channel expires, at first it remains on the ledger, because only new transactions can modify ledger contents. Transaction processing automatically closes a payment channel when any transaction accesses it after the expiration. To close an expired channel and return the unspent XRP to the owner, some address must send a new PaymentChannelClaim or PaymentChannelFund transaction accessing the channel.

  • Method Details

    • builder

      Construct a builder for this class.
      Returns:
      An ImmutablePayChannelObject.Builder.
    • ledgerEntryType

      @Derived default LedgerObject.LedgerEntryType ledgerEntryType()
      The type of ledger object, which is always "PayChannel".
      Returns:
      Always LedgerObject.LedgerEntryType.PAY_CHANNEL.
    • flags

      @Derived default Flags flags()
      A bit-map of boolean flags enabled for this payment channel. Currently, the protocol defines no flags for PayChannel objects.
      Returns:
      Always Flags.UNSET.
    • account

      Address account()
      The source Address that owns this payment channel. This comes from the sending Address of the PaymentChannelCreate transaction that created the channel.
      Returns:
      The Address of the source account.
    • destination

      Address destination()
      The destination Address for this payment channel. While the payment channel is open, this Address is the only one that can receive XRP from the channel. This comes from the PaymentChannelCreate.destination() field of the transaction that created the channel.
      Returns:
      The Address of the destination account.
    • amount

      Total XRP, in drops, that has been allocated to this channel. This includes XRP that has been paid to the destination() address. This is initially set by the PaymentChannelCreate transaction that created the channel and can be increased if the source address sends a PaymentChannelFund transaction.
      Returns:
      An XrpCurrencyAmount representing the total amount allocated to this channel.
    • balance

      Total XRP, in drops, already paid out by the channel. The difference between this value and the amount() field is how much XRP can still be paid to the destination() address with PaymentChannelClaim transactions. If the channel closes, the remaining difference is returned to the account() address.
      Returns:
      An XrpCurrencyAmount representing the total amount paid out by this channel.
    • publicKey

      String publicKey()
      Public key, in hexadecimal, of the key pair that can be used to sign claims against this channel. This can be any valid secp256k1 or Ed25519 public key. This is set by the PaymentChannelCreate transaction that created the channel and must match the public key used in claims against the channel. The channel account() can also send XRP from this channel to the destination() without signed claims.
      Returns:
      A String containing the payment channel's public key.
    • settleDelay

      com.google.common.primitives.UnsignedLong settleDelay()
      Number of seconds the source address must wait to close the channel if it still has any XRP in it. Smaller values mean that the destination() has less time to redeem any outstanding claims after the source address requests to close the channel.
      Returns:
      An UnsignedLong representing the settlement delay.
    • ownerNode

      String ownerNode()
      A hint indicating which page of the source address's owner directory links to this object, in case the directory consists of multiple pages.
      Returns:
      A String containing the hint.
    • previousTransactionId

      Hash256 previousTransactionId()
      The identifying hash of the transaction that most recently modified this object.
      Returns:
      A Hash256 containing the previous transaction hash.
    • previousTransactionLedgerSequence

      com.google.common.primitives.UnsignedInteger previousTransactionLedgerSequence()
      The index of the ledger that contains the transaction that most recently modified this object.
      Returns:
      An UnsignedInteger representing the previous transaction ledger sequence.
    • expiration

      Optional<com.google.common.primitives.UnsignedLong> expiration()
      The mutable expiration time for this payment channel, in seconds since the Ripple Epoch. The channel is expired if this value is present and smaller than the previous LedgerHeader.closeTime() field.
      Returns:
      An Optional of type UnsignedLong representing the expiration time.
    • cancelAfter

      Optional<com.google.common.primitives.UnsignedLong> cancelAfter()
      The immutable expiration time for this payment channel, in seconds since the Ripple Epoch. This channel is expired if this value is present and smaller than the previous LedgerHeader.closeTime() field.
      Returns:
      An Optional of type UnsignedLong representing the cancel after time.
    • sourceTag

      Optional<com.google.common.primitives.UnsignedInteger> sourceTag()
      An arbitrary tag to further specify the account() for this payment channel, such as a hosted recipient at the owner's address.
      Returns:
      An Optional of type UnsignedInteger representing the tag of the source account.
    • destinationTag

      Optional<com.google.common.primitives.UnsignedInteger> destinationTag()
      An arbitrary tag to further specify the destination() for this payment channel, such as a hosted recipient at the destination address.
      Returns:
      An Optional of type UnsignedInteger representing the tag of the destination account.
    • index

      Hash256 index()
      Unique ID for this channel.
      Returns:
      A Hash256 containing the ID.