Loading...

Summer Research Fellowship Programme of India's Science Academies

SMART MORTGAGE CONTRACTS

Hema Pavani Perla

Department of ECE, Shri Vishnu Engineering College of Engineering for Women, Vishnupur, Bhimavaram 534201

Guided by:

Prof. Viswanadham Nukala

Computer Science and Automation Department, Indian Institue of Sciences, Banglore 560012.

ABSTRACT

Smart Contract is a programmable code which contains a set of rules for any business transaction which executes automatically when all the rules and conditions are met and these transactions are usually stored in Blockchains. These innovative and decentralized contracts had revolutionized the traditional contracts by alleviating the cost and latency associated with them and making them more secured and efficient than traditional ones. The reason is smart contracts eliminate the role of intermediaries as itself enforces the contract when pre-defined are met where there is no scope for third party to execute them and thereby making the transactions economic and paperless. Smart contracts had tackled myriad challenges and one among them is Mortgage. We use Smart Contract to digitalize process and make it more efficient. The borrower should sign up for loan by filling the details and then the smart contracts executes and sanctions the loan if its conditions are met and it automatically sends the documents to lawyer and property details to the valuer and they update the progress to the smart contract and If all terms are satisfied , it releases the amount to the borrower and incase if repayment by borrower is not done then it assigns the documents to Loan Repayment section which auctions the property and again money is sent to bank .We use Solidity Programming language to implement Smart Mortgage Contracts. Smart Mortgage Contract reduces the delays for Mortgage from 50-60 days to 4-6 days by increasing processing speed and reducing the cost of paying escrow services for the progress at every stage .Moreover, in Smart Contract data that is being processed is tamper–resistant and there is no need to trust any intermediaries as it is distributed ledger and it is decentralized too which means every transaction is shared to every party involved in it. Smart Mortgage Contracts provides many use cases such as providing House loans, Education loans, Vehicle loans and any assets .Finally, Smart Mortgage Contracts are self-executing, immutable, tamper-resistant, cost-effective and it is transparent.

Keywords: Smart Contracts, Mortgage, Solidity

INTRODUCTION

Background/Rationale

Mortgage Industry is at core of the Indian economy. It has become like a magic potion for the middle class families, who take lion's share in Indian population. Not only middle class people but also the riches take mortgages in order to cutdown their income taxes. One or the other way mortgages has become a supporting hand for basic needs of humans like shelter, car, and for some others it has become capital to start their business. But, the process involved to get mortgage is not easier, involves many steps and involves lot of paperwork and many intermediaries .Moreover, it involves trust among those third parties and it is inevitable that there is a chance of losing many important documents.

In order to eliminate the role of intermediairies and make mortgages more efficient, a trending technology can be used that does the transactions without the need of third person and stores them in blocks and all the transactions are chained together using the Blockchain Technology. Smart contracts ,the name indicates that are contracts which executes automatically when specified conditions are met.These smart contracts operate on blockchain technology. Blockchains are decentralized ledgers which stores all the transactions trustlessly. So, even the mortgage transactions can also be done using smart contracts in which customers can sign up by filling their details and chosing the loan which best suits their need and if details are correct and if customer is eligible then smart contract approves the loan request and the valuation of security provided by the customer and if suites the loan requested by customer then money is transferred to customer.

MORTGAGE SYSTEM

Generally, Mortgage involves the many steps such as applying for loan, evaluation by the bank such as checking borrower’s employment stability, Credit Rating and his Financial stability and checking the property details, Bank sanctions and approvals the loan by following some preferences such as age, income etc. The borrower needs to submit the documents such as property chain documents, income proofs, ID proofs etc. Then Bank assigns the evaluation of the documents to the lawyer followed by legal check. Then Evaluation of property comes into picture, which is given to Bank trusted Valuer who evaluates and estimates the property value and bank verifies the loan amount and then Registration deal happens and Bank gives the amount to the borrower and details of repayment of loan ,EMI s etc. If the borrower fails to pay the interest and loan for 3 consecutive months then it sends notices and if there is no response then Bank auctions the Property and the amount is retrieved .This how the traditional Mortgage happens in Bank.

The flow chart of Traditional Bank Mortgage system is shown below

Smart Mortgage Flow chart.png
    Traditional Mortgage System

    Mortgages can be of any type like Housing loan, Educational loan, Car loan etc. But in this project essentially we would like to concentrate on Housing loan . Why housing loan only because, it has become basic need of humans. For housing loan, not only for housing loan for any loan there should be a security backed with it. This security is like assurance to bank from customer side that if customer fails to pay the loan and EMIs ,then lender or here Bank has a right to sell/auction the property and get their money back. The security which the customers are providing should be equivalent to the amount of loan to be lended. So, inorder to check the value of the property/asset , bank need to evaluate the property in which it depends on the third parties like Valuers to estimate the value of the property. Bank also depends Lawyers to check and certify the documents provided by the customers. So, entire mortgage system is dependant on the trust of third parties like Bank Valuers and Lawyers. This also shows the latency and cost involved in this traditional mortgage system which limits the propserity of financial status of any country.

    SMART CONTRACTS for Mortgages

    Smart contracts enables us to create many decentralized apps. Using this advantage of smart contracts , we tried to build a decentralised application for traditional Mortgage system. In this application , firstly we tried to take the details of customers and check their eligibility and promote them to Loan Approval stage.

    1.png
    • 1
    Customer Details and Eligibility checking Contract

    After entering details , we display the customers the live status of their loan ...

    Status_1.png
      Tab which shows the simulation result

      The next stage of this application is entering of unique ID of certificates to scrutinize them. The customers just need to upload their ID, so that the smart contract verifies it with the database which is associated with government certificate generating system, which is done as follows

      2.png
      • 1
      • 2
      Certificate Verification  Contract

      After all the conditions are met, the money is transferred to the customer's account with timestamp attached with it.

      OVERALL OBJECTIVE

      The objectives of this project is to

      ✯ Developing Smart Contracts to make Secure and tamper-resistant Transactions

      ✯ Digitalize the age-old Mortage system to make it more Customer-centric and Cost-effective

      ✯ To decrease the amount of days and latency associated in granting a Mortgage

      METHODOLOGY

      Smart Mortgage Contracts involves 5 major steps. They are

      ❱ Step-1 :-Working out on the workflow of Contract, so that neccesary conditions may be included.

      ❱ Step-2 :- Coding and Compiling the Smart Contracts for every block in workflow diagram.

      ❱ Step-3 :- Simulating Smart Contracts.

      ❱ Step-4 :- Deploying Smart Contracts in to Blockchain.

      ❱ Step-5 :- Interfacing the Smart Contracts to make it User-friendly.

      Work Flow Diagram :-

      Work Flow diagram represents the way the work proceeds from beginning to ending . Every block involves certain conditions which are needed to be satisfied. Moreover, it is easy to findout the important blocks in the any system.

      Work Flow.png

        Coding and Compilation :-

        Smart Contracts can be written in many programming languages like Java, C++,Simplicity,Solidity. Generally, Smart Contracts are programmed in Solidity programming language. Solidity is a high-level programming language and object-oriented language and it includes many libraries and user-defined functions. Remix is an Integrated Development Environment in which we can temporarily write and simulate Smart Contracts. These contracts which are written in solidity consume some gas called Ether, to perform the transactions. Blockchain is a decentralized , distributed ledger in which any transaction or any information cannot be done solely. It is computed only if all the other computers or nodes synchronise to form a big node or a network. In order to do all these, we need a computing power and that power is none other than ether in this ethereum platform which is like a fuel to compute all those transactions.

        Firstly, to write any smart contract in Remix, not only in Remix in any platform we need to specify the version of solidity we are using in the first line of the code. Smart Contract is like object-oriented programming in which classes are created and their instances are created whenever there is a need of that class. But in smart contracts, like object-oriented programming instead of classes here we have contracts. Every contract has some functions also in it. For example,

        Customer Details.png
           Smart Contract to fill and check customer details  

          The above figure is an example of smart contract which is coded based on the first block of Work Flow diagram . Here, in this code we are using solidity of version 0.5.1 which can be seen in the first line of the code . We have also created contract named "details" in which there are different data types initialized and functions like getName ,getAge ...etc. This contract allows customers to fill their details and checks their details by checking their age and credit score etc. It gives output as a string i.e, "eligible" or "considerable" or "not eligible". This is how smart contract is coded. Next part is compilation and to run the contract.

          Compilation :-

          In the Remix IDE we can find a tab on right side which has different options like Compile, Run and Analysis...

          Every contract gets compiled if and only if there are no errors in the contract which we had coded. After the compilation , the code is to be run. The contract runs only if it is compiled only . In run tab we have several dialog boxes ,one among them is Environment , it is actually run environment and there are 3 environments available out of which we use "JavaScript VM".

          Compile tab.png
          • 1
          • 2
          Compile Tab
          Run Tab.png
          • 1
          • 2
          • 3
          Run Tab

          Simulation :-

          To know whether any contract or program is executing properly or not we need to succed in some testcases. This is what actually called as Simulation . To simulate any contract we first need to temporarily deploy our smart contracts . Deploy is to put your smart contrat on any temporary platform ,here it is remix itself . We also have a deploy button which on pressing deploys and displays the deployed contracts . On clicking on that deployed contracts, the functions we created will display their input parameters which need to be filled .

          Deploy Tab.png
          • 1
          • 2
          • 3
          • 4
          Deploy Tab

          After filling the details, the corresponding function is performed . For example , if we enter Credit Score and age we get printed whether we are eligible or not. In the same way if we type "Loan Type", we get that loan type displayed . At the same time, as we had mentioned earlier,the amount of gas spent on processing this transaction is also displayed in the console tab .

          Console Tab.png
          • 1
          • 2
          • 3
          • 4
          • 5
          Console Tab

          In this way simulation is done and contract's output is verified for several test cases. The next step is to deploy contract in to blockchain.

          Deploying Smart Contracts :-

          Deploying of smart contracts means putting the smart contracts in to a secured blockchain platform .Truffle is one such platform which not only provides environment to write,compile and test but also has a platform which supports deployment of contracts ,Ganche. Ganche has 10 accounts in it with 100 ethers each, which helps the user to perform some transactions with that adresses. After installing Ganche ,when you click on its icon ,it appers like this

          Ganache.png
          • 1
          • 2
          • 3
          • 4
          Ganache tab

          To deploy contracts , we can use Microsoft Powershell or Terminal as admin . The advantage of truffle is that there are some tutorials in truffle tutorials in which we can learn as well as deploy and test external scripted smart contracts also . Only thing we need to do is to save the contracts in the file and migrate them to blockchain. When contracts gets deployed, some amount of gas is spent as I had mentioned earlier as it consumes some transaction costs to deploy.

          1.png
            After Migration Ganache Tab

            Creating User Interface :-

            Deploying smart contracts in a local test blockchain and interacting with it is easy for the creators who had created that smart contract, but users cannot access it. So, we need to create a UI to make it user-friendly. To make a UI we need to use node.js and web3min.js.

            CONCLUSION AND RECOMMENDATIONS

            The project aimed to create a blockchain based solution to make mortgage system self-executing and decentralised system. In this system we focussed to eliminate the role of third parties and smart contract itself acts as escrow services. But, to check the documents and for evaluation of the property we used just unique identification code to verify the certificates, but many documents and land registration system are hand written and don't have any unique identification codes as that system is not completely digitalized. Further evolution can be done to verify the hand-written documents when they upload pdfs or images of those documents. When coming to release of funds at different stages of completion of construction of housing loan, funds are released only when certain infrastructure is built only, to check whether they are accomplished or not we need to use image recognition process and verify whether it is true or just it is morphed version. In this way there is a greater scope to improve in front-end part also.

            ACKNOWLEDGEMENTS

            Firstly, I would like to thank Indian Academy of Sciences for selecting me to get this opportunity to do my internship IISc, Banglore. I would like to specially acknowledge C. S Ravi Kumar for his continous support in providing this internship to many internship aspirants like me.

            Most importantly I would like to thank my guide Prof. N. Viswanadham for accepting my request and giving me opportunity to work under him. He had always been very interactive and had turned up every day to guide his interns. I could not imagine about completion my project without his guidance. His daily inspection of progress of project made the work more interesting. Moreover, he guided and showed us the path for all the interns how to proceed further in our respective careers. He always shared and quoted many interesting examples in and out of the project to motivate us to our project. I could wish to work under him if I get chance again.

            Thirdly, I would like to thank my co-interns Prithvi and Tripti for their support whenever I got stuck at any point my work. I also want to thank CSA staff members for their service and care towards us. I also want to thank M.Tech Research students Mayank, Shivika and komal in helping me to get insights about my project.

            Lastly, I could not finish without mentioning my friends at IAS Fellowship Residency, who had made many ever-lasting memories in my life and always helped me whenever I needed their support. I also want to acknowledge my home institution Shri Vishnu Engineering College for Women, for their encouragement in completion of my internship. I am always indebted to my family and friends who had supported me to come to internship and accomplish this project.

            Source

            • Fig 2: Remix IDE
            • Fig 4: Remix IDE
            • Fig 6: Remix IDE
            • Fig 7: Remix IDE
            • Fig 8: Remix IDE
            • Fig 9: Remix IDE
            • Fig 10: Remix IDE 
            • : Truffle suite
            • : https://www.trufflesuite.com/img/tutorials/pet-shop/ganache-migrated.png
            More
            Written, reviewed, revised, proofed and published with