wallet

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SeedChecksumSize is the number of bytes that are used to checksum
	// addresses to prevent accidental spending
	SeedChecksumSize = 6
)

Some of these funcs and consts are copied directly from the ScPrime code base. This was done instead of importing the packages directly because wasm can not support some of the ScPrime package dependencies such as boltdb.

Variables

This section is empty.

Functions

func NewWalletSeed

func NewWalletSeed() (string, error)

NewWalletSeed creates a new unique 28 or 29 word wallet seed

Types

type Seed

type Seed [crypto.EntropySize]byte

Seed is cryptographic entropy that is used to derive unlock conditions.

func StringToSeed

func StringToSeed(str string, did mnemonics.DictionaryID) (Seed, error)

StringToSeed converts a string to a wallet seed. Copied from gitlab.com/scpcorp/ScPrime/modules/wallet.go

type SpendableKey

type SpendableKey struct {
	UnlockConditions types.UnlockConditions `json:"unlock_conditions"`
	SecretKeys       []crypto.SecretKey     `json:"private_key"`
}

SpendableKey a set of secret keys plus the corresponding unlock conditions.

func GetAddress

func GetAddress(seed Seed, index uint64) SpendableKey

GetAddress returns the spendable address at the specified index

type UnlockConditions

type UnlockConditions struct {
	PublicKeys         []string `json:"publickeys"`
	SignaturesRequired uint64   `json:"signaturesrequired"`
	Timelock           uint64   `json:"timelock"`
}

UnlockConditions are a set of conditions which must be met to execute certain actions, such as spending an ScPrime coin output or terminating a FileContract.

The simplest requirement is that the block containing the UnlockConditions must have a height >= 'Timelock'.

'PublicKeys' specifies the set of keys that can be used to satisfy the UnlockConditions; of these, at least 'SignaturesRequired' unique keys must sign the transaction. The keys that do not need to use the same cryptographic algorithm.

If 'SignaturesRequired' == 0, the UnlockConditions are effectively "anyone can unlock." If 'SignaturesRequired' > len('PublicKeys'), then the UnlockConditions cannot be fulfilled under any circumstances.

Jump to

Keyboard shortcuts

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