Code Monkey home page Code Monkey logo

blockchain-voter's Introduction

BLOCKCHAIN VOTER

This API intends to initialize a voting system through distributed nodes and to allow the users to vote.

BUILDING

In order to build a binary run:

go build .

RUNNING

After your run the project, wheter using the binary or locally, it will check for the candidates.json file, which contains the voting information and which will be used to distribute the voting system through your nodes, this file should not be modified manually (a future version will verify the integrity of the file).

In case you don't have this file yet, you'll have two options:

  1. Create a new system
  2. Joining as a voting node to a previous system, to do so, you'll need to provide an url or a public ip to join the network.

Once the system is initialized, you'll be able to interact with the voting system.

Sending a transaction

You can add a vote by sending a transaction to the network.

Method: POST Endpoint: /transaction Body:

{
    "voter": "aasda1221a3121a4wa2",
    "candidate": "01"
}

candidate must be a valid candidate id within the candidates.json file voter musth be encrypted

Get all the transactions

You can see all the transactions within the network

Method: GET Endpoint: /transactions

Get the results

You can see the sumarized results

Method: GET Endpoint: /chains/result

Validating the transactions

Anyone can check the integrity of the data.

Method: GET Endpoint: /chains/valid

Author: Nicolas Macias

blockchain-voter's People

Contributors

zeittgeist avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.