How to set up your Hyperledger Fabric chain for use on Proof

Tai Kersten
Think Consortium on Blockchain
4 min readDec 9, 2016

Hyperledger is a private chain so there is some prior configuration and set up to be done in order to use Hyperledger Fabric with the platform.

1. Make sure to set up an IBM Bluemix account. The first 30 days are free and getting everything set up is painless. You will also need to provide payment data.

2. After verifying and signing in, set your region and create a ‘space’. After this find the Blockchain service in the Bluemix console. Click on the three lines to bring up the sliding menu, navigate to ‘Services’ and then click on ‘Application Services’. The service you want will be labeled ‘Blockchain’.

3. Next Deploy an HyperLedger Fabric chain by clicking on the option. Click on the blue ‘create’ button in the lower right-hand portion of the screen. You may have to wait for a moment before it works but after it finishes navigate to the dashboard by clicking the large blue button in the center of the screen called ‘Launch Dashboard’. Congratulations, you now have a cluster ofHyperledger Fabric nodes at your disposal.

4. Now, we need to begin setting up 2 things before Proof can interact with your console: The first of the two is your membership services registration. This can be done by clicking on the ‘API’s’ button on the left side of the screen. From here, you will ‘register a user’ through the API Console. Similarly, if you are more comfortable running things from the terminal, you can CURL requests to any validator node and accomplish the same tasks. After reaching the API console, expand the header entitled “Network Enroll ID’s”. A list with pre-generated and assigned user names and user secrets will appear.

5. Select a secret/name pair from the list and copy and paste the data to your clipboard. After this navigate down to the section entitled ‘Registrar’ and expand the section. Now, expand the section with the terms POST ‘/registrar’ on it. From here follow the directions for registering a user.

After successfully building the json, click ‘Try it out!”. You should see the following message down below (You may have to scroll).

6. Now that the user of your choosing has been registered, you can begin getting ready to muster some chaincode. First. write some chaincode… if you are not familiar with go or chaincode, I recommend the tutorial and if you are more of the jump-into-the-deep-end type, take one of the marbles or supply chain tutorials and modify it for whatever token system you prefer.

Here’s an example.

7. After generating code, post it a git like the example above. This is where the chaincode deployment will be referenced by the deployment software on your node. After creating the chaincode and posting it on git, build a json payload for creating the contract. It will look something like this:

{
“jsonrpc”: “2.0”,
“method”: “deploy”,
“params”: {
“type”: 1,
“chaincodeID”: {
“path”: “<Path to your chaincode on git>”
},
“ctorMsg”: {
“function”: “init”,
“args”: [
“12345”
]
},
“secureContext”: “<user_id>”
},
“id”: 1
}

The path needs to be the url to a git that contains your chaincode.go file. Method denotes which chaincode method to use, in this case it’s init . In this case, deploy, which will create a block and place the chaincode into it.

8. After creating your payload and deploying some code to git, you need to submit your code to the bluemix api. Navigate to the ‘chaincode’ part of the API section. After clicking ‘Try it out!’ you will receive some json back that looks like:

{
"jsonrpc": "2.0"
"result": {
"status": "OK"
"message": "dfc74e1d2544612828ec99295946a9e352ce689668b0f5c9a4eb587b4858ca2812c0bddd171004b09acf9ea0c1d0f55ddd410ad5856a5189c291cc9cc957f018"
}
"id": 1
}

Save that ‘message’. It is your Chaincode ID which you will use when you post things on the Proof dashboard. For convenience, I also recommend saving and holding on to your user_id information that you saved from the Bluemix so you don’t need to log into bluemix every time you want to create or transfer an asset. Now you have the ability to post data to your private network on Proof Dashboard.

--

--