<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Crissi Mariam Robert on Medium]]></title>
        <description><![CDATA[Stories by Crissi Mariam Robert on Medium]]></description>
        <link>https://medium.com/@crissimrobert?source=rss-ef6f524dca94------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Crissi Mariam Robert on Medium</title>
            <link>https://medium.com/@crissimrobert?source=rss-ef6f524dca94------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:51:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@crissimrobert/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Removing Orderer from Hyperledger Fabric network]]></title>
            <link>https://medium.com/@crissimrobert/removing-orderer-from-hyperledger-fabric-network-595b857818ef?source=rss-ef6f524dca94------2</link>
            <guid isPermaLink="false">https://medium.com/p/595b857818ef</guid>
            <category><![CDATA[hyperledger-fabric]]></category>
            <category><![CDATA[hyperledger]]></category>
            <category><![CDATA[organization]]></category>
            <category><![CDATA[orderer]]></category>
            <category><![CDATA[raft]]></category>
            <dc:creator><![CDATA[Crissi Mariam Robert]]></dc:creator>
            <pubDate>Fri, 28 Jan 2022 08:25:53 GMT</pubDate>
            <atom:updated>2022-01-28T11:23:27.734Z</atom:updated>
            <content:encoded><![CDATA[<p>Raft-based ordering service becomes a better ordering service choice from the release 1.4.1. One of the requirements in the process is to keep the majority of ordering nodes (quorum) as running. There are some good posts addressing the orderer addition process. <br>Here I come up this article to give a more detail step-by-step illustration on the orderer removal process.</p><p>I am using v1.4.4 for this illustration.</p><p>As we know, RAFT orderers communicate to one another using the host and port properties of the Consenters section for the purpose of consensus messages. And the endpoints present in the OrdererAddresses section are used for replication of blocks.</p><p>So we have to remove the endpoint from the configuration block’s Orderer section , where orderers are meant to communicate with one another by looking at the endpoints in OrdererAddressessection.</p><p>Here I break it down the orderer removing process.</p><ol><li>Fetch the latest configuration block</li><li>Remove orderer end point from System Channel</li><li>Remove orderer end point from Application Channel</li><li>Remove orderer consenter from System Channel</li><li>Remove orderer consenter from Application Channel</li><li>Bring down orderer container</li></ol><p>We will make use of the first-network in the fabric-samples repository (v1.4.4) for the demo.</p><ol><li><strong><em>Set the environment for the orderer inside the </em></strong><strong><em>cli container</em></strong></li></ol><pre>export CORE_PEER_LOCALMSPID=OrdererMSP</pre><pre>export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/users/Admin@example.com/msp</pre><pre>export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem</pre><pre>export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem</pre><p><strong><em>2 . Fetch the latest configuration Block from Orderer</em></strong></p><pre>export CHANNEL_NAME = byfn-sys-channel</pre><pre>peer channel fetch config config_block.pb -o orderer.example.com:7050 -c $CHANNEL_NAME--tls --cafile $ORDERER_CA</pre><p><strong><em>3 . Import the latest </em></strong><strong><em>system-channel configuration. Decode it to JSON format.</em></strong></p><blockquote>Note :- Install the jq command-line tool for parsing JSON</blockquote><blockquote>apt-get -y update &amp;&amp; apt-get -y install jq</blockquote><p>Decoding config block to JSON as follows</p><pre>configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config &gt; config_remove.json</pre><p><strong><em>4. Edit the system channel configuration block’s </em></strong><strong><em>Consenters section to remove the TLS credentials for the orderer</em></strong></p><pre>jq&#39;del(.channel_group.groups.Orderer.values.ConsensusType.value.metadata.consenters[]|select(.host == <strong>&quot;orderer4.example.com&quot;</strong>))&#39; config_remove.json &gt; modified_config_remove.json</pre><p><strong><em>5. Encode the block, find delta, create channel update transaction, encode it as protobuf envelope for System channel(byfn-sys-channel).</em></strong></p><pre>export CHANNEL_NAME = byfn-sys-channel</pre><pre>configtxlator proto_encode --input config.json --type common.Config --output config.pb</pre><pre>configtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pb</pre><pre>configtxlator compute_update --channel_id $CHANNEL_NAME --original config.pb --updated modified_config.pb --output config_update.pb</pre><pre>configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate --output config_update.json</pre><pre>echo &#39;{&quot;payload&quot;:{&quot;header&quot;:{&quot;channel_header&quot;:{&quot;channel_id&quot;:&quot;&#39;$CHANNEL_NAME&#39;&quot;, &quot;type&quot;:2}},&quot;data&quot;:{&quot;config_update&quot;:&#39;$(cat $config_update.json)&#39;}}}&#39; | jq . &gt; ${config_update_in_envelope.json</pre><pre>configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope --output config_update_in_envelope.pb</pre><p><strong><em>6. Submit the Channel Update transaction for System Channel</em></strong></p><pre>export CHANNEL_NAME = byfn-sys-channel</pre><pre>peer channel update -f config_update_in_envelope.pb -c $CHANNEL_NAME -o orderer.example.com:7050 --tls true --cafile $ORDERER_CA</pre><p><strong><em>7. Create the Channel update transaction for Application Channel(mychannel)</em></strong></p><pre>export CHANNEL_NAME = mychannel</pre><pre>configtxlator proto_encode --input config.json --type common.Config --output config.pb</pre><pre>configtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pb</pre><pre>configtxlator compute_update --channel_id $CHANNEL_NAME --original config.pb --updated modified_config.pb --output config_update.pb</pre><pre>configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate --output config_update.json</pre><pre>echo &#39;{&quot;payload&quot;:{&quot;header&quot;:{&quot;channel_header&quot;:{&quot;channel_id&quot;:&quot;&#39;$CHANNEL_NAME&#39;&quot;, &quot;type&quot;:2}},&quot;data&quot;:{&quot;config_update&quot;:&#39;$(cat $config_update.json)&#39;}}}&#39; | jq . &gt; ${config_update_in_envelope.json</pre><pre>configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope --output config_update_in_envelope.pb</pre><p><strong><em>8. Submit the Channel Update transaction for Application Channel</em></strong></p><pre>export CHANNEL_NAME = mychannel</pre><pre>peer channel update -f config_update_in_envelope.pb -c $CHANNEL_NAME -o orderer.example.com:7050 --tls true --cafile $ORDERER_CA</pre><p><strong><em>9.Edit the system channel configuration block’s </em></strong><strong><em>OrdererAddresses section to remove the orderer organization endpoints.</em></strong></p><pre>jq&#39;del(.channel_group.values.OrdererAddresses.value.addresses[]|select(contains(&quot;orderer4.example.com&quot;)))&#39; config_remove.json &gt; modified_config_remove.json</pre><p><strong><em>10. Encode the block, find delta, create channel update transaction, encode it as protobuf envelope for System channel(byfn-sys-channel).</em></strong></p><pre>export CHANNEL_NAME = byfn-sys-channel</pre><pre>configtxlator proto_encode --input config.json --type common.Config --output config.pb</pre><pre>configtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pb</pre><pre>configtxlator compute_update --channel_id $CHANNEL_NAME --original config.pb --updated modified_config.pb --output config_update.pb</pre><pre>configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate --output config_update.json</pre><pre>echo &#39;{&quot;payload&quot;:{&quot;header&quot;:{&quot;channel_header&quot;:{&quot;channel_id&quot;:&quot;&#39;$CHANNEL_NAME&#39;&quot;, &quot;type&quot;:2}},&quot;data&quot;:{&quot;config_update&quot;:&#39;$(cat $config_update.json)&#39;}}}&#39; | jq . &gt; ${config_update_in_envelope.json</pre><pre>configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope --output config_update_in_envelope.pb</pre><p><strong><em>11. Submit the Channel Update transaction for System Channel</em></strong></p><pre>export CHANNEL_NAME = byfn-sys-channel</pre><pre>peer channel update -f config_update_in_envelope.pb -c $CHANNEL_NAME -o orderer.example.com:7050 --tls true --cafile $ORDERER_CA</pre><p><strong><em>12. Create the Channel update transaction for Application Channel(mychannel)</em></strong></p><pre>export CHANNEL_NAME = mychannel</pre><pre>configtxlator proto_encode --input config.json --type common.Config --output config.pb</pre><pre>configtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pb</pre><pre>configtxlator compute_update --channel_id $CHANNEL_NAME --original config.pb --updated modified_config.pb --output config_update.pb</pre><pre>configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate --output config_update.json</pre><pre>echo &#39;{&quot;payload&quot;:{&quot;header&quot;:{&quot;channel_header&quot;:{&quot;channel_id&quot;:&quot;&#39;$CHANNEL_NAME&#39;&quot;, &quot;type&quot;:2}},&quot;data&quot;:{&quot;config_update&quot;:&#39;$(cat $config_update.json)&#39;}}}&#39; | jq . &gt; ${config_update_in_envelope.json</pre><pre>configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope --output config_update_in_envelope.pb</pre><p><strong><em>13. Submit the Channel Update transaction for Application Channel(mychannel)</em></strong></p><pre>export CHANNEL_NAME = mychannel</pre><pre>peer channel update -f config_update_in_envelope.pb -c $CHANNEL_NAME -o orderer.example.com:7050 --tls true --cafile $ORDERER_CA</pre><p><strong><em>14. Bring down the Orderer container</em></strong></p><pre>export CHANNEL_NAME = byfn-sys-channel</pre><pre>docker-compose -f docker-compose-orderer6.yaml down</pre><p><strong><em>15. Check the Orderer logs</em></strong></p><p>We can verify the running orderer(orderer1) logs to confirm.</p><p>The logs will show the deactivation of orderer(orderer4) from the network.</p><pre>Deactivated node 4 who&#39;s endpoint is orderer4.example.com:7050 as it&#39;s removed from membership</pre><p>Now the orderer is also removed from the RAFT election.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=595b857818ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Updating the Channel Config to include Anchor Peer for an Organization]]></title>
            <link>https://medium.com/@crissimrobert/updating-the-channel-config-to-include-anchor-peer-for-an-organization-ac142c9ef9be?source=rss-ef6f524dca94------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac142c9ef9be</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[hyperledger-fabric]]></category>
            <category><![CDATA[hyperledger]]></category>
            <category><![CDATA[blockchain-application]]></category>
            <dc:creator><![CDATA[Crissi Mariam Robert]]></dc:creator>
            <pubDate>Mon, 03 Aug 2020 12:56:38 GMT</pubDate>
            <atom:updated>2020-08-03T14:03:57.249Z</atom:updated>
            <content:encoded><![CDATA[<p>This tutorial is for updating the channel config to include anchor peer for an organization using Hyperledger Fabric <em>v1.4</em>.</p><h4>Purpose of Anchor Peer</h4><p>Every organization in a channel has an anchor peer , where it is used to discover all peers belonging to the organizations in the channel. It can be defined as a peer node on a channel that all other peers can discover and communicate with.An org can have multiple anchor peers to prevent a single point of failure.</p><p><strong>Environment Setup</strong></p><p>We are using Hyperledger Fabric 1.4 for the setup. You have to download the fabric samples form Hyperledger Fabric official. Move into the first-network subdirectory within the fabric-samples directory.It is based on the <a href="https://hyperledger-fabric.readthedocs.io/en/release-1.4/build_network.html">Building Your First Network</a> (BYFN) tutorial in the fabric-samples directory.</p><p>Run the following command to clean up the previous environment.</p><pre>./byfn.sh down</pre><p>Now generate the default BYFN artifacts:</p><pre>./byfn.sh generate</pre><p>And launch the network making use of the scripted execution within the CLI container:</p><pre>./byfn.sh up</pre><p>To add Org3 into the network, run the following script.</p><pre>./eyfn.sh up</pre><p>The above script will generate Org3 crypto material , update and signed the channel config for adding the org3 into channel (mychannel) .</p><p>We have to update the configuration of application channel (mychannel) autogenerated by BYFN , to include Anchor Peer for ‘Org3’ to the network.</p><h4>Prepare the CLI Environment</h4><p>Do access the automatically created Docker container cli as :</p><pre>docker exec -it cli bash</pre><p>Export the ORDERER_CA and CHANNEL_NAME variables:</p><pre>export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem </pre><pre>export CHANNEL_NAME=mychannel</pre><p>Export the Org1 environment variables:</p><pre>export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp</pre><pre>export CORE_PEER_ADDRESS=peer0.org1.example.com:7051</pre><pre>export CORE_PEER_LOCALMSPID=&quot;Org1MSP&quot;</pre><pre>export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt</pre><p>We can also execute the following steps to update anchor peer directly from the Org3 CLI, where the environment variables are set for Org3.</p><h4>Fetch the Configuration</h4><p>Inside the CLI container , fetch the most recent config block for the channel, using the peer channel fetch command.</p><pre>peer channel fetch config config_block.pb -o orderer.example.com:7050 -c $CHANNEL_NAME --tls --cafile $ORDERER_CA</pre><p>By default, the peer channel fetch config command returns the most <strong>recent</strong> configuration block for the targeted channel (mychannel) .</p><h4>Convert the Configuration to JSON and Trim It Down</h4><p>By using the configtxlator tool , decode the channel configuration block into JSON format.</p><p>In order to strip away all of the headers, metadata, creator signatures which are irrelevant to the update can be accomplished by means of the jq tool:</p><pre>configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config &gt; config.json</pre><blockquote><strong>Note</strong></blockquote><blockquote>The update process makes use of the configuration translator tool — configtxlator. The tool which allows for the conversion between different equivalent data representations/formats (ie., between protobufs and JSON). The tool can also be used to compute a configuration update transaction based on the differences between two channel configurations.</blockquote><h4>Add the Org3 Anchor Peer</h4><p>We will be using the jq tool to append the anchor peer for Org3 configuration definition to the channel’s application groups field in config.json, and copy the output to modified_anchor_config.json.</p><pre>jq &#39;.channel_group.groups.Application.groups.Org3MSP.values += {&quot;AnchorPeers&quot;:{&quot;mod_policy&quot;: &quot;Admins&quot;,&quot;value&quot;:{&quot;anchor_peers&quot;: [{&quot;host&quot;: &quot;peer0.org3.example.com&quot;,&quot;port&quot;: 11051}]},&quot;version&quot;: &quot;0&quot;}}&#39; config.json &gt; modified_anchor_config.json</pre><blockquote><strong>Note</strong></blockquote><blockquote>Org3MSP in the channel’s application groups field is the name of the org we defined in configtx.yaml file.</blockquote><p>We have now two JSON files, one for the current channel configuration, config.json, and the other one for the updated channel configuration modified_anchor_config.json. Next we need to convert each of these back into protobuf format and calculate the delta between the two configurations.</p><p>Translate config.json back into protobuf format as config.pb.</p><pre>configtxlator proto_encode --input config.json --type common.Config --output config.pb</pre><p>Translate the modified_anchor_config.json into protobuf format as modified_anchor_config.pb</p><pre>configtxlator proto_encode --input modified_anchor_config.json --type common.Config --output modified_anchor_config.pb</pre><p>Calculate the delta between the two protobuf formatted configurations.</p><pre>configtxlator compute_update --channel_id $CHANNEL_NAME --original config.pb --updated modified_anchor_config.pb --output anchor_update.pb</pre><p>Now that we must wrap it in an envelope message so that it can be properly read &amp; signed by the orderer for the update. To do this we must first convert the protobuf back into a JSON that can be wrapped.</p><p>By using the configtxlator command convert anchor_update.pb into anchor_update.json .</p><pre>configtxlator proto_decode --input anchor_update.pb --type common.ConfigUpdate | jq . &gt; anchor_update.json</pre><p>Here we will wrap the update in an envelope message and outputting it to anchor_update_in_envelope.json.</p><pre>echo &#39;{&quot;payload&quot;:{&quot;header&quot;:{&quot;channel_header&quot;:{&quot;channel_id&quot;:&quot;mychannel&quot;, &quot;type&quot;:2}},&quot;data&quot;:{&quot;config_update&quot;:&#39;$(cat anchor_update.json)&#39;}}}&#39; | jq . &gt; anchor_update_in_envelope.json</pre><p>Now we need to convert the final json to a protobuf, so it can be properly signed and submitted to the orderer for the update.</p><pre>configtxlator proto_encode --input anchor_update_in_envelope.json --type common.Envelope --output anchor_update_in_envelope.pb</pre><h4>Sign and Submit the Config Update</h4><p>The anchor peer update is an update to Org3 , so we only need the signature of Org3 for the configuration update. If we are in the CLI container, update the enviornment variables for Org3 as follows.</p><p>Export the Org3 environment variables:</p><pre>export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp</pre><pre>export CORE_PEER_ADDRESS=peer0.org3.example.com:7051</pre><pre>export CORE_PEER_LOCALMSPID=&quot;Org3MSP&quot;</pre><pre>export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt</pre><p>We can also do the update from the Org3 CLI container , as it is already using the Org3 identity. Then we can use the peer channel update command as it will sign off as well as do the update on the channel as the Org3 admin before submitting it to the orderer.</p><pre>peer channel update -f anchor_update_in_envelope.pb -c $CHANNEL_NAME -o orderer.example.com:7050 --tls --cafile $ORDERER_CA</pre><p>The orderer receives the config update request and creates a block with the updated configuration. The peers will also process the configuration update as soon as it recives the block.</p><h4>Verify the channel update</h4><p>Get the the block height and confirm the updation process as follows:-</p><p>We can confirm the block height before and after the channel update transaction.</p><pre>peer channel getinfo -c mychannel</pre><h4>Configuration of Multiple Anchor Peers</h4><p>In order to avoid the single point of failure , we can have more than one anchor peer per organization. We are using multiple peer array as a configuration update instead of updating it with a single peer array.</p><p>Assume that we have generated one more peer for Org3 as “peer1.org3.example.com”.</p><p>Update the anchor peer array as follows for updating one more anchor peer into the Org3 configuration.</p><pre>[{&quot;host&quot;: &quot;peer0.org3.example.com&quot;,&quot;port&quot;: 11051},{&quot;host&quot;: &quot;peer1.org3.example.com&quot;,&quot;port&quot;: 12051}]</pre><p>The modified_anchor_config.json is updated as follows.</p><pre>jq &#39;.channel_group.groups.Application.groups.Org3MSP.values += {&quot;AnchorPeers&quot;:{&quot;mod_policy&quot;: &quot;Admins&quot;,&quot;value&quot;:{&quot;anchor_peers&quot;: [{&quot;host&quot;: &quot;peer0.org3.example.com&quot;,&quot;port&quot;: 11051},{&quot;host&quot;: &quot;peer1.org3.example.com&quot;,&quot;port&quot;: 12051}]},&quot;version&quot;: &quot;0&quot;}}&#39; config.json &gt; modified_anchor_config.json</pre><p>We can define any number of anchor peers per each organization.</p><h4>Anchor Peer Setup — Errors &amp; Solutions</h4><pre>Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel &#39;mychannel&#39;: error authorizing update: error validating DeltaSet: invalid mod_policy for element [Group]  /Channel/Application/Org3: mod_policy not set</pre><p>This error is due to the invalid name for the Org we mentioned in the channel’s application groups field .As mentioned use the name of the org we defined in the config.tx.yaml file.</p><pre>Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel &#39;mychannel&#39;: error authorizing update: error validating DeltaSet: policy for [Group]  /Channel/Application/Org3MSP not satisfied: signature set did not satisfy policy</pre><p>This error occur due the invalid signature on the peer channel update request. Since this is only an update to Org3 we only need to have Org3 sign off on the update. You must confirm the environment variables before the signing process.</p><p>We have completed the configuration update to define an anchor peer for Org3.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac142c9ef9be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hyperledger Fabric Configuration File Generator]]></title>
            <link>https://medium.com/@crissimrobert/hyperledger-fabric-configuration-file-generator-b68abd967900?source=rss-ef6f524dca94------2</link>
            <guid isPermaLink="false">https://medium.com/p/b68abd967900</guid>
            <category><![CDATA[hyperledger-fabric]]></category>
            <category><![CDATA[hyperledger]]></category>
            <dc:creator><![CDATA[Crissi Mariam Robert]]></dc:creator>
            <pubDate>Thu, 07 May 2020 11:19:38 GMT</pubDate>
            <atom:updated>2020-05-07T11:19:38.849Z</atom:updated>
            <content:encoded><![CDATA[<p>The major concern for the Hyperledger Fabric(HLF) developer is to generate the network configuration files such as <strong>configtx.yaml</strong>, <strong>crypto-config.yaml</strong>,<strong>docker-compose.yml</strong>.It’s a tedious task to generate the files for every network structure we are creating. I have created an auto generator for the creation of these files.</p><p>This tutorial will help with the customization of Hyperledger Fabric Network. It allows you to create any number of organizations &amp; orderers for the network with the name of your choices.</p><h3>1. Clone the git repository</h3><p><em>git clone </em><a href="https://github.com/crissi-repo/Hyperledger-Fabric-Generator.git"><em>https://github.com/crissi-repo/Hyperledger-Fabric-Generator.git</em></a></p><p>The repository contains the <strong><em>bin</em></strong> &amp; <strong><em>fabric-setup</em></strong> directories.The <strong><em>fabric-setup </em></strong>directory includes the shell scripts for the setup.</p><h3>2. Download Hyperledger Fabric Binaries</h3><p>Copy all the binaries (configtxgen &amp; cryptogen) from Hyperledger Fabric, and paste it on <strong><em>bin</em></strong> directory.</p><h3>3. Generate the configuration files</h3><blockquote>The repository will support for 1.4.x with Raft Ordering Service</blockquote><p>Go to the <strong><em>fabric-setup</em></strong> directory and update <strong><em>.env</em></strong> file with respect to your network structure.</p><pre> cd fabric-setup</pre><p>Update the environment file before proceeding further.</p><pre>#Fabricnetwork<br>##############################################################<br>COMPOSE_PROJECT_NAME=swarm<br>TLS_ENABLED=true<br>IMAGE_TAG1=1.4.4<br>IMAGE_TAG2=0.4.18<br>#############################################################<br>ORG_COUNT=3<br>ORDERER_COUNT=3<br>############################################################<br>PEERORG1_NAME=Org<br>PEERORG1_DOMAIN=peer_com<br>PEERORG1_HOSTNAME1=HOSTA<br>PEERORG2_NAME=OrgA<br>PEERORG2_DOMAIN=peerA_com<br>PEERORG2_HOSTNAME1=HOSTA<br>PEERORG3_NAME=OrgB<br>PEERORG3_DOMAIN=peerB_com<br>PEERORG3_HOSTNAME1=HOSTA<br>##################################################################<br>ORG1_PATH=/opt/Org<br>ORG2_PATH=/opt/OrgA<br>ORG3_PATH=/opt/OrgB<br>###############################################################<br>ORDERER1_NAME=Orderer<br>ORDERER1_DOMAIN=Ordr_com<br>ORDERER1_HOSTNAME=HostOrderer1<br>ORDERER2_HOSTNAME=HostOrderer2<br>ORDERER3_HOSTNAME=HostOrderer3<br>##################################################################<br>ORDERER1_PATH=/opt/Orderer1<br>ORDERER2_PATH=/opt/Orderer2<br>ORDERER3_PATH=/opt/Orderer3<br>##########################################################<br>#Channel name<br>CHANNEL_NAME=masterchannel<br>############################################################</pre><p>The organizations &amp; orderers containers are generated based on the corresponding values in the <strong><em>.env </em></strong>file.</p><p>The following are the steps for generating the <strong>configtx.yaml</strong>, <strong>crypto-config.yaml</strong>,<strong>docker-compose.yml </strong>files.</p><pre><strong>./crypto-configtx_creator.sh</strong></pre><p>It will generate the crypto materials for the organizations &amp; orderers along with the <strong>crypto-config-temp.yaml configtx-temp.yaml</strong> files.</p><pre><strong>./docker-compose_creator.sh</strong></pre><p>It will generate the <strong>docker-compose-temp.yml </strong>file<strong>.</strong></p><p>Execute the update.sh script for the final generation of configuration files from these temp files.</p><pre><strong>./update.sh</strong></pre><p>Hurray ! Configuration files are ready now!!!!</p><p>Note:- More fabric stuffs are on the way, Stay tuned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b68abd967900" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up of Oraclize Service in Smart Contracts]]></title>
            <link>https://medium.com/@crissimrobert/setting-up-of-oraclize-service-in-smart-contracts-9693049b2151?source=rss-ef6f524dca94------2</link>
            <guid isPermaLink="false">https://medium.com/p/9693049b2151</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[testrpc]]></category>
            <category><![CDATA[truffle]]></category>
            <dc:creator><![CDATA[Crissi Mariam Robert]]></dc:creator>
            <pubDate>Fri, 17 Nov 2017 04:20:19 GMT</pubDate>
            <atom:updated>2018-07-23T06:10:04.029Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever think of calling third-party APIs in your smart contracts? It can be possible using the Oraclize service . The Oraclize service enables smart contracts to access data from an external environment.</p><p>This article describes the use of Oraclize with testrpc,truffle,ethereum-bridge. It also explains the smart contract code which calls multiple APIs using Oraclize service.</p><p>You all are familiar with the dapp development using testrpc and truffle.For using Oraclize service you have to install another tool ‘Ethereum-bridge’ as a prerequisite for your service.</p><p>Download and install ethereum-bridge from the following Github link: <a href="https://github.com/oraclize/ethereum-bridge">https://github.com/oraclize/ethereum-bridge</a>.</p><p>You also have to get the solidity contract for using oraclize service from the link <a href="https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.4.sol">https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.4.sol</a> . You have to download the contract to the truffle contracts folder of your working directory, and rename the file to usingOraclize.sol and use the above contract in your contract by importing.</p><p>import &quot;./usingOraclize.sol&quot;;</p><p>Start your testrpc.</p><p>Then start Ethereum-bridge in active mode using the following command :-</p><p>node bridge -H localhost:8545 -a 1</p><p>The tag-a defines an account which is used to deploy oraclize contracts.It will return you an OAR address.</p><pre>Please add this line to your constructor.<br>OAR=OraclizeAddrResolverI(0x5049063e4a7704ac155e4f1f42a4954bbef5bbde);</pre><p>You have to update your smart contract constructor with the generated new address resolver.</p><pre>pragma solidity ^0.4.11;<br>import &quot;./usingOraclize.sol&quot;;  //Importing Oraclize</pre><pre>contract TestOraclizeCall is usingOraclize {</pre><pre>     //Constructor<br>     function TestOraclizeCall() { <br>         OAR= OraclizeAddrResolverI(0x5049063e4a7704ac155e4f1f42a4954bbef5bbde);<br>         // rest of your constructor code</pre><pre>      }<br>   // your code</pre><pre>}</pre><p>In the Oraclize service, you have to send a query to the Oraclize smart contract.Oraclize receive your query and make the corresponding request. Once the service receives the data from API , they call a callback function in the smart contract where you’ll be able to access and process the requested data.</p><pre>pragma solidity ^0.4.16;<br>import &quot;./usingOraclize.sol&quot;;  //Importing Oraclize</pre><pre>contract TestOraclizeCall is usingOraclize {<br>     uint public price;<br>     event Log(string text);<br>     //Constructor<br>     function TestOraclizeCall() {<br>         OAR = OraclizeAddrResolverI(0x5049063e4a7704ac155e4f1f42a4954bbef5bbde);<br>     }<br>     function __callback(bytes32 _myid, string _result) {<br>          require (msg.sender == oraclize_cbAddress());<br>          Log(_result);<br>          price = parseInt(_result, 2);<br>       }<br>     function update() payable {<br>        oraclize_query(&quot;URL&quot;,&quot;json(https://min-api.cryptocompare.com/data/price?fsym=ETH&amp;tsyms=USD).USD&quot;);<br>     }<br>}</pre><p>The above code is used to retrieve the current USD price for 1 ETH.The oraclize_queryfunction is used to inform the Oraclize about the third party API.</p><p>The oraclize_query accept the first string parameter as the type of request.Here in the example we are using it as ‘URL’. The second parameter must be the query we are requesting.It is also possible to add a third parameter, in order to make a delay in query.</p><p>You have to define the payable modifier in the function.The transaction originating from Oraclize to the __callback function pays a fee to the miner which include the transaction in a block, just like any other transaction. The miner fee is paid in Ether and it is calculated by taking the amount of gas which covers the execution costs of the transaction multiplied by the selected gas/ether price. Oraclize will set those parameters accordingly to the parameters specified in the smart contract, for contract-wide settings, and in the oraclize_query function, for query-specific settings. The miner fee for the callback transaction is taken from the contract balance when the query transaction is executed.</p><p><em>Note:- The first query made by the oraclize contract is free.</em></p><p>In the__callback function, the first parameter is the id of the request. The second parameter is the result of your request.</p><p>You have to compile and run the contract using truffle.</p><h3><strong>Handling of Multiple Requests :-</strong></h3><p>The first parameter ‘id’ in the __callbackwill handle different requests in the same callback function.The following is the example dealing with multiple requests.</p><pre>pragma solidity ^0.4.16;<br><br>import &quot;./usingOraclize.sol&quot;;<br><br>contract TestOraclizeCall is usingOraclize {<br><br>      // oraclize callback types:<br>      enum oraclizeState { ForUSD, ForDistance }<br><br>      //Events<br>      event LOG_OraclizeCallbackForDistance(<br>                string result,<br>      );<br><br>      event LOG_OraclizeCallbackForWeatherCondition(<br>                string result,<br>      );<br><br>       // the oraclize callback structure: we use several oraclize calls.<br>       // all oraclize calls will result in a common callback to __callback(...).<br>       // to keep track of the different querys we have to introduce this struct.<br>      struct oraclizeCallback {<br>            // for which purpose did we call? {ForUSD | ForDistance}<br>            oraclizeState oState;<br>      }<br>      // Lookup state from queryIds<br>      mapping (bytes32 =&gt; oraclizeCallback) public oraclizeCallbacks;<br><br>    <br>      // constructor<br>      function TestOraclizeCall() {<br>              OAR = OraclizeAddrResolverI(0x5049063e4a7704ac155e4f1f42a4954bbef5bbde);<br>             <br>      }<br>      //Function for distance retrieval<br>      function distanceRetrieve() payable returns(bool sufficient) {<br>            bytes32 queryId = oraclize_query(10,&quot;URL&quot;,strConcat(&quot;json(http://www.distance24.org/route.json?stops=us).distance&quot;));<br>            oraclizeCallbacks[queryId] = oraclizeCallback(oraclizeState.ForDistance);<br>            return true;<br>      }<br><br>      function update() payable returns(bool sufficient) {<br>         bytes32 queryId =  oraclize_query(&quot;URL&quot;,&quot;json(https://min-api.cryptocompare.com/data/price?fsym=ETH&amp;tsyms=USD).USD&quot;);<br>         oraclizeCallbacks[queryId] = oraclizeCallback(oraclizeState.ForUSD);<br>         return true;<br>      }<br><br><br>      //Function callback<br>      function __callback(bytes32 myid, string result) {<br><br>                 if (msg.sender != oraclize_cbAddress()) throw;<br>                 oraclizeCallback memory o = oraclizeCallbacks[myid];<br>                 if (o.oState == oraclizeState.ForDistance) {<br>                               LOG_OraclizeCallbackForDistance(result);<br>                             <br>               }<br>               else if(o.oState == oraclizeState.ForUSD) {<br>                               LOG_OraclizeCallbackForUSD(result);<br>               }<br><br>      }<br><br><br>}</pre><p>To keep track of the different queries we have used struct to hold and defined a mapping between queryids and state of query.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9693049b2151" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Guide to Ropsten Testnet Setup]]></title>
            <link>https://medium.com/@crissimrobert/a-guide-to-ropsten-testnet-setup-f8952d615417?source=rss-ef6f524dca94------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8952d615417</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[ethereum-blockchain]]></category>
            <category><![CDATA[testnet]]></category>
            <category><![CDATA[ropsten]]></category>
            <dc:creator><![CDATA[Crissi Mariam Robert]]></dc:creator>
            <pubDate>Fri, 16 Jun 2017 10:32:33 GMT</pubDate>
            <atom:updated>2018-02-21T06:20:11.204Z</atom:updated>
            <content:encoded><![CDATA[<p>The public testnet <strong>Ropsten</strong> with networkid 3 is useful in contract development. <strong>Geth </strong>is one of the Ethereum client useful for connecting to testnets. This document deals with the tips on how to sync your client with Testnet more quickly.</p><p>Below are the steps for setting up Ropsten with Geth version 1.6.5</p><p><strong>Step 1:</strong></p><p>Download the genesis file for ROPSTEN-Revival.</p><p>Here’s a snippet of Geth’s Ropsten genesis file :-</p><pre>{                          <br>    &quot;config&quot;: {                              <br>              &quot;chainId&quot;: 3,  <br>              &quot;homesteadBlock&quot;:0, <br>              &quot;eip150Block&quot;:0, <br>              &quot;eip155Block&quot;:10,<br>              &quot;eip158Block&quot;:10,<br>              &quot;eip160Block&quot;:10    <br>     },<br>     &quot;nonce&quot;: &quot;0x0000000000000042&quot;,<br>     &quot;alloc&quot;: {   <br>            &quot;0x0000000000000000000000000000000000000011&quot;: { <br>                   &quot;balance&quot;: &quot;0&quot;<br>              }<br>     }<br>     &quot;timestamp&quot;: &quot;0x00&quot;, <br>     &quot;parentHash&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,<br>     &quot;extraData&quot;: &quot;0x3535353535353535353535353535353535353535353535353535353535353535&quot;,<br>     &quot;gasLimit&quot;: &quot;0x1000000&quot;,<br>     &quot;difficulty&quot;: &quot;0x100000&quot;,<br>     &quot;mixhash&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,<br>      &quot;coinbase&quot;: &quot;0x0000000000000000000000000000000000000000&quot;<br>}</pre><p>Then initialize a new genesis block and definition for the ROPSTEN network using the following command:</p><p>geth --datadir /path/to/testnet/data init genesis.json</p><p><strong>Step 2:</strong></p><p>The next step is blocks downloading. We can sync to Blockchain via two modes:</p><ol><li>Normal Syncing</li><li>Fast Syncing (using --fast flag)</li></ol><blockquote>From the Homestad Guide: The fast flag enables fast syncing through state downloads rather than downloading the full block data. This will also reduce the size of your blockchain dramatically.</blockquote><blockquote>NOTE: — fast can only be run if you are syncing your blockchain from scratch and only the first time you download the blockchain for security reasons.</blockquote><p>Another flag that can be used along with --fast to sync your client more quickly is --cache. The Cache flag can be used to change the default alloted memory for a fast sync.</p><blockquote>From the Homestad Guide:</blockquote><blockquote>Megabytes of memory allocated to internal caching (min 16MB / database forced). Default is 16MB, so increasing this to 256, 512, 1024 (1GB), or 2048 (2GB) depending on how much RAM your computer has should make a difference.</blockquote><p>Command for syncing :-</p><p>geth --datadir /path/to/testnet/data --networkid=3 –-syncmode=fast –-cache=1024 console</p><p>Points to be noted:-</p><p>1) If you try to verify the number of blocks downloaded through the console using the command eth.blockNumber, ‘Loaded most recent local full block’ will always show ‘0’ , which doesn’t mean that your blocks are not being downloaded. It will only show the correct blocks once all the blocks are downloaded.</p><pre>INFO<br>[06-15|15:54:56] Loaded most recent local header         <br>number=1121759 hash=bdf4d6…ebcdec td=747686182747507</pre><pre>INFO<br>[06-15|15:54:56] Loaded most recent local full block      number=0<br>hash=419410…ca4a2d td=1048576</pre><pre>INFO [06-15|15:54:56] Loaded most<br>recent local fast block      number=1121676 hash=80f4d5…3ed841<br>td=747645006524095</pre><p>After the completion of block synchronization you can find the difference.</p><pre>INFO [06–16|11:00:58] Loaded most recent local header number=1126948 hash=4ae28e…360ad2 td=750432339366550</pre><pre>INFO [06–16|11:00:58] Loaded most recent local full block number=1126948 hash=4ae28e…360ad2 td=750432339366550</pre><pre>INFO [06–16|11:00:58] Loaded most recent local fast block number=1126948 hash=4ae28e…360ad2 td=750432339366550</pre><pre>WARN [06–16|11:00:58] Blockchain not empty, fast sync disabled</pre><p>Here, you can note the ‘Loaded most recent local full block’ has changed from ‘0’ to the latest block number and also we get one more message regarding fast sync being disabled.</p><p>To get the latest block number go for the command eth.blockNumber.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8952d615417" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>