In this chapter, we will learn how Corda can be used as a private permissioned ledger for recording the transactions between different parties in land registry expediting business processes and bringing transparency to the entire ecosystem. This chapter also comes with a sample project that can be downloaded by developers.
Fraud is very high in land- and property-related transactions. This is often due to the fact that even if someone claims to be the rightful owner of a piece of land, he/she might have been duped by another seller who sold the property with fake documents. Also, tracking of the property deal and the ownership history of the property are crucial in property transactions.
Let’s consider a scenario where a property is to be transferred between two different persons. It might involve multiple independent organizations such as a land registry department, a bank, a surveyor, and so on. In the past, such workflows were a paper-based system that consumed a huge amount of time for completion. Nowadays, many organizations have digitized the entire system and yet the basic issue has remained the same. Organizations participating in the workflow do not wish to share their data for a common platform, and hence tracking the transactions at any point of time has always been a challenge.
Solution
Land registry is the right kind of use case valid for Blockchain implementation, and most Blockchain protocols have tried their hands at this use case. The beauty of Blockchain is that once stored, data can’t be modified or deleted, which gives Blockchain and distributed ledger technology (DLT) the edge over any other traditional database. Let’s find out how to trace out all the previously recorded ownership from Corda DLT.
As shown in Figure 4-1, let’s create a decentralized application based on Corda DLT where traceability can be closely monitored by the underlying sharable ledger.
Land department
Third-party surveyor
Bank
Insurance company

Land registry system architecture
- 1.
The buyer and seller approach the land department, which creates a new land registry case with existing property ID. If the property is a first-time property, then the property ID has to be generated before processing the deal.
- 2.
The land department assigns the property details to a third-party surveyor to survey the details of the property.
- 3.
The surveyor approves and sends back to land department or rejects with reasons.
- 4.
Upon positive response from the surveyor, the land department sends details to the bank for successful initiation of mortgage.
- 5.
The bank approves and sends back to the land department or rejects with reasons.
- 6.
Upon positive response from the bank, the land department transfers the ownership from seller to buyer.
We can add more parties in real life such as insurance company, water/gas/electricity departments for utility connections, and so on. Please note that we can join this with a B2C web application where the buyer and seller will be registered through some off-chain database like Oracle, mysql, or mongo, where there has to be a stringent KYC process for background verification and user IDs are created against each of them. The area elaborated in the preceding covers only the B2B transactions and uses those IDs of buyer and seller provided through the off-chain database.
In Corda, the order of execution is as follows:
API class -> Flow class -> State class & Contract class -> Data committed to ledger.
However, the queries do not need to follow this path. We can directly write queries in the API layer itself. So in our example we have an execution order for new property as follows:
PropertyTransferApi.initiatePropertyTransaction()-> InitiatePropertyFlow
-> PropertyDetails -> PropertyDetailsSchemaV1
-> PropertyContract
Let’s elaborate this further.
Note
You can download the code from the repository associated with the book.
First we have to create a state class PropertyDetails with all the required data (propertyId, propertyAddress, propertyPrice, buyerId, sellerId, isMortgageApproved, isSurveyorApproved, owner, description, updatedBy, updatedTime, etc.).
PropertyDetails implementing LinearState and QueryableState Interfaces
You can find two methods named supportedSchemas() and generateMappedObject(), which are default methods and must be implemented for QueryableState.
PropertyDetailsSchema for persisting selected and mapped data on ledger
In PropertyDetailsSchemaV1.java, we have the flexibility of storing either all or part of the variables as original PropertyDetails object. This data is saved to a local land_registry_states table. Do not forget to implement a blank constructor, which is a basic requirement without which it would not work.
PropertyContract verifying input/output data in a transaction
InitiatePropertyFlow to start a new property workflow
Finally, in Listing 4-5 we have the PropertyTransferApi.java. In this file, we can see that the first method, getAllCurrentPropertyDetails(), retrieves all the current states of PropertyDetails objects.
The second method, getAllPropertyDetailsForId(), retrieves all of the consumed/historic states as well as the unconsumed/current states of the PropertyDetails object.
PropertyTransferApi exposing API endpoints through REST based web services
Now let’s retrieve and test this code. First, run “gradlew clean deployNodes” followed by “build\nodes\runnodes”. A series of consoles will appear, each representing a node, and this will take a few minutes to stabilize. Now using Chrome ARC, Postman, or any other REST client, send the first POST request to http://localhost:10006/api/property/initiate-property-transaction.
Javascript Object Notation (JSON) request for initiating property transfer

Sending initiate-property-transaction POST request on REST client
Run Vault Query

Vault query result on node having permission

Vault query result on node not having permission
The reason for this is the getParticipants() method, where only the owner can view the data. If your business needs other parties to view the same data, you can send the name of those parties in request and pass on to this method.
Now use the following GET request:
http://localhost:10006/api/property/getBidOffersOfPriceRange?priceRange=140000

Fine-tuned vault query result with QueryableState interface
In the response, we can see that the owner is LandDepartment on creation. Now run a GET request as http://localhost:10006/api/property/transfer-department-to-surveyer?id=660614e8-b441-43c3-996c-1b5518f37975&newOwner=Surveyor, where ID is the linear ID of the first transaction.
Once this transaction is through running, “run vaultQuery contractStateType: com.landRegistry.states.PropertyDetails” will not show any result on the LandDepartment console, but it will show the whole state on the surveyor node, as the surveyor is now the new owner.

PropertyDetails data updated after approval of surveyor
R3 Corda Advantages
Data related to property transactions can be saved to Corda’s immutable repository, where all historical data can be tracked as and when needed. Data can be shared only among the nodes that need to know the data. This DApp can be integrated with a public Blockchain, where only required data can be shared to all users as public data.
Live Implementation
As per a recent news by “Ledger Insights” ( www.ledgerinsights.com/uk-land-registry-corda-blockchain-property/ ), “Her Majesty’s Land Registry (HMLR) chose Corda for blockchain development. The project aims to explore how to make the house buying process in the UK faster, simpler and more transparent.”
Created by Bloxian Technology, “21st Century Banking” is an application that uses IBM Watson data science capabilities for finding the right home, augmented reality by Microsoft Hololens, and R3 Corda for a preauction transaction that includes the lender’s commitment. The transaction also handles autobidding and settling deals in real time. Find more here: https://marketplace.r3.com/solutions/21st%20Century%20Banking/770eafff-915d-4047-b3a3-40df7ffde60a .
References
- 1.
21st Century Banking ( https://marketplace.r3.com/solutions/21st%20Century%20Banking/770eafff-915d-4047-b3a3-40df7ffde60a )
- 2.
- 3.
Dubai Land Registry Hackathon ( www.hackathon.io/dubai-land1 )