Giter Site home page Giter Site logo

devnet's Introduction

This is the chaincode repository for Z-Voting, a privacy-preserving e-voting platform that utilizes Zero-Knowledge Proofs and Multi-Party Computation.

Chaincode dev mode

Development Network for Hyperledger Fabric.

Just run the following commands from the project root directory to get started. You will have to open 3 terminals:

Terminal 1 (Start up network)

docker-compose up

Wait for 20 seconds before you move to terminal 2.

Terminal 2 (Build and run chaincode)

Here, we have to set the Chaincode Name first (the CC_N variable).

export CC_N=zvoting && docker exec -it chaincode bash -c "cd $CC_N && go build -o $CC_N && CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=$CC_N:1 ./$CC_N"

Terminal 3 (Install and instantiate chaincode)

The following code works with the provided chaincode zvoting. You may need to modify it according to your own needs. But if you are a beginner, you can just modify the zvoting code and keep using the following commands.

# connect to cli container
docker exec -it cli bash

# install chaincode
# we are given unique name and version of the chaincode
peer chaincode install -p chaincodedev/chaincode/zvoting -n zvoting -v 1

# instantiate chaincode
# we are giving channel name and chaincode name
peer chaincode instantiate -n zvoting -v 1 -c '{"Args":[]}' -C myc

Test chaincode

To test the chaincode we can execute invoke, query transactions. Following is the way to do that.

#If you are not in terminal 3, connect to cli container with the next command. But if you are already there, you should skip it.
docker exec -it cli bash

# invoke transactions with 'create'  
peer chaincode invoke -n zvoting -c '{"Args":["create", "001", "lambda", "[email protected]"]}' -C myc
peer chaincode invoke -n zvoting -c '{"Args":["create", "002", "ops", "[email protected]"]}' -C myc

# query transactions with 'get'
# output - {"id":"001","name":"lambda","email":"[email protected]"}
peer chaincode query -n zvoting -c '{"Args":["get", "001"]}' -C myc

# query transactions with 'search'
# output
[{"id":"001","name":"lambda","email":"[email protected]"},{"id":"002","name":"ops","email":"[email protected]"}]
peer chaincode query -n zvoting -c '{"Args":["search", "001", "005"]}' -C myc

Read more infomarions from here

devnet's People

Contributors

erangaeb avatar tanmoytkd avatar

Stargazers

 avatar  avatar  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.