Build a blockchain insurance app

Get the code View the demo


With its distributed ledger, smart contracts, and non-repudiation capabilities, blockchain is revolutionizing the way financial organizations do business, and the insurance industry is no exception. This code pattern shows you how to implement a web-based blockchain app using Hyperledger Fabric to facilitate insurance sales and claims.


This pattern has been updated to support Hyperledger Fabric V1.1.

Most of us have been there: you’ve just had a fender-bender and now you’re dreading the time and effort it is going to take to deal with your insurance company, the police, and the other driver. Even if things go relatively smoothly, it is still a major disruption of your schedule.

But what if you as a developer could turn things around and actually disrupt the insurance industry? What if you could improve not only your own experience but also that of millions of people around the world dealing with the same inconveniences, delays, and administrative frustrations? Well, this is your chance.

Blockchain presents a huge opportunity for the insurance industry. It offers the chance to innovate around the way data is exchanged, claims are processed, and fraud is prevented. Blockchain can bring together developers from tech companies, regulators, and insurance companies to create a valuable new insurance management asset.

A natural pairing

Through its distributed ledger, smart contracts, and non-repudiation capabilities that act as a shared infrastructure, blockchain can transform all kinds of insurance processes. Currently, many insurance processes are manual, error prone, and can require long processing times. There are often different versions of the same data in multiple systems of record, leading to added costs and lengthy disputes.

With blockchain, manual processes are automated by sharing information on plan participants, entitlements, and claim data. Smart contracts are computationally encoded with participant registration and verification rules. Shared data and smart contract computations reduce downstream disputes. Benefits verification is based on multiple data sources that are readily available to all service providers.

Here is the bottom line: blockchain technology provides an opportunity for the insurance industry to improve their operating efficiency, lower the costs of transaction processing, enhance the customer experience, improve data quality, and increase trust between parties.

When you complete this code pattern, you will know how to build a functional blockchain insurance app. The app will have four participants, or peers:

  • Insurance
  • Police
  • Repair shop
  • Shop

The Insurance peer is the company that provides the insurance for the product (in our example, the car) and who is responsible for processing the claims. The Police peer is responsible for verifying the accident or theft claims. The Repair shop peer is responsible for repairs of the product. The Shop peer sells the products to a consumer.

How it works

So how does the app actually work? Imagine a sport enthusiast, Susie, decides she wants to purchase a new bike. She goes to the bike shop and finds an amazing deal on a road racer. As part of the purchase process, she is offered an insurance contract, which she agrees is important to have. She signs up for it, providing her personal data along with a start and end date for the contract. The daily price is calculated by a formula in the chaincode once the contract is processed. When all the paperwork is complete, Suzie is given credentials so she can log in at any time if she needs to file a claim. At this point, a block is written to the blockchain to maintain the transaction.

As luck would have it, ten days later her bike is stolen when she rides up to the Berkeley Hills. After reporting the theft to the police, she opens the self-service tab on the app, logs in, describes the theft, and files her claim with the insurance company. When she submits the claim, it is written onto the block as another transaction. The claim is first processed by the police, who can either confirm or deny the theft; in this case, the theft is confirmed, the police attach a file reference number, and another block is written to the chain. (In the same manner, if Suzie had filed a claim for a bike accident that resulted in damage to the bike, it would be a repair shop that processed the claim instead of the police.) The insurance company monitors all active claims on the blockchain, so when the police submit their verification, the company receives that confirmation and submits a reimbursement for the claim. Just as with the previous transactions, the reimbursement is written to the blockchain. Susie is happy to see that the insurance company has paid her claim, although not quite as happy as she would be if she had her bike back!

Note that insurance companies have the option to activate or deactivate certain contracts. This does not mean that contracts that have already been signed by customers will no longer be valid; it simply does not allow new signings for these types of contracts. In addition, the insurance company can create new contract templates with different terms and conditions, or a different pricing structure.

The web-based application is written in Node.js and Reacts. The application chaincode (that is, the smart contracts) is written in the Go language.

So do not fret about possible disruptions to your routine the next time you have a bit of automotive, or cycling, bad luck. Complete this code pattern, build your blockchain skills, and help disrupt an entire industry!


blockchain insurance app flow

  1. Generate certificates for peers.
  2. Build Docker images for the network.
  3. Start the insurance network.


To put this code pattern to use, see the complete details for running and using this application in the README.