block

package
v0.0.0-...-a0055f1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreviousBlockHashLength = 32
	MerkleTreeRootLength    = 32
)

Variables

View Source
var EmptyAddress = common.Address{}

Functions

This section is empty.

Types

type Block

type Block struct {
	BlockHeader  *BlockHeader
	Transactions []*transaction.SignedTransaction
	MerkleTree   *merkletree.MerkleTree
}

TransactionInput is one of the inputs into Plasma transaction

func NewBlock

func NewBlock(blockNumber uint32, txes []*transaction.SignedTransaction, previousBlockHash []byte) (*Block, error)

func NewBlockFromBytes

func NewBlockFromBytes(rawBlock []byte) (*Block, error)

func (*Block) DecodeRLP

func (block *Block) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt from an RLP stream.

func (*Block) EncodeRLP

func (block *Block) EncodeRLP(w io.Writer) error

func (*Block) GetFrom

func (block *Block) GetFrom() (common.Address, error)

func (*Block) Serialize

func (block *Block) Serialize() ([]byte, error)

func (*Block) Sign

func (block *Block) Sign(privateKey []byte) error

func (*Block) Validate

func (block *Block) Validate() error

signature is [R || S || V]

type BlockHeader

type BlockHeader struct {
	BlockNumber          [transaction.BlockNumberLength]byte
	NumberOfTransactions [transaction.TransactionNumberLength]byte
	PreviousBlockHash    [PreviousBlockHashLength]byte
	MerkleTreeRoot       [MerkleTreeRootLength]byte
	V                    [transaction.VLength]byte
	R                    [transaction.RLength]byte
	S                    [transaction.SLength]byte
	// contains filtered or unexported fields
}

TransactionInput is one of the inputs into Plasma transaction

func NewBlockHeader

func NewBlockHeader(blockNumber uint32,
	numberOfTransactions uint32,
	previousBlockHash []byte,
	merkleTreeRoot []byte,
	v []byte, r []byte, s []byte) (*BlockHeader, error)

func NewBlockHeaderFromBytes

func NewBlockHeaderFromBytes(serializedHeader []byte) (*BlockHeader, error)

func NewUnsignedBlockHeader

func NewUnsignedBlockHeader(blockNumber uint32,
	numberOfTransactions uint32,
	previousBlockHash []byte,
	merkleTreeRoot []byte) (*BlockHeader, error)

func (*BlockHeader) GetFrom

func (header *BlockHeader) GetFrom() (common.Address, error)

func (*BlockHeader) GetHash

func (header *BlockHeader) GetHash() (common.Hash, error)

func (*BlockHeader) GetHashToSign

func (header *BlockHeader) GetHashToSign() (common.Hash, error)

func (*BlockHeader) GetRaw

func (header *BlockHeader) GetRaw() []byte

func (*BlockHeader) Sign

func (header *BlockHeader) Sign(privateKey []byte) error

Jump to

Keyboard shortcuts

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