StellarConstants
in package
Stellar Protocol Constants
This class contains fundamental constants defined by the Stellar protocol. These values are specified in the protocol documentation and should not be changed unless the protocol itself changes.
References:
- Stellar Protocol: https://github.com/stellar/stellar-protocol
- Stellar Developers: https://developers.stellar.org
- CAP specifications: https://github.com/stellar/stellar-protocol/tree/master/core
Note: This class cannot be instantiated. All constants are static and should be accessed directly via the class name.
Table of Contents
Constants
- ASSET_CODE_ALPHANUMERIC_12_MAX_LENGTH = 12
- Maximum length for AlphaNum12 asset codes.
- ASSET_CODE_ALPHANUMERIC_12_MIN_LENGTH = 5
- Minimum length for AlphaNum12 asset codes.
- ASSET_CODE_ALPHANUMERIC_4_MAX_LENGTH = 4
- Maximum length for AlphaNum4 asset codes.
- ASSET_CODE_MIN_LENGTH = 1
- Minimum length for any asset code.
- CLAIMABLE_BALANCE_DECODED_LENGTH = 33
- Length of decoded data for claimable balance IDs.
- DEFAULT_LEDGER_EXPIRATION_OFFSET = 100
- Default ledger expiration offset for Soroban transactions.
- ED25519_PUBLIC_KEY_LENGTH_BYTES = 32
- Length of an Ed25519 public key in bytes.
- HOME_DOMAIN_MAX_LENGTH = 32
- Maximum length for an account's home domain string.
- MAX_OPERATIONS_PER_TRANSACTION = 100
- Maximum number of operations allowed in a single transaction.
- MEMO_HASH_LENGTH = 32
- Length of a hash/return hash memo in bytes.
- MEMO_TEXT_MAX_LENGTH = 28
- Maximum length for a text memo in bytes.
- MIN_BASE_FEE_STROOPS = 100
- Minimum base fee for a transaction in stroops.
- MUXED_ACCOUNT_DECODED_LENGTH = 40
- Length of decoded muxed account data in bytes.
- SIGNED_PAYLOAD_MAX_LENGTH_BYTES = 64
- Maximum length of a signed payload in bytes.
- SIGNED_PAYLOAD_MIN_LENGTH_BYTES = 4
- Minimum length of a signed payload in bytes.
- SIGNER_WEIGHT_MASK = 0xff
- Bitmask for extracting valid threshold/weight values.
- STROOP_SCALE = 10000000
- Stroop scale factor for converting between XLM and stroops.
- THRESHOLD_MAX = 255
- Maximum value for account thresholds and signer weights.
- THRESHOLD_MIN = 0
- Minimum value for account thresholds and signer weights.
Constants
ASSET_CODE_ALPHANUMERIC_12_MAX_LENGTH
Maximum length for AlphaNum12 asset codes.
public
mixed
ASSET_CODE_ALPHANUMERIC_12_MAX_LENGTH
= 12
AlphaNum12 assets can have codes from 5 to 12 characters. This is the maximum length allowed by the protocol.
Example: LONGASSET12, STELLARCOIN
ASSET_CODE_ALPHANUMERIC_12_MIN_LENGTH
Minimum length for AlphaNum12 asset codes.
public
mixed
ASSET_CODE_ALPHANUMERIC_12_MIN_LENGTH
= 5
AlphaNum12 assets must have codes from 5 to 12 characters. Any asset code longer than 4 characters uses AlphaNum12 encoding.
Example: USDC, EURT, MOBI
ASSET_CODE_ALPHANUMERIC_4_MAX_LENGTH
Maximum length for AlphaNum4 asset codes.
public
mixed
ASSET_CODE_ALPHANUMERIC_4_MAX_LENGTH
= 4
AlphaNum4 assets can have codes from 1 to 4 characters. Common examples include USD, BTC, EUR, XLM.
Example: USD, BTC, EUR
ASSET_CODE_MIN_LENGTH
Minimum length for any asset code.
public
mixed
ASSET_CODE_MIN_LENGTH
= 1
Asset codes must be at least 1 character long. Shorter codes are not valid in the Stellar protocol.
CLAIMABLE_BALANCE_DECODED_LENGTH
Length of decoded data for claimable balance IDs.
public
mixed
CLAIMABLE_BALANCE_DECODED_LENGTH
= 33
Claimable balance IDs consist of a 1-byte discriminant followed by a 32-byte balance ID hash, for a total of 33 bytes when decoded.
Unit: bytes
Reference: CAP-0023 (Claimable Balances)
Tags
DEFAULT_LEDGER_EXPIRATION_OFFSET
Default ledger expiration offset for Soroban transactions.
public
mixed
DEFAULT_LEDGER_EXPIRATION_OFFSET
= 100
When setting ledger bounds for Soroban transactions, this offset is added to the current ledger sequence to determine expiration.
Default: current sequence + 100 blocks (approximately 8.3 minutes)
- Average ledger close time: ~5 seconds
- 100 ledgers ≈ 8.3 minutes
Unit: ledger blocks
Note: This provides a reasonable validity window for contract invocations while preventing stale transactions.
Reference: Soroban documentation - State archival
Tags
ED25519_PUBLIC_KEY_LENGTH_BYTES
Length of an Ed25519 public key in bytes.
public
mixed
ED25519_PUBLIC_KEY_LENGTH_BYTES
= 32
Ed25519 public keys are always 32 bytes (256 bits) as defined by the cryptographic specification. This is the standard size for Stellar account public keys.
Tags
HOME_DOMAIN_MAX_LENGTH
Maximum length for an account's home domain string.
public
mixed
HOME_DOMAIN_MAX_LENGTH
= 32
The home domain is used for federation and stellar.toml file hosting. It can be up to 32 characters and must be a valid domain name. This corresponds to the XDR string32 type.
Reference: XDR type string32 and federation specification
Tags
MAX_OPERATIONS_PER_TRANSACTION
Maximum number of operations allowed in a single transaction.
public
mixed
MAX_OPERATIONS_PER_TRANSACTION
= 100
Stellar protocol limits transactions to 100 operations maximum. This ensures transactions remain within reasonable size limits and can be processed efficiently by validators.
Unit: count (number of operations)
Note: The total transaction fee is calculated as: total_fee = base_fee × number_of_operations
Reference: Stellar Protocol - Transaction specification
Tags
MEMO_HASH_LENGTH
Length of a hash/return hash memo in bytes.
public
mixed
MEMO_HASH_LENGTH
= 32
Hash and return hash memos must be exactly 32 bytes. These are typically SHA256 hashes used to reference external transaction data or payment identifiers.
Unit: bytes
MEMO_TEXT_MAX_LENGTH
Maximum length for a text memo in bytes.
public
mixed
MEMO_TEXT_MAX_LENGTH
= 28
Text memos can contain up to 28 bytes of UTF-8 encoded text. This is smaller than the hash memo to leave room for the XDR discriminant in the encoded transaction.
Unit: bytes (UTF-8 encoded)
Reference: XDR Memo specification
MIN_BASE_FEE_STROOPS
Minimum base fee for a transaction in stroops.
public
mixed
MIN_BASE_FEE_STROOPS
= 100
The base fee is the minimum fee per operation in a transaction. 1 stroop = 0.0000001 XLM, so 100 stroops = 0.00001 XLM. The total transaction fee is: base_fee × number_of_operations.
Unit: stroops (1 stroop = 10^-7 XLM)
Note: During network congestion, higher fees may be required for transaction inclusion.
Tags
MUXED_ACCOUNT_DECODED_LENGTH
Length of decoded muxed account data in bytes.
public
mixed
MUXED_ACCOUNT_DECODED_LENGTH
= 40
Consists of Ed25519 public key (32 bytes) + muxed ID (8 bytes) = 40 bytes total. This is the size of the decoded payload for a muxed account address.
Reference: CAP-0027 (Muxed Accounts)
Tags
SIGNED_PAYLOAD_MAX_LENGTH_BYTES
Maximum length of a signed payload in bytes.
public
mixed
SIGNED_PAYLOAD_MAX_LENGTH_BYTES
= 64
Signed payloads can contain up to 64 bytes of arbitrary data. This allows for attaching small amounts of metadata to signatures, useful for per-signature authorization data in smart contracts.
Unit: bytes
Reference: CAP-0040
Tags
SIGNED_PAYLOAD_MIN_LENGTH_BYTES
Minimum length of a signed payload in bytes.
public
mixed
SIGNED_PAYLOAD_MIN_LENGTH_BYTES
= 4
Signed payloads must contain at least 4 bytes of data to be valid. This ensures there is meaningful data being signed.
Unit: bytes
SIGNER_WEIGHT_MASK
Bitmask for extracting valid threshold/weight values.
public
mixed
SIGNER_WEIGHT_MASK
= 0xff
Used to ensure weight values are within the valid range [0-255] by masking to the lower 8 bits. This corresponds to a single byte.
Binary: 0b11111111 Hexadecimal: 0xFF Decimal: 255
STROOP_SCALE
Stroop scale factor for converting between XLM and stroops.
public
mixed
STROOP_SCALE
= 10000000
1 XLM = 10,000,000 stroops (10 million) This is the fundamental unit conversion in Stellar. Stroops are the smallest unit of XLM, similar to satoshis in Bitcoin.
Unit: stroops per XLM
Example:
- 1 XLM = 10,000,000 stroops
- 0.1 XLM = 1,000,000 stroops
- 100 stroops = 0.00001 XLM (minimum base fee)
Tags
THRESHOLD_MAX
Maximum value for account thresholds and signer weights.
public
mixed
THRESHOLD_MAX
= 255
Thresholds and weights can be at most 255. This is the maximum value that can be stored in a single byte (uint8).
Unit: weight (dimensionless)
THRESHOLD_MIN
Minimum value for account thresholds and signer weights.
public
mixed
THRESHOLD_MIN
= 0
Thresholds and weights must be at least 0 (disabled/no weight). A threshold of 0 means the operation can be performed without any signatures.
Unit: weight (dimensionless)