block

package
v0.0.0-...-f94ef0f Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT 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 interface {
	// Hash returns block hash.
	Hash() common.Hash

	Version() uint32
	// PrevHash returns previous block hash.
	PrevHash() common.Hash
	// MerkleRoot returns a merkle root of the transaction hashes.
	MerkleRoot() common.Hash
	// Timestamp returns block's proposal timestamp.
	Timestamp() uint64
	// Index returns block index.
	Index() uint32
	// ConsensusData is a random nonce.
	ConsensusData() uint64

	// Signature returns block's signature.
	Signature() []byte
	// Sign signs block and sets it's signature.
	Sign(key *keys.PrivateKey) error
	// Verify checks if signature is correct.
	Verify(key *keys.PublicKey, sign []byte) error

	// Transactions returns block's transaction list.
	Transactions() []Transaction
	// SetTransaction sets block's transaction list.
	SetTransactions([]Transaction)
}

Block is a generic interface for a block used by dbft.

func NewBlock

func NewBlock(timestamp uint64, index uint32, nextConsensus common.Address, prevHash common.Hash, version uint32, nonce uint64, txHashes []common.Hash) Block

NewBlock returns new block.

type Transaction

type Transaction interface {
	// Hash must return cryptographic hash of the transaction.
	// Transactions which have equal hashes are considered equal.
	Hash() common.Hash
}

Transaction is a generic transaction interface.

Jump to

Keyboard shortcuts

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