Skip to content

dedis/d-voting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
giogio21
Apr 28, 2022
945272e Β· Apr 28, 2022
Mar 14, 2022
Apr 27, 2022
Apr 28, 2022
Apr 27, 2022
Apr 28, 2022
Apr 11, 2022
Mar 17, 2022
Apr 21, 2022
Apr 27, 2022
Apr 28, 2022
Mar 9, 2022
Apr 8, 2022
Apr 27, 2022
Apr 28, 2022
Apr 28, 2022
Apr 28, 2022
Apr 28, 2022
Apr 28, 2022
Dec 20, 2021
Apr 28, 2022
Apr 28, 2022
Mar 9, 2022
Feb 1, 2022
Apr 27, 2022
Apr 27, 2022

Repository files navigation

Global
Blockchain
Tests Quality
Web client
Frontend Backend

D-Voting

D-Voting is an e-voting platform based on the Dela blockchain. In short:

  • An open platform to run voting instances on a blockchain
  • Provides privacy of votes with state-of-the art protocols
  • Fully auditable and decentralized process

Setup

First be sure to have Go installed (at least 1.17).

Be sure to have the crypto utility from Dela:

git clone https://github.com/dedis/dela.git
cd dela/cli/crypto
go install

Go will install the binaries in $GOPATH/bin, so be sure this it is correctly added to you path (like with export PATH=$PATH:/Users/david/go/bin).

Create a private key (in the d-voting root folder):

crypto bls signer new --save private.key

Copy the private key from the d-voting root folder to the cli/memcoin folder:

cp private.key cli/memcoin/

Install memcoin (this requires the private key in cli/memcoin):

cd cli/memcoin
go install

Additionally, you can build the memcoin binary with:

go build ./cli/memcoin

Run the nodes

In three different terminal sessions, from the root folder:

pk=adbacd10fdb9822c71025d6d00092b8a4abb5ebcb673d28d863f7c7c5adaddf3

LLVL=info memcoin --config /tmp/node1 start --postinstall \
  --promaddr :9100 --proxyaddr :9080 --proxykey $pk --listen tcp://0.0.0.0:2001 --public //localhost:2001

LLVL=info memcoin --config /tmp/node2 start --postinstall \
  --promaddr :9101 --proxyaddr :9082 --proxykey $pk --listen tcp://0.0.0.0:2002 --public //localhost:2002

LLVL=info memcoin --config /tmp/node3 start --postinstall \
  --promaddr :9102 --proxyaddr :9083 --proxykey $pk --listen tcp://0.0.0.0:2003 --public //localhost:2003

Then you should be able to run the setup script:

./setup.sh

This script will setup the nodes and services. If you restart do not forget to remove the old state:

rm -rf /tmp/node{1,2,3}

Testing

Automate the previous setup using tmux

If you have tmux installed, you can start a tmux session that will execute the above setup by running ./start_test.sh in the project root. Once the session is started, you can move around the panes with Ctrl+B followed by arrow keys.

The top-left pane is for running commands, while the rest are for examining the node states.

To end the session, run ./kill_test.sh, which will kill each pane then the tmux session (which you can do manually with Ctrl+D), then delete the node data (i.e. the files /tmp/node{1,2,3}).

Run the scenario test

If nodes are running and setup.sh has been called, you can run a test scenario:

sk=28912721dfd507e198b31602fb67824856eb5a674c021d49fdccbe52f0234409
LLVL=info memcoin --config /tmp/node1 e-voting scenarioTest --secretkey $sk

For reference, here is a hex-encoded kyber Ed25519 keypair:

Public key: adbacd10fdb9822c71025d6d00092b8a4abb5ebcb673d28d863f7c7c5adaddf3

Secret key: 28912721dfd507e198b31602fb67824856eb5a674c021d49fdccbe52f0234409

Use the frontend

See README in web/.

Metrics

A d-Voting node exposes Prometheus metrics. You can start an HTTP server that serves those metrics with:

./memcoin --config /tmp/node1 metrics start --addr 127.0.0.1:9100 --path /metrics

Build info can be added to the binary with the ldflags, at build time. Infos are stored on variables in the root mod.go. For example:

versionFlag="github.com/dedis/d-voting.Version=`git describe --tags`"
timeFlag="github.com/dedis/d-voting.BuildTime=`date +'%d/%m/%y_%H:%M'`"

go build -ldflags="-X $versionFlag -X $timeFlag" ./cli/memcoin

Note that make build will do that for you.