Intro to Hyperledger
In this module, we'll explore where Hyperledger came from, and how it has evolved over time.
The best way to understand how Hyperledger works is to set up your own node.
Example: Hyperledger for Car Dealerships
It's not the size of your node that matters - it's how you use it.
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.
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.
You can see the key file that was generated with the following command:
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:
Once the call is complete, we should see a new key generated in the key-store folder.
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.
Congratulations – Now that you can create users you’re now ready to move on to editing the ledger.
In the next section, we’ll demonstrate how users can execute commands.