types

package
v0.0.0-...-2334cb8 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2016 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Amount int `json:"amount,omitempty"`
	Count  int `json:"count,omitempty"`
}

func (*Account) JSON

func (acc *Account) JSON() string

type Address

type Address struct {
	N       int                `json:"n,omitempty"`
	PubKeys []*btcec.PublicKey `json:"pubkeys,omitempty"`
}

func (*Address) Hash

func (addr *Address) Hash() string

func (*Address) Sorted

func (addr *Address) Sorted() string

type Block

type Block struct {
	DiffLength string    `json:"difflength,omitempty"`
	Error      error     `json:"error,omitempty"`
	Length     int       `json:"length,omitempty"`
	Nonce      *big.Int  `json:"nonce,omitempty"`
	PrevHash   string    `json:"prevhash,omitempty"`
	Target     string    `json:"target,omitempty"`
	Time       time.Time `json:"time,omitempty"`
	Txs        []*Tx     `json:"txs,omitempty"`
	Version    string    `json:"version,omitempty"`
}

func (*Block) Hash

func (b *Block) Hash() string

func (*Block) JSON

func (b *Block) JSON() string

type DB

type DB struct {
	AddBlock        bool
	DiffLength      string
	Length          int
	RecentHash      int
	SigLength       int
	Storage         *leveldb.DB
	SuggestedBlocks []*Block
	SuggestedTxs    []*Tx
	Txs             []*Tx
}

func NewDB

func NewDB(db *leveldb.DB) *DB

func (*DB) Delete

func (db *DB) Delete(k string) error

func (*DB) GetAccount

func (db *DB) GetAccount(addr string) *Account

func (*DB) GetBlock

func (db *DB) GetBlock(blockNum int) *Block

func (*DB) Put

func (db *DB) Put(k string, v Serializer) error

type HalfWay

type HalfWay struct {
	HalfHash string   `json:"halfhash,omitempty"`
	Nonce    *big.Int `json:"nonce,omitempty"`
}

func (*HalfWay) Hash

func (h *HalfWay) Hash() string

type Hasher

type Hasher interface {
	Hash() string
}

type Serializer

type Serializer interface {
	JSON() string
}

type Tx

type Tx struct {
	Amount     int                `json:"amount,omitempty"`
	Count      int                `json:"count,omitempty"`
	PubKeys    []*btcec.PublicKey `json:"pubkeys,omitempty"`
	Signatures []*btcec.Signature `json:"signatures,omitempty"`
	To         string             `json:"to,omitempty"`
	Type       string             `json:"type,omitempty"`
}

Tx holds all related info for a transaction NOTE: Types int/int64 are probably not enough for Amount. Python has Long (big) numbers support builtin, Go doesn't, so "the big.Int way" Extracted from `gui.py:13`

func (*Tx) Hash

func (t *Tx) Hash() string

Jump to

Keyboard shortcuts

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