pbft

package
v0.0.0-...-53feb6c Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2016 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package pbft is the Practical Byzantine Fault Tolerance algorithm with some simplifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSimulation

func NewSimulation(config string) (sda.Simulation, error)

NewSimulation returns a pbft simulation

Types

type Commit

type Commit struct {
	HeaderHash string
}

Commit is the commit packet in the protocol

type Finish

type Finish struct {
	Done string
}

Finish is just to tell the others node that the protocol is finished

type PrePrepare

type PrePrepare struct {
	*blockchain.TrBlock
}

PrePrepare message

type Prepare

type Prepare struct {
	HeaderHash string
}

Prepare is the prepare packet

type Protocol

type Protocol struct {
	// the node we are represented-in
	*sda.TreeNodeInstance
	// contains filtered or unexported fields
}

Protocol implements sda.Protocol we do basically the same as in http://www.pmg.lcs.mit.edu/papers/osdi99.pdf with the following diffs: there is no client/server request and reply (or first line in Figure 1) instead of MACs we just send around the hash of the block this will make the protocol faster, but the network latency will overweigh this skipped computation anyways

func NewProtocol

func NewProtocol(n *sda.TreeNodeInstance) (*Protocol, error)

NewProtocol returns a new pbft protocol

func (*Protocol) Dispatch

func (p *Protocol) Dispatch() error

Dispatch implements sda.Protocol (and listens on all message channels)

func (*Protocol) PrePrepare

func (p *Protocol) PrePrepare() error

PrePrepare intializes a full run of the protocol.

func (*Protocol) Start

func (p *Protocol) Start() error

Start implements the ProtocolInstance interface of sda.

type Simulation

type Simulation struct {
	// sda fields:
	sda.SimulationBFTree
	// pbft simulation specific fields:
	// Blocksize is the number of transactions in one block:
	Blocksize int
}

Simulation implements sda.Simulation interface

func (*Simulation) Run

func (e *Simulation) Run(sdaConf *sda.SimulationConfig) error

Run runs the simulation

func (*Simulation) Setup

func (e *Simulation) Setup(dir string, hosts []string) (*sda.SimulationConfig, error)

Setup implements sda.Simulation interface

Jump to

Keyboard shortcuts

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