Create a Business Network Definition
A business network definition has the following layout:
models/ (optional) lib/ permissions.acl (optional) package.json README.md (optional)
The easiest way to create a new business network definition is to either
git clone an example, or to use the Hyperledger Composer Yeoman generator to create a skeleton business network.
A description of the purpose of the business network using the Markdown mark-up language.
A Business Network Definition has a name (limited to basic ASCII alphanumeric characters and
-), a human-readable description and a version number. The version number for the network should take the form Major.Minor.Micro and
Semantic Versioning principles should be used when incrementing the version number.
The identifier of the network is formed from its name, the
- character and its version number. A valid identifier (and example) is therefore
The metadata for a business network definition is read from
package.json, meaning that business network definitions may also be valid
The set of domain models for a business network definition define the types that are valid within the network and outside the network when it is integrated with external systems (for example systems that submit transactions to the network).
A domain model may either be packaged within the business network definition (typically stored under the
models directory), or may be declared in
package.json as an external dependency. You refer to models via an npm dependency if you wanted to share them across business network definitions.
The scripts for a business network definition are typically stored under the
The permissions for the business network expressed are expressed in an optional
Cloning an Example Business Network Definition
The sample business network definitions are stored on GitHub at
https://github.com/hyperledger/composer-sample-networks. You can
git clone this repository to pull down all the sample networks. Each sample network is stored under the
Generating a Business Network Definition
Welcome to the Hyperledger Composer Skeleton Application Generator ? Please select the type of Application: (Use arrow keys) ❯ CLI Application Angular 2 Application Skeleton Business Network
Skeleton Business Netork
- Answer all of the questions
? Please select the type of Application: Skeleton Business Network You can run this generator using: 'yo hyperledger-composer:businessnetwork' Welcome to the business network skeleton generator ? Do you only want to generate a model? Yes ? What is the business network's name? mynetwork ? What is the business network's namespace? org.example ? Describe the business network This is my test network ? Who is the author? Dan Selman ? Which license do you want to use? Apache-2 create index.js create package.json create README.md create models/org.example.cto create .eslintrc.yml
This generates a skeleton business network with an
transaction defined, as well as a
mocha unit test.
Also included, is a 'best practice' eslint config file which defines sample linting rules for JS code.