Skip to content
Pau edited this page May 15, 2020 · 6 revisions

Developer starting guide

Unlike most of the standard platform projects, Vocdoni is a p2p based ecosystem. So it is mainly build on top of components that do not require a centralized trusted management. This characteristic makes Vocdoni a quite complex project in comparison with standard client/server infrastructures, but in the other side gives flexibility, scalability and trust-less third party contribution.

distributed backend

A good starting point for understanding the global architecture of Vocdoni is the technical overview v1.

dvotenode

The dvotenode is the Vocdoni's backend. It makes use of IPFS, Ethereum, libp2p and Tendermint. Currently supports three main operation modes:

  • miner: connects only to the Tendermint blockchain (Vochain)
  • oracle: uses Tendermint and Ethereum to bridge information from both blockchains
  • gateway: uses all the Vocdoni open stack

For launching the dvotenode go >1.14 is required (dockers are also available). See the README file for more details

The basic steps are:

  1. Clone the repository git clone [email protected]:vocdoni/go-dvote.git

  2. Execute the dvotenode go run cmd/dvotenode/dvotenode.go

The dvotenode will automatically connect to the development network in gateway mode and start synchronizing everything necessary. Once all init tasks are done, the dvote API will be available on ws://127.0.0.1:9090/dvote

You can use the testclient for querying the API:

echo '{method:"getGatewayInfo"}' | go run cmd/testclient/testclient.go -host=ws://127.0.0.1:9090/dvote

testsuit

Docker-compose can be used to launch a full local development environment.

Clone the repository git clone [email protected]:vocdoni/go-dvote.git.

Navigate to dockerfiles/testsuite cd dockerfiles/testsuite

Build and execute the compose file: docker-compose build docker-compose up

A new, from scratch, Vochain will be initialized together with an Oracle and a Gateway node.

Once you see some blocks mined, you can run your tests:

[vochain info] height:4 mempool:0 peers:4 processTree:0 voteTree:0 blockTime:{}

There is a program ready to launch a full voting test using the local Gateway provided by the docker-compose testsuit:

go run cmd/vochaintest/vochaintest.go --oracleKey=6aae1d165dd9776c580b8fdaf8622e39c5f943c715e20690080bbfce2c760223 --electionSize=500

Once your tests are done, you can remove all data and files executing docker-compose down -v

Clone this wiki locally