beacon

package
v0.0.0-...-fc88c08 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package beacon implements the beacon random source. This source is meant to be used in the setup stage only. After the setup phase is done, it shall return a coin random source for use in the main part of the protocol.

Beacon assumes the following about the dag:

(1) there are no forks,
(2) level = height for each unit,

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Beacon

type Beacon struct {
	// contains filtered or unexported fields
}

Beacon is a struct representing the beacon random source.

func New

func New(conf config.Config) (*Beacon, error)

New returns a RandomSource using a beacon.

func (*Beacon) DataToInclude

func (b *Beacon) DataToInclude(parents []gomel.Unit, level int) ([]byte, error)

DataToInclude returns data which should be included in a unit with given parents and level.

func (*Beacon) DealingData

func (b *Beacon) DealingData(epoch gomel.EpochID) ([]byte, error)

DealingData returns random source data that should be included in the dealing unit.

func (*Beacon) GetWTK

func (b *Beacon) GetWTK(head uint16) *tss.WeakThresholdKey

GetWTK returns a weak threshold key obtained by using this beacon. Head should be the creator of the timing unit chosen on the 6th level.

func (*Beacon) NewRandomSource

func (b *Beacon) NewRandomSource(dag gomel.Dag) gomel.RandomSource

NewRandomSource allows using this instance of Beacon as a RandomSource by binding the provided dag to it.

func (*Beacon) RandomBytes

func (b *Beacon) RandomBytes(pid uint16, level int) []byte

RandomBytes returns a sequence of random bits for a given unit. It returns nil when (1) asked on a level that is too low i.e. level < sharesLevel or (2) there are no enough shares, i.e. the number of units on a given level created by share providers to the multicoin of pid is less than f+1.

When there is at least one unit of level+1 in the dag then condition (2) cannot hold.

Jump to

Keyboard shortcuts

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