StellarProtocolConstants
public struct StellarProtocolConstants : Sendable
Constants defined by the Stellar protocol specification. These values represent core protocol limits, sizes, and validation constraints used throughout the Stellar network.
Reference: Stellar developer docs
-
Size of an Ed25519 public key in bytes (32 bytes) Reference: https://ed25519.cr.yp.to/
Declaration
Swift
public static let ED25519_PUBLIC_KEY_SIZE: Int -
Size of an Ed25519 seed in bytes (32 bytes) Reference: https://ed25519.cr.yp.to/
Declaration
Swift
public static let ED25519_SEED_SIZE: Int -
Size of an Ed25519 private key in bytes (64 bytes) Reference: https://ed25519.cr.yp.to/
Declaration
Swift
public static let ED25519_PRIVATE_KEY_SIZE: Int -
Size of an Ed25519 signature in bytes (64 bytes) Reference: https://ed25519.cr.yp.to/
Declaration
Swift
public static let ED25519_SIGNATURE_SIZE: Int
-
Size of SHA-256 hash in bytes (32 bytes) Reference: https://en.wikipedia.org/wiki/SHA-2
Declaration
Swift
public static let SHA256_HASH_SIZE: Int
-
Size of the version byte in StrKey encoding (1 byte) Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_VERSION_BYTE_SIZE: Int -
Size of the CRC-16 checksum in StrKey encoding (2 bytes) Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_CHECKSUM_SIZE: Int -
Total overhead size in StrKey encoding (version byte + checksum = 3 bytes) Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_OVERHEAD_SIZE: Int
-
Standard StrKey encoded string length for ed25519PublicKey, ed25519SecretSeed, preAuthTX, sha256Hash, contract, and liquidityPool (56 characters) Calculation: (1 version + 32 data + 2 checksum) bytes × 8 bits ÷ 5 bits/char = 56 chars Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_ENCODED_LENGTH_STANDARD: Int -
StrKey encoded string length for muxed account (med25519PublicKey) (69 characters) Calculation: (1 version + 40 data + 2 checksum) bytes × 8 bits ÷ 5 bits/char = 69 chars Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_ENCODED_LENGTH_MUXED: Int -
StrKey encoded string length for claimable balance (58 characters) Calculation: (1 version + 33 data + 2 checksum) bytes × 8 bits ÷ 5 bits/char = 58 chars Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_ENCODED_LENGTH_CLAIMABLE_BALANCE: Int -
Minimum StrKey encoded string length for signed payload (69 characters) This is the minimum because signed payloads encode:
- 32 bytes for the signer public key
- 4 bytes for the payload length field
- 4 bytes minimum payload Total: (1 version + 40 data + 2 checksum) bytes × 8 bits ÷ 5 bits/char = 69 chars
Note: This fixes an issue found in the Flutter SDK where it was incorrectly set to 56. Reference: CAP-40 https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md See also: https://github.com/Soneso/stellar_flutter_sdk/pull/116
Declaration
Swift
public static let STRKEY_SIGNED_PAYLOAD_MIN_LENGTH: Int -
Maximum StrKey encoded string length for signed payload (165 characters) Maximum payload size is 64 bytes, so: Total: (1 version + 32 key + 4 length + 64 payload + 2 checksum) bytes × 8 bits ÷ 5 bits/char = 165 chars Reference: CAP-40 https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md
Declaration
Swift
public static let STRKEY_ENCODED_LENGTH_SIGNED_PAYLOAD_MAX: Int
-
Standard decoded payload size for StrKey types (32 bytes) Used for: ed25519PublicKey, ed25519SecretSeed, preAuthTX, sha256Hash, contract, liquidityPool Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_DECODED_SIZE_STANDARD: Int -
Decoded payload size for muxed account (40 bytes = 32 bytes key + 8 bytes ID) Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_DECODED_SIZE_MUXED: Int -
Size of the muxed account ID field (8 bytes) Reference: Stellar developer docs
Declaration
Swift
public static let MUXED_ACCOUNT_ID_SIZE: Int -
Size of the signer public key in a signed payload (32 bytes) Reference: CAP-40 https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md
Declaration
Swift
public static let SIGNED_PAYLOAD_SIGNER_SIZE: Int -
Size of the payload length field in a signed payload (4 bytes) Reference: CAP-40 https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md
Declaration
Swift
public static let SIGNED_PAYLOAD_SIZE_FIELD: Int -
Minimum payload size in a signed payload (4 bytes) Reference: CAP-40 https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md
Declaration
Swift
public static let SIGNED_PAYLOAD_MIN_PAYLOAD: Int -
Maximum payload size in a signed payload (64 bytes) Reference: CAP-40 https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md
Declaration
Swift
public static let SIGNED_PAYLOAD_MAX_PAYLOAD: Int -
Size of the claimable balance type discriminant (1 byte) Reference: Stellar developer docs
Declaration
Swift
public static let CLAIMABLE_BALANCE_DISCRIMINANT_SIZE: Int
-
Bit shift amount used in version byte encoding (3 bits) The base value is shifted left by 3 to produce the final version byte Reference: Stellar developer docs
Declaration
Swift
public static let VERSION_BYTE_SHIFT: Int -
Base value for ed25519 public key version byte (6, shifted becomes 48) Results in ‘G’ prefix when encoded in Base32 Reference: Stellar developer docs
Declaration
Swift
public static let ED25519_PUBLIC_KEY_BASE: Int -
Base value for muxed ed25519 public key version byte (12, shifted becomes 96) Results in ‘M’ prefix when encoded in Base32 Reference: Stellar developer docs
Declaration
Swift
public static let MED25519_PUBLIC_KEY_BASE: Int -
Base value for ed25519 secret seed version byte (18, shifted becomes 144) Results in ‘S’ prefix when encoded in Base32 Reference: Stellar developer docs
Declaration
Swift
public static let ED25519_SECRET_SEED_BASE: Int -
Base value for pre-authorized transaction version byte (19, shifted becomes 152) Results in ‘T’ prefix when encoded in Base32 Reference: Stellar developer docs
Declaration
Swift
public static let PREAUTH_TX_BASE: Int -
Base value for SHA-256 hash version byte (23, shifted becomes 184) Results in ‘X’ prefix when encoded in Base32 Reference: Stellar developer docs
Declaration
Swift
public static let SHA256_HASH_BASE: Int -
Base value for signed payload version byte (15, shifted becomes 120) Results in ‘P’ prefix when encoded in Base32 Reference: CAP-40 https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md
Declaration
Swift
public static let SIGNED_PAYLOAD_BASE: Int -
Base value for contract version byte (2, shifted becomes 16) Results in ‘C’ prefix when encoded in Base32 Reference: Stellar developer docs
Declaration
Swift
public static let CONTRACT_BASE: Int -
Base value for liquidity pool version byte (11, shifted becomes 88) Results in ‘L’ prefix when encoded in Base32 Reference: Stellar developer docs
Declaration
Swift
public static let LIQUIDITY_POOL_BASE: Int -
Base value for claimable balance version byte (1, shifted becomes 8) Results in ‘B’ prefix when encoded in Base32 Reference: Stellar developer docs
Declaration
Swift
public static let CLAIMABLE_BALANCE_BASE: Int
-
Minimum asset code length (1 character) Reference: Stellar developer docs
Declaration
Swift
public static let ASSET_CODE_MIN_LENGTH: Int -
Maximum asset code length for AlphaNum4 assets (4 characters) Reference: Stellar developer docs
Declaration
Swift
public static let ASSET_CODE_ALPHANUM4_MAX_LENGTH: Int -
Minimum asset code length for AlphaNum12 assets (5 characters) Reference: Stellar developer docs
Declaration
Swift
public static let ASSET_CODE_ALPHANUM12_MIN_LENGTH: Int -
Maximum asset code length for AlphaNum12 assets (12 characters) Reference: Stellar developer docs
Declaration
Swift
public static let ASSET_CODE_ALPHANUM12_MAX_LENGTH: Int
-
Canonical form identifier for the native asset (XLM) Reference: Stellar developer docs
Declaration
Swift
public static let ASSET_CANONICAL_NATIVE: String
-
Maximum length for MEMO_TEXT in bytes (28 bytes) Reference: Stellar developer docs
Declaration
Swift
public static let MEMO_TEXT_MAX_LENGTH: Int -
Size of MEMO_HASH in bytes (32 bytes) Reference: Stellar developer docs
Declaration
Swift
public static let MEMO_HASH_SIZE: Int -
Size of MEMO_RETURN_HASH in bytes (32 bytes) Reference: Stellar developer docs
Declaration
Swift
public static let MEMO_RETURN_HASH_SIZE: Int
-
Maximum number of operations allowed in a single transaction (100 operations) Reference: Stellar developer docs
Declaration
Swift
public static let MAX_OPERATIONS_PER_TRANSACTION: Int -
Maximum length for account home domain (32 characters) Reference: Stellar developer docs
Declaration
Swift
public static let HOME_DOMAIN_MAX_LENGTH: Int
-
Minimum base fee for a transaction in stroops (100 stroops = 0.00001 XLM) Reference: Stellar developer docs
Declaration
Swift
public static let MIN_BASE_FEE: UInt32
-
Maximum length for signed payload data (64 bytes) Reference: CAP-40 https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md
Declaration
Swift
public static let SIGNED_PAYLOAD_MAX_LENGTH: Int
-
Size of the signature hint (last 4 bytes of the public key or payload) Reference: Stellar developer docs
Declaration
Swift
public static let SIGNATURE_HINT_SIZE: Int
-
Maximum length for data entry name in ManageData operation (64 bytes) Reference: Stellar developer docs
Declaration
Swift
public static let MANAGE_DATA_NAME_MAX_LENGTH: Int -
Maximum length for data entry value in ManageData operation (64 bytes) Reference: Stellar developer docs
Declaration
Swift
public static let MANAGE_DATA_VALUE_MAX_LENGTH: Int
-
Minimum value for account thresholds (0) Reference: Stellar developer docs
Declaration
Swift
public static let THRESHOLD_MIN: UInt32 -
Maximum value for account thresholds (255) Reference: Stellar developer docs
Declaration
Swift
public static let THRESHOLD_MAX: UInt32 -
Byte mask for signer weight (0xFF = 255) Ensures signer weight is in the valid range (0-255) Reference: Stellar developer docs
Declaration
Swift
public static let SIGNER_WEIGHT_MASK: UInt32
-
Size of a claimable balance ID (32 bytes) Reference: Stellar developer docs
Declaration
Swift
public static let CLAIMABLE_BALANCE_ID_SIZE: Int
-
Liquidity pool fee in basis points for protocol version 18+ (30 basis points = 0.30%) Reference: Stellar developer docs
Declaration
Swift
public static let LIQUIDITY_POOL_FEE_V18: Int32
-
StrKey prefix for account addresses (public keys) Encoded addresses start with ‘G’ Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_PREFIX_ACCOUNT: String -
StrKey prefix for secret seeds Encoded seeds start with ‘S’ Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_PREFIX_SEED: String -
StrKey prefix for muxed accounts Encoded muxed accounts start with ‘M’ Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_PREFIX_MUXED: String -
StrKey prefix for pre-authorized transactions Encoded pre-auth TX start with ‘T’ Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_PREFIX_PREAUTH_TX: String -
StrKey prefix for hash-x signers Encoded hash-x start with ‘X’ Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_PREFIX_HASH_X: String -
StrKey prefix for signed payload signers Encoded signed payloads start with ‘P’ Reference: CAP-40 https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md
Declaration
Swift
public static let STRKEY_PREFIX_SIGNED_PAYLOAD: String -
StrKey prefix for contract addresses Encoded contracts start with ‘C’ Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_PREFIX_CONTRACT: String -
StrKey prefix for liquidity pool IDs Encoded liquidity pools start with ‘L’ Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_PREFIX_LIQUIDITY_POOL: String -
StrKey prefix for claimable balance IDs Encoded claimable balances start with ‘B’ Reference: Stellar developer docs
Declaration
Swift
public static let STRKEY_PREFIX_CLAIMABLE_BALANCE: String
View on GitHub
Install in Dash