Win $20,000. Help build the future of education. Answer the call. Learn more

Use a PostgreSQL database as a Hyperledger Fabric wallet using Fabric Node SDK


Hyperledger Fabric uses appropriate enrollment certificates while interacting with the blockchain network. The Hyperledger Fabric SDK for Node.js provides APIs to interact with a Hyperledger Fabric blockchain. The Fabric Node SDK provides a default file system wallet for storing Fabric certificates. The file system wallet stores user certificate in folders. This approach does not provide the required security or flexibility, and it also affects scalability. Explore this pattern further to understand how to use a PostgreSQL database as a Fabric wallet.


Hyperledger Fabric is one of the blockchain projects within Hyperledger. It is private and permissioned; security on Hyperledger Fabric is enforced with digital signatures. All requests made to Hyperledger Fabric must be signed by users with appropriate enrollment certificates. Once a user is enrolled, Node.js saves the certificates in the wallet for future use. A wallet contains a set of user identities. An application run by a user selects one of these identities when it connects to a channel.

There are four types of wallets: file system, in-memory, hardware security module, and CouchDB. The Hyperledger Fabric SDK for Node.js provides a default file-system wallet for storing Fabric certificates, storing users’ certificates in folders. The Hyperledger Fabric SDK also provides a way to configure a wallet in CouchDB.

But what if a user wants to use the PostgreSQL database instead of CouchDB? There is no direct provision for storing enrollment certificates to PostgreSQL. The PostgreSQL database supports SQL and NoSQL data storage and has strong community support. This pattern demonstrates a methodology for using the PostgreSQL database as a wallet within the Hyperledger Fabric SDK for Node.js. We use IBM Blockchain Platform to set up the network and PostgreSQL configured as an IBM Cloud service or containerized using Kubernetes.



  1. Set up a Hyperledger Fabric network using IBM Blockchain Platform.
  2. Configure and deploy a containerized PostgreSQL database using Kubernetes.
  3. Deploy the client application using the Hyperledger Fabric SDK for Node.js, where users can communicate with the blockchain network.
  4. To communicate with the blockchain network, users need to register and enroll with the network which will generate the enrollment certificates and store them in a PostgreSQL database. These certificates will be used for further communication with the network.


Ready to give it a try? Check out the README for detailed instructions.