Giter Site home page Giter Site logo

votingdapp_icp's Introduction

votecrypt

The MerkleVoting smart contract was written using the Motoko programming language and deployed on the Internet Computer (IC) blockchain. The contract utilizes two main actors, a Voter actor and a Candidate actor. The smart contract has an owner that can add candidates and administer the election phases.

The Internet Computer blockchain was chosen due to its significant transaction processing capabilities and low transaction fees. Using the IC would make the voting process scalable and financially feasible for any election. The IC's built-in identity management system (IC ID) could further enhance the voter experience by providing seamless authentication and KYC (Know Your Customer) capabilities.

By utilizing Merkle trees for voter eligibility verification, the smart contract provides an efficient way of handling large amounts of voter data. Using the setMerkleRoot function, the contract owner can set the Merkle root (generated offline) for the Merkle proofs to be checked against. When voting, the voter has to submit the Merkle proof (to be generated in the UI backend) together with the candidate number that should receive the vote. The Merkle proof is then checked against the Merkle root using the built-in cryptographic functions provided by the Motoko language.

The key benefits of using the Internet Computer blockchain and the Motoko programming language for this use case are:

Scalability: The Internet Computer's high transaction processing capabilities and low transaction fees make it well-suited for large-scale voting applications. Efficiency: The use of Merkle trees for voter eligibility verification allows for quick and efficient validation of voter data, even for large voter populations. Security: The Motoko language and the Internet Computer's built-in security features provide a secure environment for running the voting smart contract and processing sensitive voter data. Native Identity Management: The IC ID system simplifies the voter authentication and KYC processes, improving the overall user experience. To learn more before you start working with votecrypt, see the following documentation available online:

If you want to start working on the project right away, you might want to try the following commands:

cd votecrypt/
dfx help
dfx canister --help

Running the project locally

If you want to test your project locally, you can use the following commands:

# Starts the replica, running in the background
dfx start --background

# Deploys your canisters to the replica and generates your candid interface
dfx deploy

Once the job completes, your application will be available at http://localhost:4943?canisterId={asset_canister_id}.

If you have made changes to your backend canister, you can generate a new candid interface with

npm run generate

at any time. This is recommended before starting the frontend development server, and will be run automatically any time you run dfx deploy.

If you are making frontend changes, you can start a development server with

npm start

Which will start a server at http://localhost:8080, proxying API requests to the replica at port 4943.

Note on frontend environment variables

If you are hosting frontend code somewhere without using DFX, you may need to make one of the following adjustments to ensure your project does not fetch the root key in production:

  • setDFX_NETWORK to ic if you are using Webpack
  • use your own preferred method to replace process.env.DFX_NETWORK in the autogenerated declarations
    • Setting canisters -> {asset_canister_id} -> declarations -> env_override to a string in dfx.json will replace process.env.DFX_NETWORK with the string in the autogenerated declarations
  • Write your own createActor constructor

votingdapp_icp's People

Contributors

ibrainiac avatar

Watchers

 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.