Code Monkey home page Code Monkey logo

generator-fabric's Introduction

generator-fabric

Yeoman generator for Hyperledger Fabric.

This Yeoman generator can be used to generate chaincodes, or smart contracts, for Hyperledger Fabric. Chaincodes can be generated that are written in either Go or JavaScript, with experimental TypeScript support available as well.

Installation

You must install Yeoman, which is easy:

npm install -g yo

Then you can install this Yeoman generator, which is also easy:

npm install -g generator-fabric

Done!

Usage

Create a new directory for the chaincode:

mkdir my-smart-contract

Change into the new directory for the chaincode:

cd my-smart-contract

Create an empty git repository for the chaincode (optional, but recommended):

git init

Run the Yeoman generator:

yo fabric

If everything is installed successfully, then you should see prompts similar to the following:

? Please specify the generator to run: Chaincode
This generator can also be run with: yo fabric:chaincode
? Please specify the chaincode language: JavaScript
? Please specify the chaincode name: my-smart-contract
? Please specify the chaincode version: 0.0.1
? Please specify the chaincode description: My Smart Contract
? Please specify the chaincode author: Simon Stone
? Please specify the chaincode license: Apache-2.0
create package.json
create .editorconfig
create .eslintrc.js
create .gitignore
create index.js
create start.js
create lib/chaincode.js
create test/chaincode.js

Alternatively, you can run the generator non-interactively, by specifying additional command line options:

yo fabric:chaincode -- --language javascript --name my-smart-contract --version 0.0.1 --description "My Smart Contract" --author "Simon Stone" --license Apache-2.0

If you are running the contract generator non-interactively, you will also need to specify the contractType (either default or private) and the asset command line options, in addition to the above options. Please note that if you decide on generating a contract which makes use of private data, you will also need to specify the mspId as a command line option. For example:

yo fabric:contract -- --contractType private --mspId Org1MSP --language javascript --name my-smart-contract --version 0.0.1 --description "My Smart Contract" --author "Simon Stone" --license Apache-2.0 --asset "MyPrivateAsset"

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.