/DNA-Sharing-Chain

Sample Dapp for the thesis "DNA-Sharing-Chain: A Privacy Preserving DNA Sequence Sharing Ecosystem".

Primary LanguageJavaScriptMIT LicenseMIT

DNA-SHARING-CHAIN

Sample Dapp for the thesis "DNA-Sharing-Chain: A Privacy Preserving DNA Sequence Sharing Ecosystem".

Environment

  • OS: Ubuntu 20.04.5 LTS
  • Node: v20.11.1
  • NVM: 0.39.1
  • Ganache: 7.9.2 (@ganache/cli: 0.10.2, @ganache/core: 0.10.2)
  • Truffle
    • Truffle v5.11.5 (core: 5.11.5)
    • Ganache v7.9.1
    • Solidity - 0.8.13 (solc-js)
    • Node v20.11.1
    • Web3.js v1.10.0
  • Browserify: 17.0.0
  • Metamask browser extension

Build

Decentralized Identity Chain (DID-Chain)

  1. Install ganache & truffle

    npm install -g ganache
    npm install -g truffle
  2. Build up ganache network

    ganache -s 0 --gasPrice 0 --blockTime 0.5 
  3. Deploy smart contracts

    cd did_chain/
    truffle migrate

DNA Sharing Chain (APP-Chain)

  1. Install fablo environment

    • Put the fablo script at /app_chain/.
  2. Build up hyperledger fabric network

    cd app_chain/
    ./fablo up
    • To shut down the network

      ./fablo down
    • To clean all data

      ./fablo prune
      • You should do this after modifying chaincodes.

Dapp

  1. Parse ABI files

    cd did_chain/
    node parse_abi.js
    • The ABI files (*.abi.js) will be generated at /app/public/javascripts/.
  2. Bundle up packages

    cd bundle_files/
    npm install
    npm run build
    • The bundle files (*.bundle.js) will be generated at /app/public/javascripts/.
  3. Start the Dapp

    cd app/
    npm install
    npm start
    • Open browser.

    • If you get an error like

      2024-07-06T12:46:53.547Z - error: [DiscoveryResultsProcessor]: parseDiscoveryResults[access-control-channel] - Channel:access-control-channel received discovery error:access denied...
      

      Delete the folder /app/routes/wallet/ and restart the system again.

Sample Data Generation (Optional)

Generate sample data in VCF format. Written in C++.

cd data_generator/
./data_generator.cpp <output_file_path> <record_number>

CSR and Private Key Generation (Optional)

Generate CSR and private key by OpenSSL.

openssl ecparam -name prime256v1 -genkey -noout -out key.pem
openssl req -new -sha256 -key key.pem -nodes -nodes -out key.csr

References