types

package
v0.0.0-...-041d6b2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Wei   = 1
	GWei  = 1e9
	Ether = 1e18
)
	All ethereum values uses bit.Int
 to calculate Wei values in GWei:
	new(big.Int).Mul(value, big.NewInt(params.GWei))
View Source
const (
	SigTypeUnknown = SigType(math.MaxUint8)

	SigTypeSecp256k1 = SigType(iota)
	SigTypeBLS
	SigTypeEd25519
)
View Source
const SignatureMaxLength = 200
View Source
const TicketRandomnessLookback = 1

Variables

View Source
var (
	ErrKeyInfoNotFound = fmt.Errorf("key info not found")
	ErrKeyExists       = fmt.Errorf("key already exists")
)
View Source
var MaxWinCount = 10 * config.ExpectedLeadersPerEpoch.Int64()

Functions

This section is empty.

Types

type BeaconEntry

type BeaconEntry struct {
	Round    uint64
	Data     []byte
	Metadata map[string]interface{}
}

func NewBeaconEntry

func NewBeaconEntry(round uint64, data []byte, metadata map[string]interface{}) BeaconEntry

type DioneTask

type DioneTask struct {
	OriginChain   uint8
	RequestType   string
	RequestParams string
	Payload       []byte
	RequestID     string
}

DioneTask represents the values of task computation

type ElectionProof

type ElectionProof struct {
	WinCount        int64
	VRFProof        []byte
	RandomnessRound uint64
}

func (*ElectionProof) ComputeWinCount

func (ep *ElectionProof) ComputeWinCount(power *big.Int, totalPower *big.Int) int64

ComputeWinCount uses VRFProof to compute number of wins The algorithm is based on Algorand's Sortition with Binomial distribution replaced by Poisson distribution.

type KeyInfo

type KeyInfo struct {
	Type       KeyType
	PrivateKey []byte
}

KeyInfo is used for storing keys in KeyStore

type KeyStore

type KeyStore interface {
	// List lists all the keys stored in the KeyStore
	List() ([]string, error)
	// Get gets a key out of keystore and returns KeyInfo corresponding to named key
	Get(string) (KeyInfo, error)
	// Put saves a key info under given name
	Put(string, KeyInfo) error
	// Delete removes a key from keystore
	Delete(string) error
}

KeyStore is used for storing secret keys

type KeyType

type KeyType string

KeyType defines a type of a key

const (
	KTEd25519 KeyType = "ed25519"
)

func (*KeyType) UnmarshalJSON

func (kt *KeyType) UnmarshalJSON(bb []byte) error

type SigType

type SigType byte

func (SigType) Name

func (t SigType) Name() (string, error)

type Signature

type Signature struct {
	Type SigType
	Data []byte
}

func (*Signature) Equals

func (s *Signature) Equals(o *Signature) bool

func (*Signature) MarshalBinary

func (s *Signature) MarshalBinary() ([]byte, error)

func (*Signature) MarshalCBOR

func (s *Signature) MarshalCBOR(w io.Writer) error

func (*Signature) UnmarshalBinary

func (s *Signature) UnmarshalBinary(bs []byte) error

func (*Signature) UnmarshalCBOR

func (s *Signature) UnmarshalCBOR(br io.Reader) error

Jump to

Keyboard shortcuts

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