- src: Source code of our main contribution, including ocert package that implements the protocol described before, and ocert chaincode that is run in Hyperledger Fabric network.
- ocert: Ocert package that implements ElGamal rerandomization encryption, structure-preserving signature and non-interactive zero knowledge proof system, as well as ocert main scheme.
- chaincode/ocert.go: The script that run in Hyperledger Fabric network, which is based on ocert_scheme.go. It implements
Init
andInvoke
chaincode functions, and provides functions likeGenECert
andGenOCert
to the client.
- chaincode-docker-devmode: This module relies on the chaincode-docker-devmode example in Hyperledger Fabric tutorial. It starts a docker environment that is used to test a chaincode, including a chaincode container where the ocert chaincode runs and a cli container where a client can interact with ocert chaincode. The docker-compose configuration file is modified so it first builds the images integrating PBC library for chaincode and cli containers before starting up the whole environment. During starting up, ocert package and ocert chaincode are copied into chaincode and cli containers. Once up, the docker environment is ready for running and testing ocert chaincode.
- docker: This module contains two Dockerfiles that are used to build the images mentioned in docker-compose configuration file, one for chaincode container and another for cli container.
- benchmark: This module contains scripts used in evaluation, including one script benchmarkcc.go. It can run in cli container, interact with ocert chaincode and collect data for benchmark.
- data: This module contains three files recording data generated during benchmark. genOCertLog.txt records the total time to generate one ocert; genProofLog.txt records the time to generate a proof of knowledge in one ocert generation; verifyProofLog.txt records the time to verify a proof of knowledge in one ocert generation.
- benchmark-analysis-tool: This module contains the script used to evaluate benchmark date.
To run ocert chaincode, please open three Terminals and navigate to chaincode-docker-devmode in each Terminal
- Terminal 1: Start the network
Setup the whole docker environment by
docker-compose -f docker-compose-simple.yaml up
- Terminal 2: Build and start the chaincode
First enter chaincode container by
Then build ocert chaincode
docker exec -it chaincode bash
Last, start chaincodecd ocert go build ocert.go
CORE_PEER_ADDRESS=peer:7051 CORE_CHAINCODE_ID_NAME=mycc:0 ./ocert
- Terminal 3: Use the chaincode
First enter cli container by
Then initialize chaincode
docker exec -it cli bash
Now you can play around ocert chaincode. For example, you can get the bilinear group used in the protocolpeer chaincode install -p chaincodedev/chaincode/ocert -n mycc -v 0 peer chaincode instantiate -n mycc -v 0 -c '{"Args":[]}' -C myc
or the public keyspeer chaincode query -n mycc -c '{"Args":["sharedParams"]}' -C myc
and definitiely, generate ecert and ocertSpeer chaincode query -n mycc -c '{"Args":["get","auditor_pk"]}' -C myc peer chaincode query -n mycc -c '{"Args":["get","structure_preserving_vk"]}' -C myc peer chaincode query -n mycc -c '{"Args":["get","rsa_pk"]}' -C myc
You should generatepeer chaincode query -n mycc -c '{"Args":["genECert", arguments_used_by_GenECert]}' -C myc peer chaincode query -n mycc -c '{"Args":["genOCert", arguments_used_by_GenOCert]}' -C myc
arguments_used_by_GenECert
andarguments_used_by_GenOCert
, and encode them byBytes()
from types.go. Please refer benchmarkcc.go to use these functions. You also need to use theSetBytes()
from types.go to decode the result from these functions.