party

package
v0.0.0-...-09d2262 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncapsulateVSSSend

func EncapsulateVSSSend(pi *Pi, BijList []bls.Fr, WBijList []bls.G1Point, F uint32) []byte

func GenCoefficientsFile

func GenCoefficientsFile(N int, T int)

func GetLagrangeCoefficients

func GetLagrangeCoefficients(deg uint32, x []bls.Fr, targetIndex bls.Fr, lambda []bls.Fr)

get the lagrange coefficients at index "targetIndex", with known indexes x[]. remenber to allocate memory for target[] before using this function.

func GetSamples

func GetSamples(ExpIndexes []int, Values []bls.Fr, MaxWidth uint64) []*bls.Fr

func GetScaleByCommitteeSize

func GetScaleByCommitteeSize(size uint32) uint8

w_0,w_1,...,w^(3f+1) will be used to represent values of a polynomial. The total number of values is 3f+2.So in this function we use size+1

func MainProcess

func MainProcess(p *HonestParty, ID []byte, value []byte, validation []byte) []byte

MainProcess is the main process of smvba instances

func PadCoeff

func PadCoeff(poly_coeff []bls.Fr, MaxWidth uint64) []bls.Fr

pad a polynomial in coefficient form to MaxWidth

func PolyToString

func PolyToString(poly_coeff []bls.Fr) string

func ReadFromFile

func ReadFromFile(data interface{}, filename string)

func Receiver

func Receiver(ctx context.Context, p *HonestParty, sender uint32, ID []byte, validator func(*HonestParty, []byte, uint32, []byte, []byte) error) ([]byte, []byte, bool)

Receiver is run by the receiver of a instance of provable broadcast

func SPBReceiver

func SPBReceiver(ctx context.Context, p *HonestParty, sender uint32, ID []byte) ([]byte, []byte, bool)

SPBReceiver is run by the receiver of a instance of strong provable broadcast

func SPBSender

func SPBSender(ctx context.Context, p *HonestParty, ID []byte, value []byte, validation []byte) ([]byte, []byte, bool)

SPBSender is run by the sender of a instance of strong provable broadcast

func Sender

func Sender(ctx context.Context, p *HonestParty, ID []byte, value []byte, validation []byte) ([]byte, bool)

Sender is run by the sender of a instance of provable broadcast

func SigKeyGen

func SigKeyGen(n uint32, t uint32) ([]*share.PriShare, *share.PubPoly)

SigKeyGen return pk and sks for threshold signature n is the number of parties, t is the threshold of combining signature

func SigKeyGenFix

func SigKeyGenFix(n uint32, t uint32) ([]*share.PriShare, *share.PubPoly)

here t = 2f + 1

func SigKeyGenFix_New

func SigKeyGenFix_New(n uint32, t uint32) ([]*share.PriShare, *share.PubPoly)

func WriteToFile

func WriteToFile(data interface{}, filename string)

Types

type Client

type Client struct {
	*HonestParty
	// contains filtered or unexported fields
}

func (*Client) SetSecret

func (client *Client) SetSecret(s bls.Fr)

func (*Client) Share

func (client *Client) Share(ID []byte)

Share shares a secret client.s to the other parties Assuming KZG setup has done, and public parameters are available

type HonestParty

type HonestParty struct {
	N   uint32 // committee size
	F   uint32 // number of corrupted parties
	PID uint32 // id of this party

	FS  *polycommit.FFTSettings
	KZG *polycommit.KZGSettings

	SigPK *share.PubPoly  //tss pk
	SigSK *share.PriShare //tss sk

	Proof *Pi //pi

	LagrangeCoefficients [][]bls.Fr //lagrange coefficients when using f(1),f(2),...,f(2t+1) to calculate f(k) for 0 <= k <= 3*f+1.Indices start from 0

	VSSStart             time.Time
	VSSEnd               time.Time
	PrepareStart_old     time.Time
	PrepareEnd_old       time.Time
	PrepareStart_new     time.Time
	PrepareEnd_new       time.Time
	ShareReduceStart_old time.Time
	ShareReduceEnd_old   time.Time
	ShareReduceStart_new time.Time
	ShareReduceEnd_new   time.Time
	ProactivizeStart     time.Time
	ProactivizeEnd       time.Time
	ShareDistStart       time.Time
	ShareDistEnd         time.Time
	// contains filtered or unexported fields
}

HonestParty is a struct of honest committee members TODO: add epoch number into this struct

func NewHonestParty

func NewHonestParty(e uint32, N uint32, F uint32, pid uint32, ipList []string, portList []string, ipListNext []string, portListNext []string, sigPK *share.PubPoly, sigSK *share.PriShare) *HonestParty

NewHonestParty returns a new honest party object

func (*HonestParty) Broadcast

func (p *HonestParty) Broadcast(m *protobuf.Message) error

Broadcast a message to all parties

func (*HonestParty) BroadcastExclude

func (p *HonestParty) BroadcastExclude(m *protobuf.Message, pid uint32) error

BroadcastExclude broadcasts a message to all parties except pid, used for RBC_test

func (*HonestParty) BroadcastToNextCommittee

func (p *HonestParty) BroadcastToNextCommittee(m *protobuf.Message) error

BroadcastToNextCommittee broadcasts a message m to all parties in the new committee

func (*HonestParty) GetMessage

func (p *HonestParty) GetMessage(messageType string, ID []byte) chan *protobuf.Message

GetMessage tries to get a message according to messageType and ID

func (*HonestParty) InitReceiveChannel

func (p *HonestParty) InitReceiveChannel() error

InitReceiveChannel sets up the listener and Init the receiveChannel

func (*HonestParty) InitSendChannel

func (p *HonestParty) InitSendChannel() error

InitSendChannel sets up the sender and Init the sendChannel, please run this after initializing all party's receiveChannel

func (*HonestParty) InitSendToNextChannel

func (p *HonestParty) InitSendToNextChannel() error

func (*HonestParty) InterpolateComOrWit

func (p *HonestParty) InterpolateComOrWit(degree uint32, targetIndex uint32, List []bls.G1Point) bls.G1Point

InterpolateComOrWit interpolates commitment or witness according to the first 2t+1 elements

func (*HonestParty) InterpolateComOrWitByKnownIndexes

func (p *HonestParty) InterpolateComOrWitByKnownIndexes(degree uint32, targetIndex uint32, knownIndexes []bls.Fr, List []bls.G1Point) bls.G1Point

func (*HonestParty) PrepareReceive

func (p *HonestParty) PrepareReceive(ID []byte)

PrepareReceive receives Prepare message which contains Pi from the previous commitee and sets p.Proof.

func (*HonestParty) PrepareSend

func (p *HonestParty) PrepareSend(ID []byte)

PrepareSend sends public parameters(commitments) to the corresponding node in the next commitee

func (*HonestParty) ProactivizeAndShareDist

func (p *HonestParty) ProactivizeAndShareDist(ID []byte)

func (*HonestParty) RBCReceive

func (p *HonestParty) RBCReceive(ID []byte) *protobuf.Message

func (*HonestParty) RBCSend

func (p *HonestParty) RBCSend(M *protobuf.Message, ID []byte)

RBC propose

func (*HonestParty) RBCSendExclude

func (p *HonestParty) RBCSendExclude(M *protobuf.Message, ID []byte, pid uint32)

func (*HonestParty) Send

func (p *HonestParty) Send(m *protobuf.Message, des uint32) error

Send a message to a party with des as its pid, 0 =< des < p.N

func (*HonestParty) SendToNextCommittee

func (p *HonestParty) SendToNextCommittee(m *protobuf.Message, des uint32) error

SendToNextCommittee sends a message to a new committtee party with des as its pid, 0 =< des < p.N

func (*HonestParty) ShareReduceReceive

func (p *HonestParty) ShareReduceReceive(ID []byte)

func (*HonestParty) ShareReduceSend

func (p *HonestParty) ShareReduceSend(ID []byte)

func (*HonestParty) VSSShareReceive

func (p *HonestParty) VSSShareReceive(ID []byte)

func (*HonestParty) VerifyVSSSendReceived

func (p *HonestParty) VerifyVSSSendReceived(polyValue []bls.Fr, witness []bls.G1Point, piReceived *Pi) bool

type Party

type Party interface {
	// contains filtered or unexported methods
}

Party is an interface of committee members

type Pi

type Pi struct {
	Gs         bls.G1Point // g^s
	PiContents []PiContent //indices start from 1
}

func (*Pi) Init

func (pi *Pi) Init(F uint32)

func (*Pi) Set

func (pi *Pi) Set(src *Pi, F uint32)

func (*Pi) SetFromVSSMessage

func (pi *Pi) SetFromVSSMessage(m *protobuf.Pi, F uint32)

type PiContent

type PiContent struct {

	//In DyCAPS.Share, CBj refers to commitment to B(x,index) generated by dealer.
	//In DyCAPS.Handoff, CBj refers to commitment to Q_i(x,index) generated by Party i
	CBj bls.G1Point
	CZj bls.G1Point //Z_j(x)=R_j(x)-R_j(0)
	WZ0 bls.G1Point //witness of Z_j(0)=0
	// contains filtered or unexported fields
}

type RecoverMsg

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

type SBElement

type SBElement struct {
	CB bls.G1Point
	// contains filtered or unexported fields
}

SBElement is the set of elements for full shares

type SComElement

type SComElement struct {
	CB bls.G1Point
	// contains filtered or unexported fields
}

SComElement is the set of commitments

type SRecElement

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

SRecElement is the set of elements for recover

type SSigElement

type SSigElement struct {
	Sig []byte
	// contains filtered or unexported fields
}

SSigElement is the set of signatures

Jump to

Keyboard shortcuts

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