pvss

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package pvss implements a PVSS backed commit-reveal scheme loosely based on the Scalable Randomness Attested by Public Entities protocol by Casudo and David.

In practice this implementation omits the things that make SCRAPE scalable/fast, and is just a consensus backed PVSS based beacon. The differences are as follows:

  • The coding theory based share verification mechanism is not implemented. The check is as in Schoenmakers' paper. This could be added at a future date for a performance gain.

  • The commit/reveal based fast path that skips having to recover each participant's secret if they submitted a protocol level reveal is omitted. It is possible to game the system by publishing shares for one secret and a commitment for another secret, and then choosing to reveal or not after everyone else has revealed. While this behavior is detectable, it either involves having to recover the secret from the shares anyway rendering the optimization moot, or having a userbase that understands that slashing is integral to the security of the system.

See: https://eprint.iacr.org/2017/216.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	Index  int            `json:"index"`
	Shares []*CommitShare `json:"shares"`
}

Commit is a PVSS commit.

type CommitShare

type CommitShare struct {
	PolyV Point `json:"poly_v"` // Share of the public commitment polynomial
	PubVerShare
}

CommitShare is a commit share.

type CommitState

type CommitState struct {
	Commit         *Commit      `json:"commit"`
	DecryptedShare *PubVerShare `json:"decrypted_share,omitempty"`
}

CommitState is a PVSS commit and the corresponding decrypted share, if any.

type Point

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

Point is an elliptic curve point.

func (Point) MarshalBinary

func (p Point) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (*Point) MarshalText

func (p *Point) MarshalText() ([]byte, error)

MarshalText encodes a point into text form.

func (*Point) UnmarshalBinary

func (p *Point) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Point) UnmarshalText

func (p *Point) UnmarshalText(text []byte) error

UnmarshalText decodes a text marshaled point.

type PubVerShare

type PubVerShare struct {
	V Point `json:"v"` // Encrypted/decrypted share

	C  Scalar `json:"c"`  // Challenge
	R  Scalar `json:"r"`  // Response
	VG Point  `json:"vg"` // Public commitment with respect to base point G
	VH Point  `json:"vh"` // Public commitment with respect to base point H
}

PubVerShare is a public verifiable share (`pvss.PubVerShare`)

type Reveal

type Reveal struct {
	Index           int                  `json:"index"`
	DecryptedShares map[int]*PubVerShare `json:"decrypted_shares"`
}

Reveal is a PVSS reveal.

type Scalar

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

Scalar is a scalar.

func (Scalar) MarshalBinary

func (s Scalar) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (*Scalar) UnmarshalBinary

func (s *Scalar) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

Jump to

Keyboard shortcuts

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