v2.2.0 Latest Latest

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

Go to latest
Published: May 6, 2024 License: ISC Imports: 26 Imported by: 1



Package server implements a DiceMix Light server for CoinShuffle++.



This section is empty.


This section is empty.


This section is empty.


type Joiner

type Joiner interface {
	Join(unmixed []byte, pid int) error
	ValidateUnmixed(unmixed []byte, mcount int) error

Joiner is any data which can be joined with binary unmixed data of similar type. The pid describes the submitting peer ID for blame assignment. Joiner must be implemented by the Mixer when the server is used for CoinJoins.

type LimitedJoiner added in v2.1.0

type LimitedJoiner interface {
	CheckLimited(unmixed []byte, totalMixes int) error

LimitedJoiner is a Joiner that is limited by the total size of the mix. If the unmixed data can not be added to the Joiner without exceeding these limits, the peer submitting this unmixed data must be excluded from a run, even though they have not acted maliciously.

type Mixer

type Mixer interface {

	// Mix adds a mixed message.
	Mix(m []byte)

	// Confirm extracts signatures from confirm from a specific peer and
	// includes them in the Mixer.
	Confirm(confirm interface{}, pid int) error

Mixer is any binary-representable data which can add mixed messages and be confirmed with signatures.

type NewMixer

type NewMixer func(desc []byte) (Mixer, error)

NewMixer returns a Mixer to join data with described features. The result should contain no initial messages. If the BinaryMixer is also a Joiner, it will be joined with the unmixed data from a pairing request message.

type PublishMixer

type PublishMixer interface {
	PublishMix(ctx context.Context) error

PublishMixer is a Mixer which is capable of using the server to publish the data. If Mixer implements PublishMixer, the mix will be published (and blame may be assigned for bad submitted data if the publish fails).

type Server

type Server struct {
	// contains filtered or unexported fields

Server implements pairing of clients performing compatible mixes, and coordinates a DiceMix Light session between paired clients.

func New

func New(msize int, newm NewMixer, epoch time.Duration) (*Server, error)

New creates a Server that will perform DiceMix Light with messages of length msize. When newm creates a CoinJoin transaction, this implements CoinShuffle++.

If the Mixer returned by newm implements the Joiner and Shuffler interfaces, these will be called to join and shuffle non-anonymous portions of a mix.

func (*Server) Run

func (s *Server) Run(ctx context.Context, lis net.Listener) error

Run executes the server, listening on lis for new client connections.

func (*Server) SetMinPeers

func (s *Server) SetMinPeers(min int)

func (*Server) SetReportEncoder

func (s *Server) SetReportEncoder(enc *json.Encoder)

type Shuffler

type Shuffler interface {

Shuffler shuffles all values (including non-anonymous) of a mix. If a Mixer implements Shuffler, all values are shuffled before confirming. It is not necessary to implement Shuffler to provide mixed message anonymity.

Jump to

Keyboard shortcuts

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