Documentation ¶
Overview ¶
Package rmcbox implements a reliable multicast for arbitrary data.
This protocol is based on RBC (reliable broadcast), but has slightly different guarantees. Crucially a piece of data multicast with RMC with a given id will agree among all who received it, i.e. it is unique. The protocol has no hard guarantees pertaining pessimistic message complexity, but can be used in tandem with gossip protocols to disseminate data with proofs of uniqueness.
Index ¶
- func AcceptGreeting(conn network.Connection) (pid uint16, id uint64, msgType byte, err error)
- func Greet(w io.Writer, pid uint16, id uint64, msgType byte) error
- type RMC
- func (rmc *RMC) AcceptData(id uint64, pid uint16, r io.Reader) ([]byte, error)
- func (rmc *RMC) AcceptFinished(id uint64, pid uint16, r io.Reader) ([]byte, error)
- func (rmc *RMC) AcceptProof(id uint64, r io.Reader) error
- func (rmc *RMC) AcceptSignature(id uint64, pid uint16, r io.Reader) (bool, error)
- func (rmc *RMC) Clear(id uint64)
- func (rmc *RMC) Data(id uint64) []byte
- func (rmc *RMC) InitiateRaw(id uint64, data []byte) error
- func (rmc *RMC) Proof(id uint64) *multi.Signature
- func (rmc *RMC) SendData(id uint64, data []byte, w io.Writer) error
- func (rmc *RMC) SendFinished(id uint64, w io.Writer) error
- func (rmc *RMC) SendProof(id uint64, w io.Writer) error
- func (rmc *RMC) SendSignature(id uint64, w io.Writer) error
- func (rmc *RMC) Status(id uint64) Status
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptGreeting ¶
AcceptGreeting accepts a greeting and returns the information it learned from it.
Types ¶
type RMC ¶
type RMC struct {
// contains filtered or unexported fields
}
RMC is a structure holding all data related to a series of reliable multicasts.
func New ¶
func New(pubs []*bn256.VerificationKey, priv *bn256.SecretKey) *RMC
New creates a context for executing instances of the reliable multicast.
func (*RMC) AcceptData ¶
AcceptData reads the id from r, followed by the data and signature of the whole thing. It verifies that the id matches the provided one, and that the signature was made by pid. It returns the data itself, for protocol-independent verification.
func (*RMC) AcceptFinished ¶
AcceptFinished reads a pair of data and proof from r and verifies it corresponds to a successfully finished RMC.
func (*RMC) AcceptProof ¶
AcceptProof reads a proof from r and verifies it is a proof that id succeeded.
func (*RMC) AcceptSignature ¶
AcceptSignature reads a signature from r and verifies it represents pid signing the data associated with id. It returns true when the signature is exactly threshold-th signature gathered.
func (*RMC) Clear ¶
Clear removes all information concerning id. After a clear the state is Unknown until any further calls with id.
func (*RMC) Data ¶
Data returns the raw data corresponding to id. If the status differs from Finished, this data might be unreliable!
func (*RMC) InitiateRaw ¶
InitiateRaw data signature gathering. This should be used only when all participants already know the data, and only want to produce a proof that it is agreed between them.
func (*RMC) Proof ¶
Proof returns the proof corresponding to id. If the status differs from Finished, returns nil.
func (*RMC) SendFinished ¶
SendFinished writes the data and proof associated with id to w.
func (*RMC) SendSignature ¶
SendSignature writes the signature associated with id to w. The signature signs the data.
type Status ¶
type Status byte
Status represents a state of a reliable multicast.
const ( // Unknown means we either never saw any data related to an instance of RMC, or we deleted it. Unknown Status = iota // Data means we received or sent data that is being multicast, but we have not yet signed it. Data // Signed means we signed the piece of data, but we have not yet received the proof that it has been multicast successfully. Signed // Finished means we received a proof that the data has been multicast successfully. Finished )