keystore

package
v0.0.0-...-bfbcaa6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StandardScryptN = 1 << 18
	StandardScryptP = 1
	LightScryptN    = 1 << 12
	LightScryptP    = 6
)

const variables

Functions

func DecodeWIF

func DecodeWIF(wif string) (*ecdsa.PrivateKey, error)

DecodeWIF .

func EncodeWIF

func EncodeWIF(privateKey *ecdsa.PrivateKey) (string, error)

EncodeWIF .

func FromWIF

func FromWIF(wif string, curve elliptic.Curve) (*ecdsa.PrivateKey, error)

FromWIF converts a Wallet Import Format string to a Bitcoin private key and derives the corresponding Bitcoin public key.

func PrivateToAddress

func PrivateToAddress(privateKey *ecdsa.PrivateKey) (string, error)

PrivateToAddress .

func PrivateToScriptHash

func PrivateToScriptHash(privateKey *ecdsa.PrivateKey) ([]byte, error)

PrivateToScriptHash .

func ScriptHashToAddress

func ScriptHashToAddress(scriptHash []byte) string

ScriptHashToAddress script hash to address

func WriteLightScryptKeyStore

func WriteLightScryptKeyStore(key *Key, password string) ([]byte, error)

WriteLightScryptKeyStore write keystore with Scrypt format

func WriteScryptKeyStore

func WriteScryptKeyStore(key *Key, password string) ([]byte, error)

WriteScryptKeyStore write keystore with Scrypt format

Types

type Key

type Key struct {
	ID         uuid.UUID         // Key ID
	Address    string            // address
	PrivateKey *ecdsa.PrivateKey // btc private key
}

Key wallet wallet key

func KeyFromPrivateKey

func KeyFromPrivateKey(privateKeyBytes []byte) (*Key, error)

KeyFromPrivateKey wallet key from private key bytes

func KeyFromWIF

func KeyFromWIF(wif string) (*Key, error)

KeyFromWIF wallet key from wif format

func NewKey

func NewKey() (*Key, error)

NewKey create new key

func ReadKeyStore

func ReadKeyStore(data []byte, password string) (*Key, error)

ReadKeyStore read key from keystore

func (*Key) ToBytes

func (key *Key) ToBytes() []byte

ToBytes get key's bytes array

type ScriptHash

type ScriptHash []byte

ScriptHash .

func AddressToScriptHash

func AddressToScriptHash(address string) (ScriptHash, error)

AddressToScriptHash convert address to script hash

func (ScriptHash) String

func (hash ScriptHash) String() string

Jump to

Keyboard shortcuts

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