wallet

package
v0.0.0-...-910d698 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Elliptic curve cryptography is used to generate public keys and Bitcoin addresses.

The public key can be generated by multiplying the private key and the generator point on the Elliptic curve.

K = k * G

G is the generator point on the Elliptic curve. k is a private key in the form of a randomly generated number. K is a public key.

How to generate Bitcoin address

Pulick Key --> SHA256 --> RIPEMD160 --> Base58Check Encoding --> Bitcoin Address

Base58Check Encoding 1. Payload 2. Version + Payload 3. (Version + Payload) --> SHA256 --> SHA256 --> First 4bytes --> Checksum 3. Version + Payload + Checksum 4. (Version + Payload + Checksum) --> Base58 encode

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base58Decode

func Base58Decode(input []byte) []byte

func Base58Encode

func Base58Encode(input []byte) []byte

func DistanceXor

func DistanceXor(h1 string, h2 string) uint64

func DistanceXor2

func DistanceXor2(h1 string, h2 string) uint64

func HashPubKey

func HashPubKey(pubKey []byte) []byte

func ValidateAddress

func ValidateAddress(addr []byte) bool

Types

type Wallet

type Wallet struct {
	PrivateKey *ecdsa.PrivateKey
	PublicKey  []byte
}

func LoadFile

func LoadFile(path string) (*Wallet, error)

func NewWallet

func NewWallet(path string) *Wallet

func (*Wallet) GetAddress

func (w *Wallet) GetAddress() []byte

Jump to

Keyboard shortcuts

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