MnemonicConstants

Constants for BIP-39 mnemonic generation, BIP-32/SLIP-0010 key derivation, and SEP-5 Stellar key derivation.

This object contains all numeric constants required for implementing:

  • BIP-39: Mnemonic code for generating deterministic keys (https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki)

  • BIP-32: Hierarchical Deterministic Wallets (https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)

  • SLIP-0010: Universal private key derivation from master private key (https://github.com/satoshilabs/slips/blob/master/slip-0010.md)

  • SLIP-0044: Registered coin types for BIP-0044 (https://github.com/satoshilabs/slips/blob/master/slip-0044.md)

  • SEP-5: Key Derivation Methods for Stellar Keys (https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0005.md)

These constants ensure interoperability with other BIP-39/BIP-32 compliant wallets and are critical for deterministic key generation and recovery.

Properties

Link copied to clipboard
const val BIP32_HARDENED_OFFSET: Long = 2147483648

Offset for hardened child key derivation (2^31).

Link copied to clipboard
const val BIP44_PURPOSE: Int = 44

BIP-44 purpose field.

Link copied to clipboard
const val BITS_PER_WORD: Int = 11

Number of bits encoded by each word in the mnemonic.

Link copied to clipboard
const val CHAIN_CODE_BYTES: Int = 32

Size of chain code in bytes.

Link copied to clipboard

Number of entropy bits per checksum bit.

Link copied to clipboard
const val DERIVED_KEY_BYTES: Int = 32

Size of derived Ed25519 private keys in bytes.

Link copied to clipboard

HMAC key for master key generation.

Link copied to clipboard
const val ENTROPY_BITS_12_WORDS: Int = 128

Entropy bits for 12-word mnemonics.

Link copied to clipboard
const val ENTROPY_BITS_15_WORDS: Int = 160

Entropy bits for 15-word mnemonics.

Link copied to clipboard
const val ENTROPY_BITS_18_WORDS: Int = 192

Entropy bits for 18-word mnemonics.

Link copied to clipboard
const val ENTROPY_BITS_21_WORDS: Int = 224

Entropy bits for 21-word mnemonics.

Link copied to clipboard
const val ENTROPY_BITS_24_WORDS: Int = 256

Entropy bits for 24-word mnemonics.

Link copied to clipboard
const val ENTROPY_MULTIPLE_BITS: Int = 32

Entropy must be a multiple of 32 bits.

Link copied to clipboard

Entropy must be a multiple of 4 bytes (32 bits).

Link copied to clipboard

Length of data input for HMAC in child key derivation.

Link copied to clipboard
const val MAX_ENTROPY_BYTES: Int = 32

Maximum entropy size in bytes (256 bits = 32 bytes).

Link copied to clipboard
const val MIN_ENTROPY_BYTES: Int = 16

Minimum entropy size in bytes (128 bits = 16 bytes).

Link copied to clipboard
const val MNEMONIC_DIVIDER_RATIO: Int = 33

Ratio used to calculate the divider index between entropy and checksum bits.

Link copied to clipboard
const val PBKDF2_BLOCK_LENGTH: Int = 128

Block length for SHA-512 in bytes.

Link copied to clipboard
const val PBKDF2_ITERATIONS: Int = 2048

Number of PBKDF2 iterations specified by BIP-39.

Link copied to clipboard
const val PBKDF2_KEY_LENGTH: Int = 64

Output key length in bytes for PBKDF2 (512 bits = 64 bytes).

Link copied to clipboard

Salt prefix for PBKDF2 mnemonic-to-seed conversion.

Link copied to clipboard
const val RANDOM_BYTE_MAX_VALUE: Int = 256

Exclusive upper bound for random byte values.

Link copied to clipboard
const val STELLAR_COIN_TYPE: Int = 148

Stellar's registered coin type in SLIP-0044.

Link copied to clipboard
const val WORD_LIST_SIZE: Int = 2048

Size of the BIP-39 word list.