encoding

package
v0.0.0-...-942cd0b Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package encoding provides different encodings used in bitcoin and also utility functions that use this encodings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Address

func Address(pub *ecdsa.PublicKey, compressed, testnet bool) string

Address returns the associated bitcoin address in base58check for the public key as string.

reference: https://en.bitcoin.it/wiki/Base58Check_encoding

func AddressToPubKeyHash

func AddressToPubKeyHash(s string) ([20]byte, error)

AddressToPubKeyHash recovers the public key hash from an address in base58check.

Returns error if the checksum doesn't match.

func DecodeVarInt

func DecodeVarInt(r io.Reader) *big.Int

func EncodeVarInt

func EncodeVarInt(i *big.Int) ([]byte, error)

func Wif

func Wif(priv *ecdsa.PrivateKey, compressed, testnet bool) string

Wif encodes the private key in WIF format.

WIF has the following format: [1 byte net id] [D in big-endian] [suffix if compressed] [4 bytes checksum]

reference: https://en.bitcoin.it/wiki/Wallet_import_format

Types

This section is empty.

Jump to

Keyboard shortcuts

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