Skip to content

Commit

Permalink
[FAB-10198] Update system chaincode documentation
Browse files Browse the repository at this point in the history
Change-Id: I60d1d3c9442167ad5cfe8723bdf11ebabc887e6a
Signed-off-by: joe-alewine <Joe.Alewine@ibm.com>
  • Loading branch information
joe-alewine authored and joe-alewine committed May 21, 2018
1 parent ea2296d commit ec0159a
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions docs/source/systemchaincode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ System chaincodes are specialized chaincodes that run as part of the peer proces
as opposed to user chaincodes that run in separate docker containers. As
such they have more access to resources in the peer and can be used for
implementing features that are difficult or impossible to be implemented through
user chaincodes. Examples of System Chaincodes are ESCC (Endorser System Chaincode)
for endorsing proposals, QSCC (Query System Chaincode) for ledger and other
fabric related queries and VSCC (Validation System Chaincode) for validating
a transaction at commit time respectively.
user chaincodes. Examples of System Chaincodes include QSCC (Query System Chaincode)
for ledger and other fabric related queries, CSCC (Configuration System Chaincode)
which helps regulate access control, and LSCC (Lifecycle System Chaincode).

Unlike a user chaincode, a system chaincode is not installed and instantiated
using proposals from SDKs or CLI. It is registered and deployed by the peer at start-up.
using proposals from SDKs or CLI. It is registered and deployed by the peer at
start-up.

System chaincodes can be linked to a peer in two ways: statically and dynamically
System chaincodes can be linked to a peer in two ways: statically and dynamically,
using Go plugins. This tutorial will outline how to develop and load system chaincodes
as plugins.

Expand All @@ -27,21 +27,22 @@ A plugin includes a main package with exported symbols and is built with the com
``go build -buildmode=plugin``.

Every system chaincode must implement the `Chaincode Interface <https://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#Chaincode>`_
and export a constructor method that matches the signature ``func New() shim.Chaincode`` in the main package.
An example can be found in the repository at ``examples/plugin/scc``.
and export a constructor method that matches the signature ``func New() shim.Chaincode``
in the main package. An example can be found in the repository at ``examples/plugin/scc``.

Existing chaincodes such as the QSCC can also serve as templates for certain
features - such as access control - that are typically implemented through system chaincodes.
The existing system chaincodes also serve as a reference for best-practices on
things like logging and testing.
features --- such as access control --- that are typically implemented through
system chaincodes. The existing system chaincodes also serve as a reference for
best-practices on things like logging and testing.

.. note:: On imported packages: the Go standard library requires that a plugin must
include the same version of imported packages as the host application (fabric, in this case)
include the same version of imported packages as the host application
(Fabric, in this case).

Configuring Plugins
-------------------

Plugins are configured in the ``chaincode.systemPlugin`` section in *core.yaml*:
Plugins are configured in the ``chaincode.systemPlugin`` section in ```core.yaml``:

.. code-block:: bash
Expand All @@ -54,7 +55,8 @@ Plugins are configured in the ``chaincode.systemPlugin`` section in *core.yaml*:
invokableCC2CC: true
A system chaincode must also be whitelisted in the ``chaincode.system`` section in *core.yaml*:
A system chaincode must also be whitelisted in the ``chaincode.system`` section
in ``core.yaml``:

.. code-block:: bash
Expand Down

0 comments on commit ec0159a

Please sign in to comment.