byron

package
v0.0.0-...-bcfac5e Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XPubSize              = 64
	ByronPubKeyTag uint64 = 0
	ByronTag       uint64 = 24
	Hash28Size            = 28
)
View Source
const (
	// HMAC message format
	HMAC_MESSAGE_FORMAT            = "Root Seed Chain %d"
	TWEAK_BIT1              uint8  = 0x07
	TWEAK_BIT2              uint8  = 0x80
	INDEF_LEN_ARRAY_START   byte   = 0x9F
	INDEF_LEN_ARRAY_END     byte   = 0xFF
	HD_PATH_KEY_PBKDF2_SALT string = "address-hashing"
	//PBKDF2 rounds used for deriving the HD path key
	HD_PATH_KEY_PBKDF2_ROUNDS int = 500
	//PBKDF2 output byte length used for deriving the HD path key
	HD_PATH_KEY_PBKDF2_OUT_BYTE_LEN int = 32
)

Variables

View Source
var (
	ErrInvalidByronAddress  = errors.New("invalid byron address")
	ErrInvalidByronChecksum = errors.New("invalid byron checksum")
)
View Source
var (
	// ChaCha20-Poly1305 associated data for HD path decryption/encryption
	CHACHA20_POLY1305_ASSOC_DATA []byte = []byte("")
	// ChaCha20-Poly1305 nonce for HD path decryption/encryption
	CHACHA20_POLY1305_NONCE []byte = []byte("serokellfore")
)

Functions

func ByronLegacyFromSeed

func ByronLegacyFromSeed(entropy []byte) (crypto.XPrvKey, error)

func CborIndefiniteLenArrayEncoder

func CborIndefiniteLenArrayEncoder(path []uint32) ([]byte, error)

func ChaCha20Poly1305EncodePath

func ChaCha20Poly1305EncodePath(hdPath []byte, path []uint32) ([]byte, error)

func HashRepeatedly

func HashRepeatedly(key []byte, itrNum int) ([]byte, []byte)

func HdPathKey

func HdPathKey(rootXpub []byte) []byte

root xpub contians public & chaincode

func TweakMasterKeyBits

func TweakMasterKeyBits(key []byte) []byte

Types

type ByronAddress

type ByronAddress struct {
	Hash       []byte
	Attributes ByronAddressAttributes
	Tag        uint64
}

func NewSimpleLegacyAddress

func NewSimpleLegacyAddress(xpub []byte, hdPath []byte) (*ByronAddress, error)

func (*ByronAddress) Bech32

func (b *ByronAddress) Bech32() string

func (*ByronAddress) Bytes

func (b *ByronAddress) Bytes() (bytes []byte)

Bytes returns byte slice represantation of the Address.

func (*ByronAddress) MarshalCBOR

func (a *ByronAddress) MarshalCBOR() ([]byte, error)

func (*ByronAddress) NetworkInfo

func (b *ByronAddress) NetworkInfo() byte

NetworkInfo returns NetworkInfo{ProtocolMagigic and NetworkId}.

func (*ByronAddress) Prefix

func (b *ByronAddress) Prefix() string

Pref returns the string prefix for the base address. "" for byron address since it has no prefix.

func (*ByronAddress) String

func (b *ByronAddress) String() (str string)

String returns base58 encoded byron address.

func (*ByronAddress) UnmarshalCBOR

func (a *ByronAddress) UnmarshalCBOR(data []byte) error

type ByronAddressAttributes

type ByronAddressAttributes struct {
	Payload []byte  `cbor:"1,keyasint,omitempty"`
	Network *uint32 `cbor:"2,keyasint,omitempty"`
}

func (ByronAddressAttributes) MarshalCBOR

func (a ByronAddressAttributes) MarshalCBOR() ([]byte, error)

func (*ByronAddressAttributes) UnmarshalCBOR

func (a *ByronAddressAttributes) UnmarshalCBOR(data []byte) error

Jump to

Keyboard shortcuts

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