Skip to content

Create transactions related to storage operations and interact with the deployed blockchain on hyperledger fabric

License

Notifications You must be signed in to change notification settings

K-nto/Kinto-storage-contract

Repository files navigation

logo

Kinto Storage Contract

UADE Informatics Engineering thesis project - 2022

Kinto hyperledger blockchain contract for storage operations


📔 Table of Contents

🌟 About the Project

This contract allows our microservice to create transactions related to storage operations and interact with the deployed blockchain on hyperledger fabric.

👾 Tech Stack

🎯 Features

  • Create WRITE, READ, DELETE, SHARE transactions in the blockchain
  • Fetch existing blocks for a specific wallet

🧰 Getting Started

‼️ Prerequisites

This project uses node and npm as package manager, make sure it is installed

 node -v
 npm -v

🏃 Run Locally

Clone the project

  git clone https://github.com/K-nto/Kinto-storage-contract.git

Go to the project directory

  cd Kinto-storage-contract

Install dependencies

  npm install

Compile

  npm run build

Start

  npm run start

🚩 Deployment

To deploy this contract into hyperledger blockchain head to scripts/SETUP_LOCAL.md for further instructions

👀 Usage

Once the contract is deployed into the blockchain. With the proper security configurations, these are the available querys

  • Initialize storage ledger
{"function": "initLedger", "Args": []}
  • get all file operations
{"function": "queryAllFileOperations", "Args": []}
  • create a transaction
{"function": "createFileOperation", "Args": ["FILEHASH_1", "WALLET_1", "WRITE"]}
  • Modify operation
{"function": "modifyFile", "Args": ["TRANSACTION_ID", "FILE_HASH"]}

Example Using hyperledger fabric Peer Cli on a test network

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 $CONTRACT_NAME --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":"createFileOperation","Args":["FILEHASH_2", "WALLET_2", "READ"]}'

Example Using typescript

import {contract} from '@hyperledger/fabric-gateway';

// You need to connect to the network and generate a gateway connection

//Execute transaction
const transactionResultBytes = await contract.evaluateTransaction(
  'createFileOperation',
  'FILEHASH_2',
  'WALLET_2',
  'READ'
);

const resultJson = new TextDecoder().decode(transactionResultBytes);

⚠️ License

Distributed under the no License. See LICENSE.txt for more information.

🤝 Contact

Federico Javier Parodi - Fedejp - Linkedin - Github

Carlos Santiago Yanzon - Bizk - Linkedin - Github

Project Link: https://github.com/K-nto

💎 Acknowledgements

We thank and aknowledge the authors of these resources for their work.

About

Create transactions related to storage operations and interact with the deployed blockchain on hyperledger fabric

Topics

Resources

License

Stars

Watchers

Forks