blockchain

package
v0.0.0-...-16f18e5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const HashSize = 32

HashSize of array used to store hashes. See Hash.

View Source
const MaxHashStringSize = HashSize * 2

MaxHashStringSize is the maximum length of a Hash hash string.

Variables

View Source
var BitcoinMainChain = Chain{
	PubKeyHashAddrID: 0x00,
}
View Source
var BitcoinTestChain = Chain{
	PubKeyHashAddrID: 0x6f,
}
View Source
var (
	ErrChecksumMismatch = errors.New("checksum mismatch")
)
View Source
var LitecoinMainChain = Chain{
	PubKeyHashAddrID: 0x30,
}
View Source
var LitecoinTestChain = Chain{
	PubKeyHashAddrID: 0x6f,
}

Functions

This section is empty.

Types

type Address

type Address interface {
	EncodeAddress() string
	String() string
	UnmarshalJSON([]byte) error
}

func DecodeAddress

func DecodeAddress(addr string) (Address, error)

DecodeAddress will attempt to recognize and parse address from string

type AddressPubKeyHash

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

func (*AddressPubKeyHash) EncodeAddress

func (a *AddressPubKeyHash) EncodeAddress() string

func (*AddressPubKeyHash) String

func (a *AddressPubKeyHash) String() string

String returns human-readable string for using with fmt.Stringer

func (*AddressPubKeyHash) UnmarshalJSON

func (a *AddressPubKeyHash) UnmarshalJSON(src []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

type BlockHash

type BlockHash [HashSize]byte

BlockHash is used for storing hash of block

func NewHashFromStr

func NewHashFromStr(str string) (*BlockHash, error)

func (BlockHash) String

func (hash BlockHash) String() string

String returns the Hash as the hexadecimal string of the byte-reversed hash

func (*BlockHash) UnmarshalJSON

func (hash *BlockHash) UnmarshalJSON(src []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

type Chain

type Chain struct {
	// Address encoding magics
	PubKeyHashAddrID byte // First byte of a P2PKH address
	ScriptHashAddrID byte // First byte of a P2SH address
}

Jump to

Keyboard shortcuts

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