Bishal RaEe
Bishal RaEe

Reputation: 97

Hyperledger starting project for my own use case

As of now I have used fabric-samples repo and used network.sh to start network . They already have connection-org.yaml file which has necessary information.

When I need to use fabric for my app , I know I need to start fabric network right ? Then I need to also create channel and user into it . How do I do it ? Should I just copy and paste that network.sh from fabric-samples ? What about connection-org.yaml? I think all of them is hardcoded right ? What should I do about it ? Every tutorial has prebuilt these things never explaining what they are. Any help would be heavily appreciated

Upvotes: 0

Views: 62

Answers (1)

Ashishkel
Ashishkel

Reputation: 963

As you have mentioned that you have used Fabric Repo, I am expecting you to to be familiar with the Hyperledger Fabric Blockchain Framework. Following factors related to the network should be decided first.

  1. Channel name.
  2. How many and Which are the Organizations are participating in the Consortium,
  3. How many peers per Organization?
  4. Ordering Network would RAFT based, But how many orderer nodes ?
  5. Whether state database would use Couch DB or LevelDB
  6. How the MSP Crypto would be generated ( Is Fabric CA going to be used[ If yes, then own root certificate/rootCA ?] or Cryptogen Tool)

Once the above has been laid out, then the next step is to start coding the network script.

The images should be already loaded into the local docker repository, and the Fabric binaries should be available in a location accessible to the script. If the docker images are not loaded, then the machine should have connectivity to internet and then to docker-hub.

It would be good to start with a docker based network setup. The network and persistent data stores ( docker network, ports and volumes) should be planned.

Once that is sorted out, the coding of the docker compose files could start. Following are the points to be noted during this step.

  1. Create a single compose with all the organizations Or create individual compose files for each organizations. Take a look at the docker compose yaml files present along with the network.sh to get an idea.
  2. Decide on the docker subnet ( network reference)
  3. Provide the same network reference against each service / each individual compose files.
  4. Provide the env variables for the below items.
  5. Map the MSP folders.
  6. Decide on the SSL as applicable
  7. Provide CouchDB ports(if applicable), Peer Ports, Gossip ports, Orderer ports etc.
  8. If planning to use cryptogen, then create the config files as per the Org structure. If its CA, then write commands as per the org structure.

Now again refer to the network.sh script and try to figure out how the crypto is generated ( as applicable to your choice). Also refer to the cleanup part from network.sh to understand how it is being done, what is being removed, and what is being retained.

Every time the script bombs, make sure that you cleanup and then start. ie, all the docker containers and volumes to be removed. You could retain your MSP cryptos if you want to.

Locate the command to create the channel, and adding peers to the channel. The content from env.sh is a good example on how to set the environment variables needed within your script.

Once all the members have joined the channel, the setup the anchor peers per organizations.

Write a version of the script after referring to the example.

By the end of proper execution of the steps above, the script should be able to get a Hyperledger Fabric network up and running.

Upvotes: 1

Related Questions