types

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Number       *big.Int
	ParentHash   *util.Hash
	ExtraData    []byte
	Nonce        *big.Int
	Transactions []*Transaction
	TxRoot       *util.Hash

	R         *big.Int
	S         *big.Int
	PublicKey *util.CompactPublicKey
}

Block is the basic unit of the blockchain.

func DeserializeBlock

func DeserializeBlock(data []byte) *Block

DeserializeBlock deserializes the block bytes into a block object.

func NewBlock

func NewBlock(number *big.Int, parentHash *util.Hash, data []byte) *Block

NewBlock creates a new block and sets the hash.

func (*Block) Clone

func (dst *Block) Clone(src *Block)

Clone returns a duplicate block from the source block.

func (*Block) DeriveHash

func (b *Block) DeriveHash() *util.Hash

DeriveHash derives the hash of the block.

func (*Block) Serialize

func (b *Block) Serialize() []byte

Serialize serializes the block object into bytes.

func (*Block) SetNonce

func (b *Block) SetNonce(n *big.Int)

SetNonce sets the nonce of the block.

func (*Block) Sign

func (b *Block) Sign(ua *util.UnlockedAccount)

func (*Block) TxRootHash

func (b *Block) TxRootHash() *util.Hash

func (*Block) Verify

func (b *Block) Verify() bool

type RPCResponse

type RPCResponse struct {
	Success bool
	Message []byte
}

type Transaction

type Transaction struct {
	From      util.Address
	To        util.Address
	Value     *big.Int
	Msg       []byte
	Fee       *big.Int
	Nonce     *big.Int
	R         *big.Int
	S         *big.Int
	PublicKey *util.CompactPublicKey
}

func DeserializeTransaction

func DeserializeTransaction(data []byte) *Transaction

func (*Transaction) CalculateHash

func (tx *Transaction) CalculateHash() ([]byte, error)

func (*Transaction) Equals

func (tx *Transaction) Equals(other merkletree.Content) (bool, error)

Equals tests for equality of two Contents

func (*Transaction) Hash

func (tx *Transaction) Hash() *util.Hash

func (*Transaction) Serialize

func (tx *Transaction) Serialize() []byte

func (*Transaction) Sign

func (tx *Transaction) Sign(ua *util.UnlockedAccount)

func (*Transaction) Verify

func (tx *Transaction) Verify() bool

type Transactions

type Transactions []*Transaction

func (Transactions) Array

func (txs Transactions) Array() []*Transaction

Jump to

Keyboard shortcuts

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