Documentation ¶
Index ¶
- type Block
- type BlockChain
- type BlockHasher
- type BlockValidator
- type Decoder
- type Encoder
- type GobTxDecoder
- type GobTxEncoder
- type Hasher
- type Header
- type MemoryStore
- type Storage
- type Transaction
- func (tx *Transaction) Decode(dec Decoder[*Transaction]) error
- func (tx *Transaction) Encode(enc Encoder[*Transaction]) error
- func (t *Transaction) FirstSeen() int64
- func (t *Transaction) Hash(hasher Hasher[*Transaction]) types.Hash
- func (t *Transaction) SetFirstSeen(time int64)
- func (t *Transaction) Sign(privKey crypto.PrivateKey) error
- func (t *Transaction) Verify() error
- type TxHasher
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { *Header Transactions []Transaction Validator crypto.PublicKey Signature *crypto.Signature // contains filtered or unexported fields }
func NewBlock ¶
func NewBlock(h *Header, txx []Transaction) *Block
func (*Block) AddTransaction ¶
func (b *Block) AddTransaction(tx *Transaction)
type BlockChain ¶
type BlockChain struct {
// contains filtered or unexported fields
}
func NewBlockChain ¶
func NewBlockChain(genesis *Block) (*BlockChain, error)
func (*BlockChain) AddBlock ¶
func (bc *BlockChain) AddBlock(b *Block) error
func (*BlockChain) HasBlock ¶
func (bc *BlockChain) HasBlock(height uint32) bool
func (*BlockChain) Height ¶
func (bc *BlockChain) Height() uint32
func (*BlockChain) SetValidator ¶
func (bc *BlockChain) SetValidator(v Validator)
type BlockHasher ¶
type BlockHasher struct{}
type BlockValidator ¶
type BlockValidator struct {
// contains filtered or unexported fields
}
func (*BlockValidator) ValidateBlock ¶
func (v *BlockValidator) ValidateBlock(b *Block) error
type GobTxDecoder ¶
type GobTxDecoder struct {
// contains filtered or unexported fields
}
func NewGobTxDecoder ¶
func NewGobTxDecoder(r io.Reader) *GobTxDecoder
func (*GobTxDecoder) Decode ¶
func (en *GobTxDecoder) Decode(tx *Transaction) error
type GobTxEncoder ¶
type GobTxEncoder struct {
// contains filtered or unexported fields
}
func NewGobTxEncoder ¶
func NewGobTxEncoder(w io.Writer) *GobTxEncoder
func (*GobTxEncoder) Encode ¶
func (en *GobTxEncoder) Encode(tx *Transaction) error
type Header ¶
type MemoryStore ¶
type MemoryStore struct { }
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func (*MemoryStore) Put ¶
func (s *MemoryStore) Put(b *Block) error
type Transaction ¶
type Transaction struct { Data []byte From crypto.PublicKey Signature *crypto.Signature // contains filtered or unexported fields }
func NewTransaction ¶
func NewTransaction(data []byte) *Transaction
func (*Transaction) Decode ¶
func (tx *Transaction) Decode(dec Decoder[*Transaction]) error
func (*Transaction) Encode ¶
func (tx *Transaction) Encode(enc Encoder[*Transaction]) error
func (*Transaction) FirstSeen ¶
func (t *Transaction) FirstSeen() int64
func (*Transaction) Hash ¶
func (t *Transaction) Hash(hasher Hasher[*Transaction]) types.Hash
func (*Transaction) SetFirstSeen ¶
func (t *Transaction) SetFirstSeen(time int64)
func (*Transaction) Sign ¶
func (t *Transaction) Sign(privKey crypto.PrivateKey) error
func (*Transaction) Verify ¶
func (t *Transaction) Verify() error
Click to show internal directories.
Click to hide internal directories.