Code Monkey home page Code Monkey logo

self-encryption-fabric's Introduction

Using Self-Encryption to safeguard data security in Fabric's smart contract

Overview

The prototype of a Hyperledger Fabric's smart contract merged with self-encryption for the Delft University of Technology Bachelor's Research project.

This source code is based on Hyperledger's Fabric Samples, https://github.com/hyperledger/fabric-samples.
Self-Encryption library can be found here, https://github.com/maidsafe/self_encryption.

Installation

  • Docker v19.03.8
  • Nodejs v14.18.2

Run

First navigate the current directory to test-network folder

Start up the test network and create channel

./network.sh up createChannel

Deploy the smart contract

./network.sh deployCC -ccn basic -ccp ../self-encryption-chaincode -ccl javascript

Set environmental variables

export PATH=${PWD}/../bin:$PATH
export FABRIC_CFG_PATH=$PWD/../config/
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_LOCALMSPID="Org1MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp
export CORE_PEER_ADDRESS=localhost:7051

Users upload encrypted file chunks and data map retrieved

docker cp {path/to/file_chunks_and_data_map} {peer_1_container_id}:/etc/hyperledger/fabric/chunk_store_test
docker cp {path/to/file_chunks_and_data_map} {peer_2_container_id}:/etc/hyperledger/fabric/chunk_store_test

Initialise the ledger

peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile 
${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem 
-C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles 
${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses 
localhost:9051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c 
'{"function":"InitLedger","Args":[]}'

Retrieve all the data saved in the ledger

peer chaincode query -C mychannel -n basic -c '{"Args":["GetAllAssets"]}'

Retrieve the CID of the data map

peer chaincode query -C mychannel -n basic -c '{"Args":["PutDataMapToIPFS"]}'

Shut down the network

./network.sh down 

self-encryption-fabric's People

Contributors

chaiwon avatar

Watchers

James Cloos 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.