Skip to content

Commit ee5b85c

Browse files
committed
cleanup v0.6 release page
fixed formatting and code snippets [ci skip] Change-Id: Ic4783ac4c70a64f404fc69076514735c329260bd Signed-off-by: Nick Gaski <[email protected]>
1 parent b50db2b commit ee5b85c

File tree

1 file changed

+30
-32
lines changed

1 file changed

+30
-32
lines changed

docs/v0.6_migration.md

+30-32
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ v0.6.1-preview release, and outlines the changes you will need to make to
33
successfully migrate code originally written for the v0.5-developer-preview
44
release that you now wish to run on fabric v0.6.1-preview.
55

6-
# Migrating chaincode to fabric v0.6.1-preview
6+
## Migrating chaincode to fabric v0.6.1-preview
77

8-
* The chaincode shim interface changes for compatibility with the latest
8+
__1.__ The chaincode shim interface changes for compatibility with the latest
99
Hyperledger shim:
1010

1111
The chaincode interface has changed from `shim.ChaincodeStub` to
@@ -16,13 +16,14 @@ highlight this alteration.
1616

1717
This change applies to all transaction types: Deploy, Invoke, and Query.
1818

19-
```go
19+
```go
20+
2021
func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStub, function string, args []string) ([]byte, error) {
2122

2223
func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
2324
```
2425
25-
* Chaincode calling chaincode is included in the shim package.
26+
__2.__ Chaincode calling chaincode is included in the shim package.
2627
2728
There are two functions available - **InvokeChaincode** and **QueryChaincode**.
2829
First, these functions no longer accept the function name as a parameter;
@@ -32,19 +33,19 @@ your strings to a byte array.
3233
3334
The following code snippets from chaincode_example04 demonstrate the difference.
3435
Make note of `f`, representing the function invoke. It is removed from the
35-
InvokeChaincode parameters, and instead passed as an argument to the invokeArgs
36+
**InvokeChaincode** parameters, and instead passed as an argument to the **invokeArgs**
3637
element. The arguments are then converted to a byte array before being passed
37-
to InvokeChaincode. This change is not optional and must be implemented in
38+
to **InvokeChaincode**. This change is not optional and must be implemented in
3839
your code.
3940
40-
```go
41+
```go
4142
// fabric v0.5-developer-preview
4243
f := "invoke"
4344
invokeArgs := []string{"a", "b", "10"}
4445
response, err := stub.InvokeChaincode(chainCodeToCall, f, invokeArgs)
4546
```
4647
47-
```go
48+
```go
4849
// fabric v0.6.1-preview code
4950
f := "invoke"
5051
// function is removed from InvokeChaincode, now passed as an argument within
@@ -53,7 +54,7 @@ invokeArgs := util.ToChaincodeArgs(f, "a", "b", "10")
5354
response, err := stub.InvokeChaincode(chainCodeToCall, invokeArgs)
5455
```
5556
56-
* Chaincode APIs have changed when constructing REST API payloads and CLI
57+
__3.__ Chaincode APIs have changed when constructing REST API payloads and CLI
5758
commands.
5859
5960
The function can now be passed within the "args" element as the
@@ -105,9 +106,9 @@ peer chaincode invoke -1 golang -n mycc -c '{"Args": ["invoke", "a", "b", "10"]}
105106
with fabric v0.6.1-preview. However, when using the Java SDK you must implement
106107
the new format, where the function is passed within the "args" element.
107108
108-
# New Features
109+
## New Features
109110
110-
1. Custom Events & Event handler:
111+
__1.__ Custom Events & Event handler:
111112
112113
The fabric now has the ability to create custom events and emit this information
113114
to a client-side node application leveraging the hfc SDK. This is done by
@@ -119,7 +120,7 @@ sent. In the example, only the invoke transaction type is coded to send outgoing
119120
events. See the following code snippet in eventsender.go which demonstrates
120121
invocations being broadcast by the event sender:
121122
122-
```go
123+
```go
123124
func (t *EventSender) Invoke(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
124125
b, err := stub.GetState("noevents")
125126
if err != nil {
@@ -148,7 +149,7 @@ func (t *EventSender) Invoke(stub shim.ChaincodeStubInterface, function string,
148149
149150
Enable the event service in your node program with the following steps:
150151
151-
```go
152+
```go
152153
// set the port where the event service will listen
153154
chain.eventHubConnect("localhost:7053");
154155

@@ -174,35 +175,32 @@ process.on('exit', function() {
174175
Explore the full library of the [sample event application](https://github.com/ratnakar-asara/NodeSDKSample/tree/master/events)
175176
for the application source code and deeper documentation.
176177
177-
1. Java chaincode shim - new shim library to support java chaincode interacting
178+
__2.__ Java chaincode shim - new shim library to support java chaincode interacting
178179
with Hyperledger fabric. See the [java shim](fabric/core/chaincode/shim/java)
179180
library for the source code.
180181
181-
1. Ability to call chaincode using a 64encoded string. A custom UnmarshalJSON
182+
__3.__ Ability to call chaincode using a 64encoded string. A custom UnmarshalJSON
182183
method for ChaincodeInput allows for string-based REST/JSON input, which is then
183184
converted to []byte-based. This allows browsers to pass in string or binary
184185
arguments to the application driving the chaincode.
185186
186-
1. Docker client upgrade to [Docker 1.12](https://blog.docker.com/2016/07/docker-built-in-orchestration-ready-for-production-docker-1-12-goes-ga/).
187+
__4.__ Docker client upgrade to [Docker 1.12](https://blog.docker.com/2016/07/docker-built-in-orchestration-ready-for-production-docker-1-12-goes-ga/)
187188
188-
1. Peer and Member Service images available on [Hyperledger Dockerhub](https://hub.docker.com/r/hyperledger/). The images are part of the
189-
continuous integration process and built with every new code change.
189+
__5.__ `fabric-peer` and `fabric-membersrvc` images for multiple platforms are available on [Hyperledger Dockerhub](https://hub.docker.com/r/hyperledger/). The images are part of the continuous integration process and built with every new code change.
190190
191-
1. New warnings for chaincode development. The following practices can lead to
191+
__6.__ New warnings for chaincode development. The following practices can lead to
192192
malfunctioning and/or non-deterministic chaincode and should be avoided:
193193
194-
* Iterating using GetRows
195-
* Using associative arrays with iteration (the order is randomized in Go)
196-
* Reading list of items from KVS table (the order is not guaranteed). Use ordering
197-
* Writing thread-unsafe chaincode where invoke and query may be called in parallel
198-
* Substituting global memory or cache storage for ledger state variables in the chaincode
199-
* Accessing external services (e.g. databases) directly from the chaincode
200-
* Using libraries or globabl variables that could introduce non-determinism (e.g. "random" or "time")
201-
202-
1. For templates of deterministic and properly-written chaincode, see the [examples](fabric/examples/chaincode) library. This directory contains samples
203-
written in Go and Java.
194+
- Iterating using GetRows
195+
- Using associative arrays with iteration (the order is randomized in Go)
196+
- Reading list of items from KVS table (the order is not guaranteed). Use ordering
197+
- Writing thread-unsafe chaincode where invoke and query may be called in parallel
198+
- Substituting global memory or cache storage for ledger state variables in the chaincode
199+
- Accessing external services (e.g. databases) directly from the chaincode
200+
- Using libraries or globabl variables that could introduce non-determinism (e.g. "random" or "time")
201+
- For templates of deterministic and properly-written chaincode, see the [examples](fabric/examples/chaincode) library. This directory contains samples written in Go and Java.
204202
205-
1. Fabric Starter Kit - This section describes how to set up a self-contained
203+
__7.__ Fabric Starter Kit - This section describes how to set up a self-contained
206204
environment for application development with the Hyperledger fabric. The setup
207205
uses **Docker** to provide a controlled environment with all the necessary
208206
Hyperledger fabric components to support a Node.js application built with
@@ -213,13 +211,13 @@ network environment. There is an image to run a single `peer`, one to run
213211
the `membersrvc`, and one to run both your Node.js application and your
214212
chaincode.
215213
216-
1. [Fabric boilerplate](https://github.com/IBM-Blockchain/fabric-boilerplate) -
214+
__8.__ [Fabric boilerplate](https://github.com/IBM-Blockchain/fabric-boilerplate) -
217215
The public IBM-Blockchain repo now contains a boilerplate application to help
218216
application developers quickly create a network and deploy and app. The network
219217
can be spun up locally using Docker containers or through a Bluemix instance of
220218
the blockchain service.
221219
222-
1. Fabric v0.6 provides the ability to dynamically register and enroll users
220+
__9.__ Fabric v0.6 provides the ability to dynamically register and enroll users
223221
with attributes through the hfc SDK.
224222
See [asset-mgmt-with-dynamic-roles.js](fabric/sdk/node/test/unit/asset-mgmt-with-dynamic-roles.js)
225223
as an example. The hfc SDK previously allowed you to dynamically enroll users,

0 commit comments

Comments
 (0)