Foreign money transfer using blockchain

This paper focuses on using blockchain technology to enhance efficiency and cost reduction in foreign transactions through the banking system. Blockchain provides crucial features such as immutability of records and decentralization, which is then used to carry out foreign transactions. This process could be a major change in the transactions carried out by removing middle banks during transactions thereby speeding up the process. This paper aims at designing an Ethereum decentralized Banking Application for foreign money transfer using blockchain technology. Smart Contract helps to eliminate middle banks in the process by acting on rules specified in the contract. Every participant needs to abide by these rules which make it trustworthy and maintain the authenticity of the process.


Introduction
This paper aims at proposing an Ethereum based decentralized Banking Application for money transfer using blockchain technology. Some bank users do not prefer online baking as they perceive it as unsafe. Online banking is vulnerable to frauds such as phishing. In phishing, the user hands over their password unexpectedly to the fraudster. Online banking is insecure for computer illiterates.
Many frauds occur in traditional banking (Offline banking) too. These include credit card frauds where the fraudster uses the stolen credit card to make payments, signature forgery where the fraudster falsely replicates the signature of the other person to carry out transactions, etc.
So, if an online banking application is designed using blockchain technology, the transactions are stored permanently in the blockchain and every transaction can be traced back to when and where the transaction took place without revealing the identity of the user. Here, the past deposits and withdrawals cannot be changed and present deposits cannot be hacked as all the transactions are verified by all the nodes in the network. The current foreign trading system is centralized, which gives rise to many market risks, and the traditional process of sending money across borders is slow as it has many banks in the middle as authorities or intermediaries, hence adding up to the cost, and making this process inefficient for sending small sums of money.
This paper aims to build a decentralized system that would act as a platform for the fast, cost-efficient, and user-friendly transfer of money across the borders, without any unnecessary intermediary banks. Currently, at each step of traditional currency exchange, we have to spend a small amount of money but we still use these services because we don't have many alternatives to pick from. Today, the most significant financial market is the foreign exchange market, but the main entities comprise only large banks and companies, all of whom charge hefty fees for their services. With the right perspective, Blockchain technology can help reduce cost, enable faster transactions, and help to secure the complete infrastructure of any financial transaction. By undressing Blockchain technology into its components, we can utilize the ideas that work great, and abandon the ones that are still immature. We can leverage the relevant features of Blockchain technology, and make new systems on top of the existing financial services that are faster, cheaper, and more predictable. Together with existing technologies, we can build a system that is not as visionary as existing Blockchain solutions, but yet more realistic, scalable, adaptable, and most importantly, feasible and sustainable.

Literature survey
We leveraged a Distributed ledger to store and replicate the transactional data on each node in the network. The predefined ledger rules are responsible for removing conflicts and inaccuracies in the data stored at various nodes, as written in Blockchain White Paper [1].
There's already a study done on how Blockchain technology can be used in the banking sector [2]. In this paper, they used a trusted third party that issues coins to users, which customers can then use for transactions on the blockchain platform, which in turn lead to a reduction in money-laundering and financing of terrorism, as each transactional record is stored in a tamper-proof distributed ledger, with which the provenance of each fund can be easily verified. The system that this paper talked about, is cost-effective as the banks can use the encrypted applications in place of encoding and issuing the ATM cards. It is a highly secure system and reduces financial fraud. It is almost not possible to hack this system. Hence, we used a bank authority in our network which issues initial currency to the users which can be used for future transactions.
The white paper of Bitcoin [3] introduced an electronic system for the transfer of money that can be designed where there is no trusted third party but the system is secure. So, we referred to this paper and reduced the trust among the users and the banking authorities, as the transactions on the blockchain platform are based on cryptographic proof and not on trust, which completely removed any kind of trust between the parties. This also solved the problem of double-spending. And hash-based proof-of-work prevents any kind of tampering of transaction records without redoing the proof-of-work (PoW).
There's been a lot of studies that have been done on how Blockchain technology can be leveraged in the Foreign Exchange system. More specifically, the Bank of Canada (BOC) and Monetary Authority of Singapore (MAS) started their projects Jasper and Ubin [4] respectively, to see how Distributed Ledger Technology can be used to clear settlements of payments. We referred to this paper to study the scope of Blockchain in the Foreign Exchange system, and find the problems that it can solve with it. The various demerits associated with the current cross-border transfer technologies are differences in currency values with the sender and the receiver and the involvement of a correspondent bank to act as an intermediary. To minimize the risks associated with the settlements, the concept of "two-phase commit" is employed to help two or more processes coordinate to decide to commit or abort all the processes of the transaction.
Norwegian University of Science and Technology designed a private blockchain for international currency exchange [5], which pointed out that the current international currency exchange system is slow and expensive due to many factors. Every intermediary involved takes a certain amount of fees to complete the transaction. So, we referred to this paper to study how a blockchain-based system can be developed for foreign money transfers that have all the advantages of blockchain technology and how this system would be faster, secure, realistic, and scalable than the traditional system.
We found out that [6], regulatory and compliance issues are the biggest factors that contribute towards the resistance to the adoption of blockchain. A blockchain-based system can be designed to carry out bank transactions. This system can solve many problems associated with the traditional banking system. It is also much more secure as compared to the current banking system as the system would be decentralized, which forms an important feature of our system.
To measure the efficiency of our system, we investigated the link between transaction and computation costs in the blockchain environment [7]. We measured the computational cost (measured in units of gas) and used our insights to make changes in our smart contracts by writing code that is optimal in terms of time and space, which in turn reduced the computational costs.

Methodology
The steps involved in developing the local blockchain-based system involves the following:

Designing of the smart contract :
Designing the smart contract to carry out the successful transaction is the major part of the project. A smart contract contains a set of rules which are to be satisfied to carry out the transaction. Here, the smart contract checks whether the amount to be transferred is less than or equal to the user's account balance. If that condition is satisfied then the transaction takes place successfully. The smart contract for the transfer will be designed using the Solidity language. The smart contracts will consist of appropriate rules to carry out the transfer.

Designing of the user interface :
User Interface will consist of a home page that will have links to the Login and Registration Pages. The registration page is for registering the new user. The user has to log in and will enter the web page through which the transaction takes place. Here, the user can view the balance of their account, carry out transactions by entering the amount to be transmitted, and the receiver's address.

Linking of user interface and smart contract
The User Interface and Smart Contract need to be linked so that, when the transaction is initiated using the UI the conditions need to be checked and results are updated in the accounts. Smart Contract will be linked to the user interface using the Web3.js API.So, when the transaction is initiated, the smart contract will be executed and verification of the transaction will be carried out at every node in the network. If the transaction is successful then it would be reflected in the bank account balances of the sender and the receiver. In the proposed Block Diagram in Fig. 1, the user initiates foreign transactions through their banks using the regular mechanism, then the bank initiates the transfer of money to the destination bank. This is followed by a verification process, where a smart contract is executed at every node in the network for verifying the transactions. The balances are updated accordingly in the bank accounts, and then finally the receiver receives the money from the destination bank. In the Modular Diagram in Fig. 2, the user initiates the transaction, and the Data Acquisition module acquires the amount to be transmitted and the address of the receiver. This is then followed by validation and addition of records to the blockchain by executing smart contracts and adding encrypted transactions to the blockchain. Then finally, the bank balances are updated. The proposed Flow Chart (Fig. 3) allows users to log in and check their balance, along with that they can also initiate a bank transfer to a particular address, which is followed by the organizing execution of smart contracts, and balances are updated only if smart contracts' rules are fulfilled. This makes sure that the system works with a set of strictly followed rules which prevents any fraud activities.

Ganache and Metamask:
Ganache is a personal blockchain for rapid Ethereum application development. To develop, deploy, and test dApps in a safe environment, Ganache can be used across this entire development cycle. To interact with the Ethereum blockchain we use a software cryptocurrency wallet called MetaMask. The following figures show the output after confirming the transaction on Metamask and executing it.

Relation between Gas Price and Mining Time:
In Fig. 6, the graph shows the relationship between the amount of gas price (in Gwei) VS the time it takes for a transaction to be mined. These numbers are accurate as of 24 April 2021 and might fluctuate based on many different factors daily. There's a lower limit to the amount of gas price assigned to a transaction, and any gas price below that value would result in a failed transaction as the miners won't mine that transaction due to its low gas price.

Cost analysis of various functions of the smart contract:
The smart contract of this project deals with the logic of sending the money from the sender's wallet to the receiver's wallet, along with updating the balances to both the party's wallets accurately. There are 3 main functions inside the smart contract, which are mentioned in Table 2.
We executed the transactions several times and noted the total ether expended during each of these function calls. We kept the Gas Price fixed at 20 Gwei, and executed the functions multiple times, and noted the number of gas units that were used by them, which further helped us to calculate the cost (in INR) associated with each function call, as shown in Table 3. Adding the cost of each function call, we found out that our system takes around ₹869 to transfer money from sender to receiver's wallet.

Comparison between transaction amount and fees for our system v/s Western Union :
Western Union is one of the popular choices for international money transfers. So, we did a comparative study between Western Union and our system in terms of how much transaction fees do they cost for a particular amount of money that is to be transferred internationally. We used the online service of Western Union to find out the transaction fees charged by them and compared it with that charged by our system, which we calculated based on the gas price and gas used by each of our transactions. However, this value doesn't give the exact amount, it's just an approximate amount taken by our system as we presented in Table 3.
From the graph in Fig. 7, it is concluded that, as the amount to be transferred, is increased, the transaction fees associated with it increase as well. Hence, making Western Union and other similar services, not an ideal choice when it comes to sending high amounts of money internationally. Our system, on the other hand, charges a fairly constant amount of transaction fees throughout.

Risks Involved :
Few risks involved in the Foreign Exchange are as follows:

Counterparty Risk
It is the likelihood/probability that one of the parties involved in a transaction might be a defaulter on its contractual obligation. Investment, credit, and trading transactions are where this risk may exist. This system mitigates the counterparty risk by leveraging the smart contract protocol. This protocol is intended to automatically execute, document relevant events(legal), or control and perform actions according to the terms of the contract.

Replacement Risk
It occurs when counter-parties of a failed bank or a broker find they are at risk of not receiving their payment from the bank that has failed. We leverage the smart contracts' fallback function which sends back any ethers to the sender's account in case of a failed transaction due to insufficient funds.

Transaction risk:
It refers to the severe effect that foreign exchange rate changes may have on a transaction that is complete before the settlement takes place. The exchange rate is associated specifically with the time delay between entering into a trade or contract and then settling it. Forex trade occurs at any time between the 24 hour period which can cause currency's exchange rates to change before they are settled. This causes fluctuations in the forward rate of the forex. This system mitigates this risk by taking the timestamp of the transaction while it is initiated on the sender's side and fixes the exchange rate then, which is the considered exchange rate at the receiver's side.

Lacuna in Existing Systems :
The existing systems for Foreign Transfer have many drawbacks. Some of them are as follows :

Benefits of Blockchain :
The proposed system using Blockchain has many advantages over the existing systems. Some of them are as follows : • Blockchain-based system.

Conclusion:
Thus, the proposed system using Blockchain will be better than the existing systems. The transfer will be less time-consuming. The transaction charges would be lesser than the transaction charges in the existing systems like Swift, TransferWise, etc. as there are no intermediary banks involved in the process. There would be no problems because of the time zones and the transfer time would be fixed. The proposed system will be flexible and can be made to support all the currencies. The deployed smart contract will give the functionality to transfer money from one account to another, making sure that the additions and deductions of money are correctly reflected in both the accounts, following the rules and the regulations of the Foreign Transfer. Due to the decentralized nature of the system, all the risks, as discussed above like Counterparty risk, Replacement risk, Transaction risk can be mitigated.