Skip to content
A mechanism for creating questionnaires in blockchains and accepting votes.
Solidity JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
contracts Fix the cancellation process of the questionnaire Apr 12, 2019
deploy/abi
migrations Some fixes Apr 10, 2019
sequence-diagram Update the document as your contract is modified Apr 11, 2019
tool Commit development source Jan 30, 2019
.eslintrc.js
.gitattributes
.gitignore
.prettierrc.js
LICENSE
README.en.md
README.ja.md
README.md
package-lock.json
package.json
truffle-config.js Some fixes Apr 10, 2019

README.md

Mechanism for creating questionnaires in blockchain and accepting votes

Read this in other languages: English , 日本語 .

Overview

Implement a questionnaire system using a smart contract.

Main point

  • The questionnaire consists of questions and options and sets the response period (start and end).
  • You can set the start and end date and time for voting. (1 minute minimum voting period)
  • Anyone can answer the questionnaire, and can answer only once for each EOA address.
  • The situation of the answer is always public.
  • Since the content of the questionnaire is hashed and managed, the exact same content can not be created

What can be achieved by this Dapps

Because information is recorded in the block chain, there is no concern such as falsification of the record

specification

Create a questionnaire

argument

  • The contents of the string _contents questionnaire (the format is described below)
  • uint _numberOfChoices Choices
  • uint _voteStartAt Start timestamp for accepting answers
  • uint _voteEndAt Time stamp for closing answer
{
    "question": "What is your favorite drink?",
    "options": ["tea", "coffee", "orange juice", "cola"]
}

Javascript example:

const data = {
    question: "What's your favorite drink?",
    options: ['tea', 'coffee', 'orange juice', 'cola'],
};

const _contents = JSON.stringify(data);

function

function create(string memory _contents, uint _numberOfChoices, uint _voteStartAt, uint _voteEndAt) public onlyOwner returns (bool) { ... }

キャンペーン作成

Voting

argument

  • bytes32 _id Questionnaire ID
  • uint _choice Number of choices to vote (number starts with zero)

function

function vote(bytes32 _id, uint _choice) public acceptingVoting(_id) returns (bool) { ... }

投票

Refer poll results

argument

  • bytes32 _id Questionnaire ID

function

function getResult(bytes32 _id) public view returns (uint[] memory) { ... }

投票結果参照

Implementation

The implementation will be published on GitHub.

https://github.com/PLUSPLUS-JP/crypto-vote

You can’t perform that action at this time.