Coder Social home page Coder Social logo

tkuhrt / convector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hyperledger-labs/convector

0.0 2.0 0.0 6.22 MB

Smart Contract Systems the easy way. Open source development framework. Documentation https://worldsibu.github.io/convector/

Home Page: https://worldsibu.io/convector/

License: Other

TypeScript 95.47% Shell 4.53%

convector's Introduction

CONVECTOR

Issues Newsletter npm Discord

TypeScript License lerna


Using Convector

Dependencies that you need in your project:

Then include to your projects the Convector components depending on the layer you are working on.

A typical distribution and usage of the components goes as follow (asumming you have a mono-repo, if not, then distribute according to the "why" column which explains what that package installation will give you):

Project/Layer Why Command
Root of your project To have a dev env and the utility that will let you install, upgrade, invoke and so on, the chaincodes. npm install -D @worldsibu/convector-tool-{dev-env,chaincode-manager}
Root chaincode project. E.g.: chaincodes/ So that you can share settings between your multiple chaincodes, such as development environment, tests and testing scripts, blockchain installation setup (what to install, where), etc. npm install -D @worldsibu/convector-{adapter-mock,tool-{dev-env,chaincode-manager}} chai mocha @types/chai @types/mocha ts-node
At for each of your chaincode projects. E.g.: chaincodes/cc-token Each chaincode can be a separate project so that you don't have to carry everything when including in another layer of your stack. npm install -SE @worldsibu/convector-core-{model,controller} && npm i -S yup reflect-metadata && npm i -D @types/yup
At your backend / api It typically calls the nodes (peers) of your blockchain, but it may call the World State or other services as well. Include each of your chaincode projects, they will carry the basic dependencies npm install -SE @worldsibu/convector-{adapter-fabric,storage-couchdb} @types/bytebuffer
At the front end Here you may be calling your backend/api server, it is great to have the interfaces and structures coming right from the chaincodes layer so that you don't have to copy everything. Include each of your chaincode projects, they will carry the basic dependencies.

If you want to see this distribution in action see this project! It is also a easy way for you to start a new project

Guides

About Convector

Convector is a framework designed to be used by javascript developers that aim to develop in Hyperledger Fabric (for now, more support on other technologies coming) fast and easily. The framework is made up of different blocks, described below:

Convector Core

Formed by all the @worldsibu/convector-core-* packages. It provides all the necessary code to write contract specifications using the Model/Controller pattern.

Convector Storage

Convector is designed thinking in a modular design from its conception. A model not only can be used at the chaincode layer, since most of the time you'll have to use the same model in your services or front-end application, the models can be used anywhere. The difference of its behavior is the storage layer it uses. At chaincode the storage is the Fabric Shim to save and read data in the blockchain. But if you whish to run a model in a NodeJS backend, the storage layer can be swapped by the CouchDB storage layer, which will allow you to read data, but not write. In a browser environment you can even create your own storage layer mapping to your back-end api.

Convector Adapters

Following the modular design pattern from models, controllers have adapters, they are the handlers to route the requests to the appropriate layer. In a blockchain it will be the Fabric API, but on NodeJS it might be the Fabric Client SDK, on unit tests it might be a mock class, and on browser it can map to your APIs.

Convector Tools

Formed by all the @worldsibu/convector-tool-* packages. It provides a set of helpers and utilitarians to make the chaincode development easily.

  • Chaincode Manager used to bundle controllers in a single chaincode and handle the installation and invokation.
  • Dev Environment, is a basic dev environment created with Fabric running on docker or vagrant. Contains two organization and three users in that organization, two channels, one orderer, one peer per org with its database, and all the cryptographic material for this to work.

Model / Controller pattern

Convector is designed to write reusable pieces of code that describe the nature of what a developer can do in a blockchain.

A blockchain (for the developer's eyes) is no more than a data layer protected by a logic layer defining the rules of what the outside world can do in with the inner data. Thus, a really comfortable way of writing chaincode logic (smart contracts) is by having Models describing the shape of the data and Controllers describing the actions and rules that apply to the models.

More

Support

  • Don't hesitate to include recommendations, feature requests or bugs in our issues section.
  • To keep up with advances and news on Convector subscribe to our Newsletter
  • If you need help and chat with our team, join our Discord

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.