evoting

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: BSD-3-Clause Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContractUID is the UID of the contract
	ContractUID = "EVOT"

	// ContractName is the name of the contract.
	ContractName = "go.dedis.ch/dela.Evoting"

	// CmdArg is the argument's name to indicate the kind of command we want to
	// run on the contract. Should be one of the Command type.
	CmdArg = "evoting:command"

	// FormArg is the key at which the form argument is stored in the
	// transaction. The content is defined by the type of command.
	FormArg = "evoting:arg"
)
View Source
const (
	// FormsMetadataKey is the key at which form metadata are saved in
	// the storage.
	FormsMetadataKey = "FormsMetadataKey"
)

Variables

View Source
var (
	PromFormStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "dvoting_status",
		Help: "status of form",
	},
		[]string{"form"},
	)

	PromFormBallots = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "dvoting_ballots_total",
		Help: "number of cast ballots",
	},
		[]string{"form"},
	)

	PromFormShufflingInstances = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "dvoting_shufflings_total",
		Help: "number of shuffling instances",
	},
		[]string{"form"},
	)

	PromFormPubShares = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "dvoting_pubshares_total",
		Help: "published public shares",
	},
		[]string{"form"},
	)

	PromFormDkgStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "dvoting_dkg_status",
		Help: "status of distributed key generator",
	},
		[]string{"form"},
	)
)

Functions

func NewCreds

func NewCreds() access.Credential

NewCreds creates new credentials for a evoting contract execution. We might want to use in the future a separate credential for each command.

func RegisterContract

func RegisterContract(exec *native.Service, c Contract)

RegisterContract registers the value contract to the given execution service.

Types

type Command

type Command string

Command defines a type of command for the value contract

const (
	// CmdCreateForm is the command to create a form
	CmdCreateForm Command = "CREATE_FORM"
	// CmdOpenForm is the command to open a form
	CmdOpenForm Command = "OPEN_FORM"
	// CmdCastVote is the command to cast a vote
	CmdCastVote Command = "CAST_VOTE"
	// CmdCloseForm is the command to close a form
	CmdCloseForm Command = "CLOSE_FORM"
	// CmdShuffleBallots is the command to shuffle ballots
	CmdShuffleBallots Command = "SHUFFLE_BALLOTS"

	// CmdRegisterPubShares is the command to register the pubshares
	CmdRegisterPubShares Command = "REGISTER_PUB_SHARES"

	// CmdCombineShares is the command to decrypt ballots
	CmdCombineShares Command = "COMBINE_SHARES"
	// CmdCancelForm is the command to cancel a form
	CmdCancelForm Command = "CANCEL_FORM"

	// CmdDeleteForm is the command to delete a form
	CmdDeleteForm Command = "DELETE_FORM"
)

type Contract

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

Contract is a smart contract that allows one to execute evoting commands

- implements native.Contract

func NewContract

func NewContract(srvc access.Service,
	pedersen dkg.DKG, rosterFac authority.Factory) Contract

NewContract creates a new Value contract

func (Contract) Execute

func (c Contract) Execute(snap store.Snapshot, step execution.Step) error

Execute implements native.Contract

func (Contract) UID

func (c Contract) UID() string

UID returns the unique 4-bytes contract identifier.

- implements native.Contract

type SemiRandomStream

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

SemiRandomStream implements cipher.Stream

func NewSemiRandomStream

func NewSemiRandomStream(seed []byte) (SemiRandomStream, error)

NewSemiRandomStream returns a new initialized semi-random struct based on math.Rand. This random stream is not cryptographically safe.

- implements cipher.Stream

func (SemiRandomStream) XORKeyStream

func (s SemiRandomStream) XORKeyStream(dst, src []byte)

XORKeyStream implements cipher.Stream

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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