Class MuxedAccount

java.lang.Object
org.stellar.sdk.MuxedAccount

public class MuxedAccount extends Object
Represents a multiplexed account on Stellar's network.

A muxed account is an extension of the regular account that allows multiple entities to share the same ed25519 key pair as their account ID while providing a unique identifier for each entity.

A muxed account consists of two parts:

  • The ed25519 account ID, which starts with the letter "G".
  • An optional account multiplexing ID, which is a 64-bit unsigned integer.
See Also:
  • Constructor Details

    • MuxedAccount

      public MuxedAccount(@NonNull @NonNull String accountId, @Nullable BigInteger muxedId)
      Creates a new muxed account from the given ed25519 account ID and optional multiplexing ID.
      Parameters:
      accountId - The ed25519 account ID. It must be a valid account ID starting with "G".
      muxedId - The optional account multiplexing ID. It can be null if not set.
      Throws:
      IllegalArgumentException - If the provided account ID is invalid.
    • MuxedAccount

      public MuxedAccount(@NonNull @NonNull String address)
      Creates a new muxed account from the given muxed account address.
      Parameters:
      address - The muxed account address. It can be either a regular account ID (starting with "G") or a muxed account address (starting with "M").
      Throws:
      IllegalArgumentException - If the provided address is invalid.
  • Method Details

    • getAddress

      public String getAddress()
      Returns the account address representation of this muxed account.
      Returns:
      The account address. It starts with "M" if the multiplexing ID is set, or with "G" if the multiplexing ID is not set.
    • fromXdr

      public static MuxedAccount fromXdr(MuxedAccount xdr)
      Creates a new muxed account from the given XDR representation.
      Parameters:
      xdr - The XDR representation of the muxed account.
      Returns:
      A new muxed account instance.
      Throws:
      IllegalArgumentException - If the provided XDR is invalid.
    • toXdr

      public MuxedAccount toXdr()
      Returns the XDR representation of this muxed account.
      Returns:
      The XDR representation of the muxed account.
    • getAccountId

      @NonNull public @NonNull String getAccountId()
      The ed25519 account ID. It starts with the letter "G".
    • getMuxedId

      @Nullable public BigInteger getMuxedId()
      The optional account multiplexing ID. It is a 64-bit unsigned integer.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object