Skip to content

Instantly share code, notes, and snippets.

@AkshayCHD
Last active November 17, 2020 17:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkshayCHD/f7c96175dca1e5ab8d5785a3af0d5692 to your computer and use it in GitHub Desktop.
Save AkshayCHD/f7c96175dca1e5ab8d5785a3af0d5692 to your computer and use it in GitHub Desktop.

Setting up Fabric-ca

Cloning up fabric-ca

  1. clone the repository https://github.com/hyperledger/fabric-ca in the directory where you have your golang installed and inside the directory into the following subdirectory /src/github.com/hyperledger
  2. cd into the cloned fabric-ca directory
  3. run the command make fabric-ca-server and make fabric-ca-client inside fabric-ca, to generate the client and server executable which would be located inside the bin folder of the current directory.

fabric-ca-server setup

  1. export the following path variable export PATH=$PATH:~/go/src/github.com/hyperledger/fabric-ca/bin
  2. Run the following command to check if fabric-ca-server is working fabric-ca-server from any directory
  3. For the purpose of local setup you may want to create the directory where you can store server and client side artifacts.
  4. In our case we create the directory ~/Documents/hyperledger2/fabric-CA_work_env
  5. Inside the directiry create a subdirectory server.
  6. export the values of the following variables as well
export FABRIC_CA_HOME=~/Documents/hyperledger2/fabric-CA_work_env
export FABRIC_CA_SERVER_HOME=$FABRIC_CA_HOME/server
  1. Inside the server directory we run the following command to auto-initialize all the config files and auto-create the keys fabric-ca-server init -b “admin:adminpw” where admin = username and adminpw = password
  2. Lastly we have to start our server
fabric-ca-server start -b “admin:adminpw”

fabric-ca-client setup

  1. export the following path variable export PATH=$PATH:~/go/src/github.com/hyperledger/fabric-ca/bin
  2. Run the following command to check if fabric-ca-server is working fabric-ca-client from any directory
  3. cd into the directory
~/Documents/hyperledger2/fabric-CA_work_env/client
  1. export the values of the following variables as well
export FABRIC_CA_HOME=~/Documents/hyperledger2/fabric-CA_work_env
export FABRIC_CA_CLIENT_HOME=$FABRIC_CA_HOME/client
  1. Now at first we have to enroll the admin, so as to be able to enroll other client, we do that by
fabric-ca-client enroll -u “http://admin:adminpw@localhost:7054”
  1. Now register a new client
fabric-ca-client register -u “http://localhost:7054” — id.name “mlgblockchain” — id.secret “mlg” — id.type “client” — id.affiliation “org1.department1”
  1. Now enroll the client
fabric-ca-client enroll -u “http://mlgblockchain:mlg@localhost:7054”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment