Skip to content

Commit

Permalink
FABN-1526: Home page to allow access to v1.4 and v2.0 docs (#195)
Browse files Browse the repository at this point in the history
- Some tidy-up of the v2.0 documentation index for clarity based on the v2.0 release content.
- Reference migration tutorial from fabric-network module overview.
- Brief description of event listeners in fabric-network module overview.

Signed-off-by: Mark S. Lewis <[email protected]>
  • Loading branch information
bestbeforetoday authored Mar 26, 2020
1 parent ac8c787 commit 8c9f8e1
Show file tree
Hide file tree
Showing 7 changed files with 649 additions and 68 deletions.
82 changes: 48 additions & 34 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,32 @@

The Hyperledger Fabric SDK for Node.js provides a powerful API to interact with a Hyperledger Fabric blockchain. The SDK is designed to be used in the Node.js JavaScript runtime.


### Overview

Hyperledger Fabric is the operating system of an enterprise-strength permissioned blockchain network. For a high-level overview of the fabric, visit [http://hyperledger-fabric.readthedocs.io/en/latest/](http://hyperledger-fabric.readthedocs.io/en/latest/).

Applications can be developed to interact with the blockchain network on behalf of the users. APIs are available to:
* invoke transactions by calling the chaincode
* receive events based on new blocks added to the ledger
* invoke transactions by calling the chaincode.
* receive events based on new blocks added to the ledger.


### How Different Components of the Fabric Work Together

The [Transaction Flow](http://hyperledger-fabric.readthedocs.io/en/latest/txflow.html) document provides an excellent description of the application/SDK, peers, and orderers working together to process transactions and producing blocks.

Security on the Fabric is enforced with digital signatures. All requests made to the fabric must be signed by users with appropriate enrollment certificates. For a user's enrollment certificate to be considered valid on the Fabric, it must be signed by a trusted Certificate Authority (CA). Fabric supports any standard CAs. In addition, Fabric provides a CA server. See this [overview](http://hyperledger-fabric-ca.readthedocs.io/en/latest/users-guide.html#overview).

### Features of the SDK for Node.js
The Hyperledger Fabric SDK for Node.js is designed in an Object-Oriented programming style. Its modular construction enables application developers to plug in alternative implementations of crypto suites and handling endorsements.

The SDK's list of features include:
* [**fabric-network**]{@link module:fabric-network} (the recommended API for):
* [Submitting transactions]{@link module:fabric-network.Transaction} to a smart contract.
* [Querying]{@link module:fabric-network.Transaction#evaluate} a smart contract for the latest application state.


* **fabric-common**:
* submitting a transaction
* query a chaincode for the latest application state
* monitoring events:
* connect to a peer's event stream
* listen on block events
* listen on transactions events and find out if the transaction was successfully committed to the ledger or marked invalid
* listen on custom events produced by chaincodes
* hierarchical configuration settings with multiple layers of overrides: files, environment variable, program arguments, in-memory settings
* logging utility with a built-in logger (winston) and can be overriden with a number of popular loggers including log4js and bunyan
* pluggable interface describe the cryptographic operations required for successful interactions with the Fabric. Two implementations are provided out of box:
* [Software-based ECDSA]{@link CryptoSuite_ECDSA_AES}
* [PKCS#11-compliant ECDSA]{@link CryptoSuite_PKCS11}
### Features of the SDK for Node.js

The Hyperledger Fabric SDK for Node.js is designed in an Object-Oriented programming style. Its modular construction enables application developers to plug in alternative implementations for handling transaction commit events, transaction evaluation (query), and other behaviors.

* **fabric-ca-client**:
* [register]{@link FabricCAServices#register} a new user
* [enroll]{@link FabricCAServices#enroll} a user to obtain the enrollment certificate signed by the Fabric CA
* [revoke]{@link FabricCAServices#revoke} an existing user by enrollment ID or revoke a specific certificate
* [customizable persistence store]{@link FabricCAServices}
The SDK is composed of several modules:
* [**fabric-network**]{@link module:fabric-network}: Provides high level APIs for client applications to interact with smart contracts (chaincode), and is the recommended API for building client applications.
* **fabric-ca-client**: Provides APIs to interact with the optional Certificate Authority component, fabric-ca, that contains services for membership management.
* **fabric-common**: A low-level API, used to implement _fabric-network_ capability, that provides APIs to interact with the core components of a Hyperledger Fabric network, namely the peers, orderers and event streams.

### API Reference
The SDK is made up of modules that can be accessed through the navigation menu **Modules**:
* [**fabric-network**]{@link module:fabric-network}: Provides high level APIs for client applications to submit transactions and evaluate queries for a smart contract (chaincode).
* **api**: Pluggable APIs for application developers to supply alternative implementations of key interfaces used by the SDK. For each interface there are built-in default implementations.
* **fabric-common**: Provides APIs to interact with the core components of a Hyperledger Fabric network, namely the peers, orderers and event streams.
* **fabric-ca-client**: Provides APIs to interact with the optional component, fabric-ca, that contains services for membership management.

### Compatibility

Expand All @@ -61,4 +39,40 @@ The following tables show versions of Fabric, Node and other dependencies that a
| **Platform** | Ubuntu 18.04 | |


### API reference

This section provides more detail on the capabilities provided by each of the modules that make up the Hyperledger Fabric SDK for Node.js.

#### fabric-network

This is the recommended API for client application to use for:
* [Submitting transactions]{@link module:fabric-network.Contract} to a smart contract.
* [Querying]{@link module:fabric-network.Contract#evaluateTransaction} a smart contract for the latest application state.
* Listening for and replay of both [smart contract events]{@link module:fabric-network.Contract} and [block events]{@link module:fabric-network.Network}, with easy access to related transaction information.

#### fabric-ca-client

Provides the following capabilities for interacting with the Certificate Authority to manage user identities:
* [register]{@link FabricCAServices#register} a new user.
* [enroll]{@link FabricCAServices#enroll} a user to obtain the enrollment certificate signed by the Fabric CA.
* [revoke]{@link FabricCAServices#revoke} an existing user by enrollment ID or revoke a specific certificate
* [customizable persistence store]{@link FabricCAServices}.

#### fabric-common

Provides the following capabilities and for use in the implementation of the _fabric-network_ API:
* Submitting transactions.
* querying chaincode for the latest application state.
* monitoring events:
* connect to a peer's event stream
* listen on block events
* listen on transactions events and find out if the transaction was successfully committed to the ledger or marked invalid.
* listen on custom events produced by chaincodes.
* hierarchical configuration settings with multiple layers of overrides: files, environment variable, program arguments, in-memory settings
* logging utility with a built-in logger (winston) and can be overridden with a number of popular loggers including log4js and bunyan
* pluggable interface describe the cryptographic operations required for successful interactions with the Fabric. Two implementations are provided out of box:
* [Software-based ECDSA]{@link CryptoSuite_ECDSA_AES}
* [PKCS#11-compliant ECDSA]{@link CryptoSuite_PKCS11}


<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
2 changes: 1 addition & 1 deletion docs/jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"destination": "docs/gen"
},
"templates": {
"systemName": "Hyperledger Fabric SDK for node.js",
"systemName": "Hyperledger Fabric SDK for Node.js",
"theme": "cosmo"
}
}
16 changes: 0 additions & 16 deletions docs/redirectTemplates/index.html

This file was deleted.

25 changes: 25 additions & 0 deletions docs/redirectTemplates/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Hyperledger Fabric SDK for Node.js

The Hyperledger Fabric SDK allows applications to interact with a Fabric blockchain network. It provides a simple API to submit transactions to a ledger or query the contents of a ledger with minimal code.

The SDK implements the Fabric programming model as described in the [Developing Applications](https://hyperledger-fabric.readthedocs.io/en/latest/developapps/developing_applications.html) chapter of the Fabric documentation.


## Documentation

Full documentation is published for each of the following versions:
- [2.0](https://hyperledger.github.io/fabric-sdk-node/master/module-fabric-network.html)
- [1.4](https://hyperledger.github.io/fabric-sdk-node/release-1.4/module-fabric-network.html)


## Install

The client API is published to the npm registry in the [fabric-network](https://www.npmjs.com/package/fabric-network) package.

```sh
npm install fabric-network
```

## Samples

Sample Node.js client applications can be found in the _Commercial Paper_ sample within the [fabric-samples repository](https://github.com/hyperledger/fabric-samples).
6 changes: 3 additions & 3 deletions fabric-network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

SDK for writing node.js applications to interact with [Hyperledger Fabric](http://hyperledger-fabric.readthedocs.io/en/latest/).

This package encapsulates the APIs to connect to a Fabric network, submit transactions and perform queries against the ledger.
This package encapsulates the APIs to connect to a Fabric network, submit transactions and perform queries against the ledger, and listen for or replay events.

Additional packages are also provided:
1. `fabric-ca-client`, to interact with the fabric-ca to manage user certificates.
2. `fabric-common`, encapsulates the common code used by all fabric-sdk-node packages supporting fine grain interactions with the Fabric network to send transaction invocations
3. `fabric-protos`, encapsulates the Protocol Buffer files and generated JavaScript classes for Hyperledger Fabric
2. `fabric-common`, encapsulates the common code used by all fabric-sdk-node packages supporting fine grain interactions with the Fabric network to send transaction invocations.
3. `fabric-protos`, encapsulates the Protocol Buffer files and generated JavaScript classes for Hyperledger Fabric.

For application developer documentations, please visit [hyperledger.github.io/fabric-sdk-node/](https://hyperledger.github.io/fabric-sdk-node/)

Expand Down
18 changes: 12 additions & 6 deletions fabric-network/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
* client applications to interact with smart contracts deployed to a Hyperledger Fabric blockchain network.</p>
*
* <p>Note that administrative capabilities, such as installing and starting smart contracts, are not currently provided
* by this API. For these tasks or other specific advanced usage, the lower level <em>fabric-common</em> API
* should be used. Access to related <em>fabric-common</em> objects is provided through the <em>fabric-network</em>
* API objects.</p>
* by this API. For only specific advanced usage, the lower level <em>fabric-common</em> API can be used. Access to
* related <em>fabric-common</em> objects is provided through the <em>fabric-network</em> API objects.</p>
*
* [TypeScript]{@link http://www.typescriptlang.org/} definitions are included in this module.
* <p>If migrating a client application from an earlier version of the API, consult the
* [migration tutorial]{@tutorial migration} for details of potentially breaking changes and recommended actions.</p>
*
* <p>[TypeScript]{@link http://www.typescriptlang.org/} definitions are included in this module.</p>
*
* <h3>Getting started</h3>
*
Expand All @@ -25,12 +27,16 @@
* [Networks]{@link module:fabric-network.Network} (channels) for which that peer is a member. This in turn
* provides access to Smart [Contracts]{@link module:fabric-network.Contract} (chaincode) running within that
* blockchain network, and to which [Transactions]{@link module:fabric-network.Transaction} can be
* [submitted]{@link module:fabric-network.Transaction#submit} or queries can be
* [evaluated]{@link module:fabric-network.Transaction#evaluate}.</p>
* [submitted]{@link module:fabric-network.Contract#submitTransaction} or queries can be
* [evaluated]{@link module:fabric-network.Contract#evaluateTransaction}.</p>
*
* <p>Private data can be submitted to transactions as [transient]{@link module:fabric-network.Transaction#setTransient}
* data to prevent it from being recorded on the ledger.</p>
*
* Client applications can initiate actions or business processes in response to events emitted by smart contract
* transactions using [smart contract event listeners]{@link module:fabric-network.Contract}. All updates to the ledger
* can be observed using [block event listeners]{@link module:fabric-network.Network}.
*
* @example
* // Obtain the smart contract with which our application wants to interact
* const wallet = await Wallets.newFileSystemWallet(walletDirectoryPath);
Expand Down
Loading

0 comments on commit 8c9f8e1

Please sign in to comment.