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 from the previous example.


Start the Fabcar Example Network on Docker

[email protected]: ~/fabric-samples/ $ fabcar/
[email protected]: ~/fabric-samples/ $ // *This file is actually just going to invoke the general start script at basic-network/

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

[email protected]: ~/fabric-samples/fabcar/ $ node enrollAdmin.js

Were the keys generated?

[email protected]: ~/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

[email protected]: ~/fabric-samples/fabcar/ $ node registerUser.js // open this file to see the process
[email protected]: ~/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.