International Journal of Control and Automation Vol. 13, No. 2, (2020), pp. 852 - 861

Blockchain-based Wallet System using Virtual Digital Wallet

Amit Chaurasia1* Nainka Jain1 Nikhil Varshney1

Hritik Tiwari1 Vivek Kumar1

1Department of Computer Engineering & Application, GLA University

Mathura – 281406, Uttar Pradesh. INDIA

Abstract In today’s world, is something that people always carry with themselves because of security. Security is the main issue in virtual money. So, in this paper, we have discussed such an application which deals with security, privacy, and virtual currency. The application is basically being for online payment. This application uses the concept of and Cryptography. Blockchain makes this application decentralized and cryptography provides the security. It is peer-to-peer digital cash that allows online payments to be sent directly from one party to another without going through a financial institution. We have provided a comprehensive description of the details that make this College Wallet an interesting research topic.

Keywords: BlockChain, HashCode, Virtual Currency, Android Application.

1. Introduction

Virtual currencies have been defined in 2009 by an anonymous person named as a decentralized digital peer to peer payment system [1]. Based on this concept we have created an application named - College Wallet. It is an online payment application which is based on the concept of the Blockchain Technology and cryptography system. Keeping liquor money especially while traveling is not saving in today’s world. Nowadays people try to carry virtual money instead of liquor due to any kind of criminality.

In banking system, they provide facility online transactions but with charges and they are not enough safe [2]. And any kind of criminality can happen. As we are living in a society where security is everything, with the help of this wallet we will provide an easy way for making safer transactions without any fraud in it. Also, Blockchain is the most secured technology that uses cryptographic algorithms for making transactions. So, the use of such a technology will provide next level of security [3]. Even transactions by using this technology is very cheap. There are minimal charges of every transaction.

ISSN: 2005-4297 IJCA 852 Copyright ⓒ 2020 SERSC

International Journal of Control and Automation Vol. 13, No. 2, (2020), pp. 852 - 861

Figure 1. Hash Structure

Virtual currency is the best solution to this problem which is widely used for transactions between two parties involving any third party [4]. And virtual currencies have great potential to become most widely used for transactions in the future but, it also may be used by criminals to transfer and store illegal money without any control from authorities. So, here in virtual currency, there is the use of cryptography which makes it more secure [5]. The blockchain creation is shown in Figure 1 and the information consist of blockchain node is depicted in Figure 2. And Blockchain makes it decentralized and peer- to-peer i.e., there is no central authority whereas in the banking system there is the involvement of the third party.

Cryptography is implemented by using a long string of numbers and letters sent over the network without the inclusion of the third party i.e., bank. Virtual currencies use this approach to save guard the transaction. In addition to security, there are other factors that also comes with these technologies like flexibility and usability [6]. Nowadays, everyone uses mobile phones for communication so it is very feasible for them to use such an application which deals with the security of their money.

Figure 2. Block Structure

We have built this application for college students. College students can use this application for their daily use, for example, payment in the canteen, to buy tickets for any

ISSN: 2005-4297 IJCA 853 Copyright ⓒ 2020 SERSC

International Journal of Control and Automation Vol. 13, No. 2, (2020), pp. 852 - 861 fest [7]. In this application network automatically create the public and private key for the user and public is public to everyone whereas the private key is hidden from everyone. And the use of public and private makes it tamper-proof.

And it is nothing but a – ‘ wallets’, is one of three pillars of the Blockchain industry. They are not physical pocket wallets and neither do they hold any real currency. They are software programs that hold the unique address of your digital money. It allows you to interface with various Blockchain in the system and holds your balance.

2. Methods

SHA stands for the Special Hash Algorithm. It is a cryptographic hash function used for producing hashes in cryptography. Hashes are used in cryptography as they are very powerful because they are irreversible i.e., they are one-way functions [8]. Anyone can use a hash function to produce a hash corresponding to any input but it is not possible for anyone to get the input from the hash function. Hash is also known as compressed hash functions because the length of the hash generated by the hash function is much smaller than the input to the hash function.

The special hash algorithm originates from SHA-1 and after that SHA-2 came into play in 2001. SHA-256 lies under SHA-2. The main difference between SHA-1 and SHA-2 is of the length of the hash generated in SHA-1 is 160 bits (20 bytes) whereas SHA-256 generates an output hash of 256 bits (byte).

I. Preimage resistance i.e. it should be very difficult to reverse a hash function [9]. Or we can also think it as suppose the hash generated for any input I1 is H1 then there should not be any input I2 that generates the output hash H1. It gives protection against the attacker who is having hash and trying to get the input. II. Collision Resistance means that it should be a very much difficult task to find the input of any length that results in the same output hash value. This also makes difficult for the attacker to find two input values with the same hash values.

RSA is a public-key system (cryptosystem) and is widely used for the transmission of data in a very secure and protected manner. There are two different types of keys one is the encryption key which is public and another key is the decryption key which is also known as the private key and it is kept secret between the sender and the receiver. Because of the use of two different keys, it is a type of asymmetric cryptography algorithm [10].

The RSA is based on the fact that the factorization of a long integer is a very difficult task. The public key has two numbers where one of them is the multiplication of two large prime numbers. The private key is also composed of the same prime numbers. The strength of RSA relies on the key size. On increasing the length of the key, the strength of encryption increases. Therefore, RSA mostly generates key of 1024 bits (128 byte) which is very large and next to impossible to break till now.

The RSA works in three parts and these parts are as follows - • Key Generation • Encryption • Decryption

ISSN: 2005-4297 IJCA 854 Copyright ⓒ 2020 SERSC

International Journal of Control and Automation Vol. 13, No. 2, (2020), pp. 852 - 861

Key Generation- The following steps are performed while generating the keys

I. Select two large prime numbers s and t which are not same i.e. distinct. II. Compute n which is equal to s*t. III. φ(n)=φ(s)*φ(t) (φ(s)=s-1 and φ(t)=t-1) IV. Select an integer e which is less than φ and greater than 1 and co-prime to φ. V. Generate a unique integer d, which is greater than 1 and less than φ and also d is inverse of e. VI. Public key = (e, n) VII. Private key= (d, n) VIII. Return public key and private key.

Encryption- The encryption in done using the public key generated and the size of the message to be encrypted should be less than n. If the size exceeds then the message is further divided into sub messages.

I. Calculate C=Pe mod n II. Return C

Decryption-The decryption is done using the private key and the size of cipher text is less than n.

I. Calculate P=Cd mod e II. Return P

Figure 3. Double Spending

Cryptocurrency is a digital resource designed to act as a medium of exchange between transactions [11]. Cryptocurrency uses strong cryptography for securing financial transactions. Cryptocurrency uses Blockchain technology to gain the following features i.e. decentralization, transparency, and immutability. One of the major and the feature that makes it different is the decentralization. Decentralization means that there is no central administrator of the network. The problem of double spending is shown in Figure 3. In Table 1 shows the creation of public and private keys.

Every site on this network is called a node in the cryptocurrency network and only those nodes can participate in the network which is part of the network. For any transaction to be completed on the network it must be verified by each and every node [12]. If the malicious user wants to change the date of transaction, then has to change the data from

ISSN: 2005-4297 IJCA 855 Copyright ⓒ 2020 SERSC

International Journal of Control and Automation Vol. 13, No. 2, (2020), pp. 852 - 861 all of the nodes which is impossible to do because for the attacker needs to get the key of every node and keys are generated by using secured algorithms which takes a lot of time and computational power to break or detect it and this itself is almost impossible task. Every block in a blockchain contains many different fields and all of them are constant except the Nonce. Since only one hash is for the data in the block and even a small change in the data will generate a different hash which is due to avalanche effect and such a hash is not valid.

Table 1. Example of Public and Private Key Generation

30819f300d06092a864886f70d010101050003818d0030818902818100b251257c5c Public Key (1) a769720170bf161c5cb0f501745602a49f8f109b0fa74fa67191e6b08f5f4bb15a22ba Generate 595ff927b372f033a599f48853f13917b47c79a3766742215b65235f981886a942e8f6 08780aa7eb890833e1cbc7cdd888ec21f24bb1c3269d64d7ecc46cfb6c73d13f6ffaac 054f347e82e9f0e3744c68aa485230eeb36d0203010001 30819f300d06092a864886f70d010101050003818d0030818902818100845851af3c bcfd4788ba1f402f286c8c68020a383247f38d79dad72398eba478fcd13688d08144a Public Key (2) dfd243ef68c8386f9af6f5c9ec3e09bf89e8c7ffe87bd52feb3ee10878e777bb1851192 Generate 638084715fb65ee475f0736c2b25848c1e14cac879402bacebc49494112384fce41ab 467bc885b293160f9e503cfd1a78d7c97fd4b0203010001 3082025b02010002818100b26fb634dfd094567faae87d6edd069b9a1ba4a3f729f6d 5130a5a2277b05ecb2bcfb0d950dcf9435e21b599846a6fefb7b44d9222d87eb104d1 8b38fea7a6d6855b32d3fe353b27b55627ed8638305bb7d8f99ea75cd395c377c3609 0b7f35776b844eb4a497eb723df3180ac6db3a68e0acd716f80e50e9e7414a77a5b9c d102030100010281801ff899268f25a1b67fe881009c8118c27f91cd659d8f14cd67b c769aef641810023913e054374ba830f10c4745ed064266e174f6a6acb0c289f0fba78 a2542e4a6fb1dfcdfe709a3a84245ffc5f857b2599dffc4fe3c3124f2bb9fa6e14675df3 3ddae597b658b5fdcb094382ffecc40e07904aa7f66f7b222a3f9feb27db5f3024100c0 Private Key (1) 567d97d309216cd7effac446acbf6e98bb2e45090b3858cdef0d881b4b89c2916618c Generate e42d752952169b94b6caaad5c93c65b9ac1ed00db3b5aaef6a6f4e1f3024100ed7f4be 7284ead1cc3df1a0d2879ff1ebbef7293722546c16fbd223ad94f16304cd3112183c70 172bfaee81b84df2ce2547b993ba0744446b212497f8040f32b024041288bdfb554b0 8829175982c8d698fba4ae34dc9a55bcbf08f4e546a8c88c60e7d508ae47a29e8d7b0 65009a744a2fa6bed94f6f69f8ddcb75cdf4d1bfe75d5024064db1529b2154f3093019 0779c03cad28b6ed1124a7c08032767833cc881ec63508ca58ebcfe6ae00704c8eebe cb63ad2dc15b3e561269d837d0ca4389fc8b0702407ddbd20211c4d62a51ea77822c dda4a9e7ff9c806b9e205530949318d18a478fb3e4462ad09f5330d746295caeadb7fe f2ae62be21a4e7ff2ce6bcae992194eb

3082025d02010002818100845851af3cbcfd4788ba1f402f286c8c68020a383247f38 d79dad72398eba478fcd13688d08144adfd243ef68c8386f9af6f5c9ec3e09bf89e8c7f fe87bd52feb3ee10878e777bb1851192638084715fb65ee475f0736c2b25848c1e14c ac879402bacebc49494112384fce41ab467bc885b293160f9e503cfd1a78d7c97fd4b0 203010001028180064ebd49e84fab94a2b81830336f2e493cd5c80de89b94488c63b 938399c15812caf7df564569ce2dbfb43c2f56c795ce217212771f77d078aeaf058bdb 870c1a05eb4e4640067c70492004e143686faa77093ca2f902b6830be262d7e74168f dc1f11095cb6380130275125b3929b10681c95aa8db2e1ede67b57f8a79a225d0241 Private Key (2) 00b5b05af9f236bdfd4fca8127c1b08d4187417120b37f867e1201ee09dcae3930367a Generate 7981247eb83574b375af970cb939cca0cf488fa6851c4cb95ef765f1dd0d024100ba79 6fa245d7eee2c60428615d00222571b02390a1336b0910343adb00356462442d1c44 d25c5df9e9b4b1dd0baead912f4a93adf0e2a109f13a6c67142a9db702401cbd93f69b e11af6ba2b7f78c983e3246d7fe5a455a0a3a6c7b474722ced867060fdc8c0ac043ba1 811f6e4b636a88d662cf415aea165e5216b4f017d49188f5024100b30dc1ecae65fe83 102293e791967c333a2c28aa4aaf85ba892dadc9f6344e74b10423ddcda455b48ffd2a c096e41ed386f674419448f8db041fd6515022ef97024100a7fc8722aa818f9

ISSN: 2005-4297 IJCA 856 Copyright ⓒ 2020 SERSC

International Journal of Control and Automation Vol. 13, No. 2, (2020), pp. 852 - 861

To add a new block to the blockchain the miners have to generate a hash. The generation of hash is difficult because a target value is given in terms of the leading zeros i.e. the new hash generated should be containing the number of leading zeros which is equal to the target value. The simple reason for giving the target value is to increase the complexity because it is difficult to find the hash below the target value. The miners can only change the value of the nonce and generate the hash for the block. A very slight change in the nonce can make a vast change in the hash. This work requires a lot of computational power to generate the hash below the target value and is the certificate that a lot of computational effort has been made by the miner. When a hash in the targeted range is generated and is verified by all other nodes the block is added to the blockchain and miner gets reward for the work.

If two nodes mined the new block at the same time then which block is going to be added to the blockchain will be decided by the consensus protocol. If there are n sites in the blockchain network and at the node1 and node4 new blocks are mined and now certain sites contain blockchain with a new block of node4 and certain with a new block of node1. The challenge here is to determine which node will be added to the blockchain.

In such a case, they will wait until one new block will be mined on one of the nodes which have previously mined the block i.e. either node1 or node4. The one on which new block gets mined will and the blockchain will be updated on all the sites. The block of the losing site will be removed and that block is called as orphaned block and also the rewards obtained by the miner for that block will be taken away. The consensus protocol, in this case, works on the longest blockchain winning policy.

Figure 4. Wallet Generate

ISSN: 2005-4297 IJCA 857 Copyright ⓒ 2020 SERSC

International Journal of Control and Automation Vol. 13, No. 2, (2020), pp. 852 - 861

Figure 5. Transaction

Figure 6. Successful Transaction

ISSN: 2005-4297 IJCA 858 Copyright ⓒ 2020 SERSC

International Journal of Control and Automation Vol. 13, No. 2, (2020), pp. 852 - 861

Figure 7. Mining Block

Figure 8.

Figure 9. Transaction Details

ISSN: 2005-4297 IJCA 859 Copyright ⓒ 2020 SERSC

International Journal of Control and Automation Vol. 13, No. 2, (2020), pp. 852 - 861

Figure 10. Confirm Transaction

Figure 11. Node Creation

Results

As Blockchain is emerging technology and we live in a world where security is everything and lack of trust can result lead to financial insecurity so we decide to create a money transaction system that is based on the trending and emerging technology BlockChain [13]. In Figure 4 shows the snapshot of wallet creation. This module is created into Python with the use of libraries. In Figure 5, 6 and 7 showing the wallet transaction and the mining process. In Figure 8, 9 and 10 showing maintenance of ledger and successful transaction. In Figure 11 node creation after successful transaction. It is an expanding list of record which are called blocks, Blocks are linked between each other and form a chain called ledger which is distributed and decentralized. Each block contains the hash of the previous block, transaction details example. Amount send and receive and the remaining amount, and a timestamp which is given when a block is created. Each Block that stores information is distinguished from each other by using hash algorithms

ISSN: 2005-4297 IJCA 860 Copyright ⓒ 2020 SERSC

International Journal of Control and Automation Vol. 13, No. 2, (2020), pp. 852 - 861 that generate a unique number using the content of block for the next block. In a blockchain, it’s very hard to modify any data which makes it more secure and reliable.

REFERENCES

[1] Satoshi Nakamoto : A Peer-to-Peer Electronic Cash System https://bitcoin.org/bitcoin.pdf [2] W.Dai,"b-money," http://www.weidai.com/bmoney.txt, 1998. [3] H. Massias, X.S. Avila, and J.-J. Quisquater, "Design of a secure timestamping service with minimal trust requirements," In: 20th Symposium on Information Theory in the Benelux, May 1999. [4] D. Bayer, S. Haber, W.S. Stornetta, "Improving the efficiency and reliability of digital time- stamping," In Sequences II: Methods in Communication, Security and Computer Science, pages 329-334, 1993. [5] S. Haber, W.S. Stornetta, "Secure names for bit-strings," In Proceedings of the 4th ACM Conference on Computer and Communications Security, pages 28-35, April 1997. [6] A. Back, "Hashcash - a denial of service counter-measure," http://www.hashcash.org/papers/hashcash.pdf, 2002. [7] R.C. Merkle, "Protocols for public key cryptosystems," In Proc. 1980 Symposium on Security and Privacy, IEEE Computer Society, pages 122-133, April 1980. [8] W. Feller, "An introduction to probability theory and its applications," 1957. [9] http://www.iwar.org.uk/comsec/resources/cipher/sha256-384-512.pdf [10] Sarah Underwood. Blockchain beyond Bitcoin. Communications of the ACM, 59(11):15–17, 2016. [11] Melanie Swan. Blockchain: Blueprint for a new economy. O’Reilly Media, Inc., 2015. [12] Don Tapscott and Alex Tapscott. Blockchain revolution: how the technology behind Bitcoin is changing money, business, and the world. Penguin, 2016. [13] Robert McMillan. The inside story of Mt.Gox, Bitcoin’s $460 million disaster, 2014. [Online]. Available: https://www.wired.com/2014/03/bitcoin-exchange/. [14] Bryan Menegus. $400 million goes missing from Japanese crypto exchange Coincheck, 2018. [Online]. Available: https://gizmodo.com/400- million-goes-missing-from-japanese-crypto- exchange-1822454084. [15] David Siegel. Understanding the DAO attack, 2016. [Online]. Available: https://www.coindesk.com/understanding-dao-hack-journalists/. [16] Rachel Rose O’Leary. Parity team publishes postmortem on $160 million Ether freeze, 2017. [Online]. Available: https://www.coindesk.com/parity-team-publishes-postmortem-160- million- ether-freeze/. [17] Ittay Eyal and Emin Gun Sirer. Majority is not enough: Bitcoin mining ¨ is vulnerable. In International conference on financial cryptography and data security, pages 436–454. Springer, 2014. [18] Michel van Eeten, Albert Nieuwenhuijs, Eric Luiijf, Marieke Klaver, and edite Cruz. The state and the threat of cascading failure across critical infrastructures: the implications of empirical evidence from media incident reports. Public Administration, 89(2):381–400, Jun 2011.

ISSN: 2005-4297 IJCA 861 Copyright ⓒ 2020 SERSC