wallet

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: BSD-2-Clause Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const EntropySize = 32
View Source
const MnemonicWords = 24

Variables

Functions

func DeriveMultisigAddress added in v0.2.1

func DeriveMultisigAddress(signatories []string, threshold uint16) (string, error)

Derive a Multisig address from signatories addresses and threshold MSigAddress = BLAKE2B_256("modlpy/utilisuba" || signatories.length << 2 || sorted_signatories || threshold)

func TestnetAddressFromMnemonic added in v0.2.1

func TestnetAddressFromMnemonic(mnemonic string) string

func ValidateTestnetAddress added in v0.2.1

func ValidateTestnetAddress(address string) (bool, error)

func ValidateXXNetworkAddress added in v0.2.0

func ValidateXXNetworkAddress(address string) (bool, error)

func XXNetworkAddressFromMnemonic

func XXNetworkAddressFromMnemonic(mnemonic string) string

Types

type GenSpec added in v0.2.0

type GenSpec struct {
	// contains filtered or unexported fields
}

Generation spec for a Sleeve wallet Account and WOTS+ params can be specified

func DefaultGenSpec added in v0.2.0

func DefaultGenSpec() GenSpec

func NewGenSpec added in v0.2.1

func NewGenSpec(account uint32, params wots.ParamsEncoding) GenSpec

func (GenSpec) PathFromSpec added in v0.2.0

func (g GenSpec) PathFromSpec() (Path, error)

type Node

type Node struct {
	Key  []byte
	Code []byte
}

func ComputeNode

func ComputeNode(seed []byte, path Path) (*Node, error)

Compute BIP32 node from seed and path

func NewMasterNode

func NewMasterNode(seed []byte) (*Node, error)

Derive the master node from a seed

func (*Node) ComputeHardenedChild

func (n *Node) ComputeHardenedChild(idx uint32) error

Compute the hardened child node with given index Place child Key and Code directly in Node (mutate) Only hard derivations allowed, so idx must be >= 2^31

type Path

type Path []uint32

func NewPath

func NewPath(account, params, nonce uint32) (Path, error)

Create path from given account, params and nonce

func (Path) String added in v0.2.0

func (p Path) String() string

type Sleeve

type Sleeve struct {
	// contains filtered or unexported fields
}

///////////////////////////////////////////////////////////////////// SLEEVE WALLET

Sleeve is a novel way of embedding a quantum secure key in the
generation of curve based, non quantum secure keys
Find out more about Sleeve at: xx.network/sleeve

A complete diagram of the Sleeve wallet generation can be found
in the docs folder. This implementation of Sleeve uses a WOTS+
key as the underlying quantum secure key, and the diagram for
the generation of this key can also be found in the docs folder.

Essentially, the input for wallet generation is random entropy,
which is encoded into a mnemonic phrase using BIP39. Then a BIP44
custom path of m/44'/1955'/0'/0'/0' is used in a BIP32 derivation
to generate a 256 bit child private key and 256 bit chain code.

The private key and chain code are used, respectively, as the
secret and public seeds in WOTS+ generation. After the WOTS+ key
is generated, we save the quantum secure public key (PK).
This public key will be used as the Wallet address when full
quantum secure capabilities are implemented in the future.

The private key is also used to derive a "sleeve secret key".
This secret key allows the WOTS+ public key to be safely shared
at anytime, without compromising the non quantum secure keys
generated by Sleeve. This secret key will be used in the future
to redeem non quantum secure wallets into the WOTS+ quantum
secure wallet.

The sleeve output is generated using SHA3_256 to hash the
sleeve private key and WOTS+ public key together. The resulting
hash value is then encoded using BIP39, providing the output
mnemonic, which can be used to generate non quantum secure keys
on any blockchain platform.

func NewSleeve

func NewSleeve(csprng io.Reader, passphrase string, spec GenSpec) (*Sleeve, error)

Create a sleeve reading entropy from the provided CSPRNG, with the supplied passphrase and using the given generation spec

func NewSleeveFromEntropy

func NewSleeveFromEntropy(ent []byte, passphrase string, spec GenSpec) (*Sleeve, error)

Create a sleeve with provided entropy, passphrase and using the given generation spec Entropy must have 32 bytes

func NewSleeveFromMnemonic

func NewSleeveFromMnemonic(mnemonic, passphrase string, spec GenSpec) (*Sleeve, error)

Create a sleeve with provided mneomonic and passphrase Mnemonic must be valid under BIP39 and have 24 words

func (*Sleeve) GetMnemonic

func (s *Sleeve) GetMnemonic() string

Get the Sleeve's quantum secure mnemonic

func (*Sleeve) GetOutputMnemonic

func (s *Sleeve) GetOutputMnemonic() string

Get the Sleeve's standard mnemonic (output)

Jump to

Keyboard shortcuts

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