Commit 65730c88 authored by Christopher Ferris's avatar Christopher Ferris
Browse files

FAB-5474 add links to godoc resources



Change-Id: I13af4e7452cac28d0708ab4ba996af05f3fc8614
Signed-off-by: default avatarChristopher Ferris <chrisfer@us.ibm.com>
parent e7b20bd3
......@@ -24,7 +24,7 @@ Chaincode API
-------------
Every chaincode program must implement the
`Chaincode interface <https://github.com/hyperledger/fabric/blob/master/core/chaincode/shim/interfaces.go#L28>`_
`Chaincode interface <http://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#Chaincode>`_
whose methods are called in response to received transactions.
In particular the ``Init`` method is called when a
chaincode receives an ``instantiate`` or ``upgrade`` transaction so that the
......@@ -33,7 +33,7 @@ application state. The ``Invoke`` method is called in response to receiving an
``invoke`` transaction to process transaction proposals.
The other interface in the chaincode "shim" APIs is the
`ChaincodeStubInterface <https://github.com/hyperledger/fabric/blob/master/core/chaincode/shim/interfaces.go#L42>`_
`ChaincodeStubInterface <http://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#ChaincodeStub>`_
which is used to access and modify the ledger, and to make invocations between
chaincodes.
......@@ -72,10 +72,11 @@ Housekeeping
^^^^^^^^^^^^
First, let's start with some housekeeping. As with every chaincode, it implements the
`Chaincode interface` <https://github.com/hyperledger/fabric/blob/master/core/chaincode/shim/interfaces.go#L28>_,
`Chaincode interface <http://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#Chaincode>`_
in particular, ``Init`` and ``Invoke`` functions. So, let's add the go import
statements for the necessary dependencies for our chaincode. We'll import the
chaincode shim package and the peer protobuf package.
chaincode shim package and the
`peer protobuf package <http://godoc.org/github.com/hyperledger/fabric/protos/peer>`_.
.. code:: go
......@@ -106,8 +107,8 @@ Next, we'll implement the ``Init`` function.
no "migration" or nothing to be initialized as part of the upgrade.
Next, we'll retrieve the arguments to the ``Init`` call using the
``ChaincodeStubInterface.GetStringArgs`` function and check for validity.
In our case, we are expecting a key-value pair.
`ChaincodeStubInterface.GetStringArgs <http://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#ChaincodeStub.GetStringArgs>`_
function and check for validity. In our case, we are expecting a key-value pair.
.. code:: go
......@@ -125,9 +126,9 @@ In our case, we are expecting a key-value pair.
Next, now that we have established that the call is valid, we'll store the
initial state in the ledger. To do this, we will call
``ChaincodeStubInterface.PutState`` with the key and value passed in as
the arguments. Assuming all went well, return a peer.Response object that
indicates the initialization was a success.
`ChaincodeStubInterface.PutState <http://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#ChaincodeStub.PutState>`_
with the key and value passed in as the arguments. Assuming all went well,
return a peer.Response object that indicates the initialization was a success.
.. code:: go
......@@ -171,8 +172,9 @@ As with the ``Init`` function above, we need to extract the arguments from the
name of the chaincode application function to invoke. In our case, our application
will simply have two functions: ``set`` and ``get``, that allow the value of an
asset to be set or its current state to be retrieved. We first call
``ChaincodeStubInterface.GetFunctionAndParameters`` to extract the function
name and the parameters to that chaincode application function.
`ChaincodeStubInterface.GetFunctionAndParameters <http://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#ChaincodeStub.GetFunctionAndParameters>`_
to extract the function name and the parameters to that chaincode application
function.
.. code:: go
......@@ -220,7 +222,8 @@ Implementing the Chaincode Application
As noted, our chaincode application implements two functions that can be
invoked via the ``Invoke`` function. Let's implement those functions now.
Note that as we mentioned above, to access the ledger's state, we will leverage
the ``ChaincodeStubInterface.PutState`` and ``ChaincodeStubInterface.GetState``
the `ChaincodeStubInterface.PutState <http://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#ChaincodeStub.PutState>`_
and `ChaincodeStubInterface.GetState <http://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#ChaincodeStub.GetState>`_
functions of the chaincode shim API.
.. code:: go
......@@ -261,7 +264,8 @@ Pulling it All Together
^^^^^^^^^^^^^^^^^^^^^^^
Finally, we need to add the ``main`` function, which will call the
``shim.Start`` function. Here's the whole chaincode program source.
`shim.Start <http://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#Start>`_
function. Here's the whole chaincode program source.
.. code:: go
......
......@@ -11,6 +11,7 @@ Hyperledger Fabric.
Install Binaries and Docker Images
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
While we work on developing real installers for the Hyperledger Fabric
binaries, we provide a script that will :ref:`binaries` to your system.
The script also will download the Docker images to your local registry.
......@@ -22,6 +23,33 @@ We offer a set of sample applications that you may wish to install these
:doc:`samples` before starting with the tutorials as the tutorials leverage
the sample code.
API Documentation
^^^^^^^^^^^^^^^^^
The API documentation for Hyperledger Fabric's Golang APIs can be found on
the godoc site for `Fabric <http://godoc.org/github.com/hyperledger/fabric>`_.
If you plan on doing any development using these APIs, you may want to
bookmark those links now.
Hyperledger Fabric SDKs
^^^^^^^^^^^^^^^^^^^^^^^
Hyperledger Fabric intends to offer a number of SDKs for a wide variety of
programming languages. The first two delivered SDKs are the Node.js and Java
SDKs. We hope to provide Python and Go SDKs soon after the 1.0.0 release.
* `Hyperledger Fabric Node SDK documentation <https://fabric-sdk-node.github.io/>`__.
* `Hyperledger Fabric Java SDK documentation <https://github.com/hyperledger/fabric-sdk-java>`__.
Hyperledger Fabric CA
^^^^^^^^^^^^^^^^^^^^^
Hyperledger Fabric provides an optional
`certificate authority service <http://hyperledger-fabric-ca.readthedocs.io/en/latest>`_
that you may choose to use to generate the certificates and key material
to configure and manage identity in your blockchain network. However, any CA
that can generate ECDSA certificates may be used.
Tutorials
^^^^^^^^^
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment