ipfs / notes

IPFS Collaborative Notebook for Research
MIT License
400 stars 33 forks source link

decentralized voting library #279

Open waozi-dev opened 6 years ago

waozi-dev commented 6 years ago

I would like to develop a decentralized voting library that other people can integrate in their existing application for decentralized secure voting in their application.

I am still not so sure how to make it possible but here is the idea, any feedback and suggestions on what tools to use are very welcome :) I am especially wondering what crdt i should use, y-js connector, orbitdb, peer-crdt-ipfs, etc..

the process i am working on is weighted score voting with consensus logic the process can be divided into 3 phases phase 1 - collection phase in this phase anyone in the group can add proposals to a specific topic phase 2 - voting each user votes on each proposal from -3 to +3 negative numbers describe the resistance and are weighted with a standard weight of x3 0 mean no resistance and therefore you accept any outcome of the specific proposal positive numbers show how much you support a proposal phase 3 - result the results are calculated (any negative number is multiplied by the negativeScoreWeight such as 3) the proposal with the highest score is shown at the top of the list

here is a basic example in psuedocode of how i could imagine the library to function

// import the voting library
// the library will start an ipfs node or connect to a running ipfs daemon
import ipfs-ivoti as ivoti

// a new topic is created 
// the new topic returns a key which allows the application to access the topic
let negativeScoreWeight = 3
let topicTitle = "What should we do about our food situation?"
let proposalTime = "3 Days"
let votingTime = "2 Days"

let topic = ivoti.newTopic(topicTitle, negativeScoreWeight, proposalTime, votingTime) 

// add proposals to the topic
// each proposal returns an unique identifier
let p1 = ivoti.addProposal(topic, "Buy from Netto")
let p2 = ivoti.addProposal(topic, "Dumpster dive at Aldi")
let p3 = ivoti.addProposal(topic, "Harvest carrots from the garden")

// once the proposal phase is over 

if (topic.proposalTime == 0) {
  // topic, proposal, myVote
  ivoti(topic, p1, -3)
  ivoti(topic, p2,  2)
  ivoti(topic, p3, -2)
}

looking forward to any feedback :) @diasdavid

daviddias commented 6 years ago

Hi @spaceywolfi, thanks for sharing your notes. In order to build a proper decentralized secure voting system, you will have to design from threat models and requirements, rather than libraries. To start, try to answer these questions:

You can definitely set up something that looks like voting using a CRDT library, however, it won't be secure.