keys

package
v1.16.29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package keys provides key derivation and management utilities for LUX.

Index

Constants

View Source
const (
	// LUXCoinType is the BIP-44 coin type for LUX (9000')
	LUXCoinType = 9000

	// DefaultDerivationPath is the standard BIP-44 path for LUX: m/44'/9000'/0'/0/0
	DefaultDerivationPath = "m/44'/9000'/0'/0/0"
)

Variables

This section is empty.

Functions

func DeriveKeyFromMnemonic

func DeriveKeyFromMnemonic(mnemonic string, accountIndex uint32) ([]byte, error)

DeriveKeyFromMnemonic derives a private key from a BIP-39 mnemonic using BIP-44 path. Default path: m/44'/9000'/0'/0/0

func DeriveKeyFromSeed

func DeriveKeyFromSeed(seed []byte, accountIndex uint32) ([]byte, error)

DeriveKeyFromSeed derives a private key from a BIP-39 seed using BIP-44 path. Path: m/44'/9000'/0'/0/{accountIndex}

func LoadKey

func LoadKey(keyPath string) ([]byte, error)

LoadKey loads a key from file, environment, or returns an error. Priority: 1) keyPath if non-empty, 2) LUX_PRIVATE_KEY env, 3) LUX_MNEMONIC env

func LoadKeyFromEnv

func LoadKeyFromEnv() ([]byte, error)

LoadKeyFromEnv loads a key from environment variables. Priority: 1) LUX_PRIVATE_KEY (hex), 2) LUX_MNEMONIC (24 words)

func LoadKeyFromFile

func LoadKeyFromFile(path string) ([]byte, error)

LoadKeyFromFile reads a hex-encoded private key from a file.

func MustNewKeychain

func MustNewKeychain(keyBytes []byte) *secp256k1fx.Keychain

MustNewKeychain creates a secp256k1fx.Keychain from raw key bytes, panics on error.

func NewKeychain

func NewKeychain(keyBytes []byte) (*secp256k1fx.Keychain, error)

NewKeychain creates a secp256k1fx.Keychain from raw key bytes.

func ToPrivateKey

func ToPrivateKey(keyBytes []byte) (*secp256k1.PrivateKey, error)

ToPrivateKey converts raw key bytes to a secp256k1 private key.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL