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
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
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}
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}
).
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
See README in web/
.
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.