monero

package
v0.0.0-...-910450c Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const KeySize = 32

KeySize denotes the size of the low-level public and private keys.

Variables

View Source
var WordlistEnglish = []string{}/* 1626 elements not displayed */

Functions

This section is empty.

Types

type Network

type Network string

Network denotes a type of Monero network to gather information about.

const (
	NetworkMainnet   Network = "mainnet"
	NetworkTestnet   Network = "testnet"
	NetworkStagenet  Network = "stagenet"
	NetworkFakechain Network = "fakechain"
)

func (Network) PublicAddressBase58Prefix

func (n Network) PublicAddressBase58Prefix() []byte

type Seed

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

Seed encapsulates funcionality that arised from the knowledge of a private spend key.

Differently from Bitcoin, Monero users posses two sets of private and public keys:

		  private | public
               ------- | ------
	          ks      | Ks		 spend
	          kv      | Kv		 view

From the private spend key, a private view key is derived. Of each of them, a corresponding public key is formed.

func NewSeed

func NewSeed(privateSpendKey []byte, opts ...SeedOption) *Seed

NewSeed instantiates a new Seed instance based on a byte array that contains the secret number that derives all three other keys.

As mentioned before, although here we store two private keys, ultimately, this `privateSpendKey` (an immense number "impossible" to guess that here is represented as a 32-byte array) is the only one key that is _really_ important to safe-guard as the other one is derived out of it.

func (*Seed) Mnemonic

func (s *Seed) Mnemonic() []string

Mnemonic converts a private spend key (that gigantic number represented as a 32-byte array) to a 25-element list of carefully chosen words in a particular language (a 1626 dictionary whose words have some nice properties).

The first 24 words correspond to the key, with the 25-th being a CRC32 checksum used for error-checking.

ps.: in this implementation, only support for the English wordlist is provided.

func (*Seed) PrimaryAddress

func (s *Seed) PrimaryAddress() string

PrimaryAddress gives the base58-formatted representation of the primary address of this seed.

func (*Seed) PrivateSpendKey

func (s *Seed) PrivateSpendKey() []byte

func (*Seed) PrivateViewKey

func (s *Seed) PrivateViewKey() []byte

func (*Seed) PublicSpendKey

func (s *Seed) PublicSpendKey() []byte

func (*Seed) PublicViewKey

func (s *Seed) PublicViewKey() []byte

type SeedOption

type SeedOption func(s *Seed)

SeedOption describes the type of functional options that can be provided to the constructor to override default settings.

func WithNetwork

func WithNetwork(n Network) SeedOption

WithNetwork overrides the default network set for Seed instances.

Jump to

Keyboard shortcuts

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