Facebook pixel Configure the Fabric
Intro to Private Blockchains

Configure the Fabric



Now that we have the core Hyperledger node running, we can use our node.js client to interact with it and send queries. Before we can get started, though, we’ll need to launch our node and configure some users and permissions.

Start the Node

First, you’ll want to run the initialization script. This is similar to byfn.sh from the previous example.

>_

Start the Fabcar Example Network on Docker

alex@ubuntu: ~/fabric-samples/ $ fabcar/startFabric.sh
alex@ubuntu: ~/fabric-samples/ $ // *This file is actually just going to invoke the general start script at basic-network/start.sh.

Set Up The Admin User

Now that the node is running, we’ll need to run a script to set up an admin user. This will also generate key files for this user, which we will need in order to begin interacting with our testing network nodes.

>_

Create the admin user

alex@ubuntu: ~/fabric-samples/fabcar/ $ node enrollAdmin.js
>_

Were the keys generated?

alex@ubuntu: ~/fabric-samples/fabcar/ $ ls hfc-key-store/
To see how this works, review lines 45-55 in enrollAdmin.js. The enroll method on line 53 is the key interaction with the Hyperledger node.

Every application requires this functionality to register a first user (our admin) who can then register subsequent users. The admin user shouldn’t ever be used to update/query the ledger, and really only exists as a root source of trust in the system. This is somewhat similar to how the genesis block is added in public blockchains.

Register a Normal User

To add a regular user, we can use the following script:

>_

Register a User

alex@ubuntu: ~/fabric-samples/fabcar/ $ node registerUser.js // open this file to see the process
alex@ubuntu: ~/fabric-samples/fabcar/ $ ls hfc-key-store/ // always check that keys were created!

Registering Users:

To see how this is being executed, open up registerUser.js and take a peak. In particular, the createUser call now has slightly different parameters.

Get Involved

The best part of blockchain is that anyone can get involved!