Implementation of Distributed File Storage and Access Framework Using IPFS and Blockchain
Implementation of Distributed File Storage and Access Framework Using IPFS and Blockchain
Abstract—Many critical applications are designed on the BitTorrent is that , about 170 million users uses BitTorrent
distributed structure using the blockchain technology to every month [5]. Moreover, BitTorrent protocols takes 40%
ensure the availability, immutability, and security. However, of the internet traffic on daily basis [5]. However, these ap-
these applications are facing the storage problem owing
to the data volume growth of transaction. The number plication does not secure and efficient when compared with
of transactions and its size in a block is growing in the HTTP. The HTTP protocol is one of the most considerable
blockchain day by day because of the feature of immutability protocol in terms of development for distributed applications
and append-only. The growing nature of transactions in worldwide. However, the HTTP protocols work on location-
a block is not only making the problem for storage but addressed based protocols which is not much efficient in
also in access to the block transactions. In this paper, we
propose an IPFS based blockchain storage model to solve the terms distributed access of file. To overcome the drawback of
storage problem of transaction in a block along with access BitTorrent and HTTP , the Interplanetary File System(IPFS)
of transaction of a particular block. In the propose storage [3], distributed file storage network is used for building a
model, the miners stores transaction on IPFS distributed file better web for us. The IPFS works with the content-addressed
system storage and get the returned IPFS hash of transaction technique to store and access of file.
into the block of the blockchain. The feature of the IPFS
network and its resultant hash reduce the size of transactions The distributed storage provides structure where data
in a block. To secure access of transaction for a particular is disseminated on different nodes, which refers the same
block content-addressed (IPFS hash) storage technique has distributed storage system. The each node is peers with
been proposed. We have applied this scheme on a transaction one another in the distributed network. The all peers keeps
which includes image storage on IPFS and hash storage same capabilities to share and access the files i.e., no one is
into the blockchain. In this paper, we have also proposed
the content-addressed technique in contrast to the location important and superior to others. Moreover, the distributed
addressed for the access of transaction. To implement the network also replicates the information which ensures the
framework we have used anaconda python, python flask, availability of information in the system.
and IPFS. IPFS(Interplanetary File System) provides distributed file
Index Terms—Blockchain, InterPlanetary File System(IPFS), storage system which facilitates connection with P2P net-
Distributed storage, Content-addressed technique.
work. The IPFS calculates the unique Hash of a file which
is accessible to all the peers in the network. The hash get
I. Introduction
modified every time when file gets updated [6].
Recently, the blockchain technology is emerging as a The IPFS is considered as the backbone of web 3.0 which
decentralized database storage technology [1]. Moreover, provides P2P decentralized file storage system and content-
the blockchain provides features such as immutable, shared, addressable technique to access the stored file [3]. IPFS
and decentralized database that stores history of assets and facilitate the distributed hash table (DHT) which is much
transactions across a distributed peer-to-peer network. The efficient than BitTorrent, and Git file storage system. IPFS
blockchain is successfully utilized in bitcoin developed by is also known as version controlled system which ensure
Satoshi Nakamoto but now it is gaining popularity in the the security, reliability, and scalability faced by the existing
various fields including healthcare, supplychain, and finan- file storage and sharing system. The same transaction has
cial sector [2]. the same hash in the IPFS that ensures the originality of
There are many distributed file storage applications cur- the content. The IPFS hash gets disseminated to all the
rently running all over the world. However, these applica- peers which also ensures the consistency among the peers.
tions are having problem of storage space and access with Interplanetary File system provides high throughput content-
other peers in the network. The BitTorrent is the distributed addressed block storage model which ensures security of
file storage and sharing application which provides the transactions.
facilities to coordinate with untrusted peers of the distributed IPFS provides a high throughput in terms of access using
network [4]. The more important and notable thing of the content-addressed block storage model, we also notice that
storage is a new challenge in blockchain technology owing to transaction data in blockchain. The transaction data (image
the append only features [4]. In this paper, we try to leverage file) is stored into the IPFS. Only the IPFS hash data is stored
the concept of decentralized P2P system in IPFS to eliminate as a transaction in the block of blockchain [14].
the limitations of blockhain storage and ensure data avail- Moreover, we provide the content-addressed techniques
ability along with reliability using IPFS and blockchain. In which creates permanent storage while access of transaction.
this paper, we have considered the blockchain transaction as The provided hash by the IPFS point the same transaction
a image File. exactly owing to the content-addressed technique. Moreover,
AIM: We propose a blockchain data storage model that the content-addressed has many implication from a access
illustrates how to use IPFS networks to reduce the storage perspective like transaction storage, and transaction access
of transaction size of block in blockchain. Moreover, we have on IPFS. Once the hash of transaction gets created then it
also used the content-addressed based access of transactions. can be accessed by other peers in the network efficiently
Organization:This paper is organized as follows Section-II without revealing of location of the transactions [3].
describe related work of blockchain in healthcare, Section-III
describe the proposed structure, Section-IV describe the Im- Motivation: - The work in this paper is motivated by the
plementation and Result of the proposed framework, Section- following observation from the Literature [10], [12], [13], we
V concludes the paper. have notice that storage is a challenge in blockchain network
owing to the append only feature [4]. In this paper, we have
II. Related Work proposed IPFS-based blockchain storage system which elimi-
The authors in [7]–[9] has reported that currently a com- nates the limitations of existing blockchain storage. We have
plete ledger of Bitcoin network occupies up to 200GB, and also proposed the content-addressed access of transaction
this number constantly increasing at about 0.1 GB per day, rather than simply location based access of transactions.
causing great pressure on data storage. Moreover, the work in
III. Proposed Structure
[8] proposed network coding-based distributed storage (NC-
DS) framework, which divides the transactions in different A. Work flow synchronization of Miners
block and again block into sub-block.The each sub-block is There are two major work flow is performed by miners
encoded and distributed to all the peers(nodes) in network. i.e, participating in network process and mining process.
This scheme reduced the transaction size into some extends Process of new peers synchronizations:
but at the same time it also increased the complexity using The newly peer(node) join the network must have
encoding and decoding process. synchronized with the existing distributed structure. The
The author in [10] adopted the method of recording block transaction made by the peer must be synchronized to
techniques which does not record the expired transaction maintain the consistency in network. To maintain the
history. The header information of expired transaction is synchronization in network all the newly join peers must
stored in the recording block technique. This approach re- have to follow the consensus of blockchain.
duces the size of block in blockchain but at the same time
traceability of the complete transaction is not possible owing Process of Mining
to the header part storage only. The mining is process in which all the transactions is
The authors in [12] adopted the summary block techniques verified before submissions to the block of blockchain by
which includes the active transaction records in blockchain. miners. The verification of transaction involves format of
These records are kept in external file and the remaining old transactions, input of transactions, and the transactions meet
transactions are deleted from the blockchain. This technique the requirement of consensus. once the transactions are
reduces the size of block in blockchain but the drawback verified then it gets deposited to the mining pool. To add the
of this technique is that it can not retain the history of transactions in a new block, the miners verify the previous
blockchain. block. Furthermore, the previous block hash is added to the
The authors in [13] has discussed the account-tree techniques new block before packed into a new block in blockchain. To
which only includes transactions of the peers who is part of successful addition of a new block, the miners solve a crypto-
the networks. In this approach the account of each peers are puzzle by calculating the block hash [15]. The miners who
recorded in off-chain(Database)storage and matched during first calculates the block hash disseminates the block to the
the transactions. However, this approach does not maintain other peers(nodes) in a blockchain network. The other nodes
record of old transactions. the following approach is suitable in the network mutually verify the correctness of block.
to reduce the size of block owing to the does not include Moreover, the verified block by the peers get added by the
the history of old transactions. The account-tree techniques other miners as a new block in blockchain network [16].
does not suitable for complete traceability of blockchain. As shown in Algorithm 1, the files are uploaded by
The above techniques has some limitations and drawback, the peers of the network. to store the files into the IPFS
and the size of the transactions is also not reduced effectively. distributed file storage ipfsapi has been used. The connection
In this paper, we are using blockchain and IPFS to manage of ipfs is established on the port number 5001. The hash
the block transactions. We are using image file as block value (Hv) is calculated in binary format and then hash of
247
2019 Fifth International Conference on Image Information Processing (ICIIP)
248
2019 Fifth International Conference on Image Information Processing (ICIIP)
249
2019 Fifth International Conference on Image Information Processing (ICIIP)
V. Conclusion
In this paper, we have designed the IPFS-based storage
model for blockchain to mitigate the drawback of storage
Fig. 7. Transaction access based on the IPFS hash and transaction access of a block in blockchain network. The
result of our IPFS storage model provides efficient storage
access the url must be followed ”localhost:8080/ipfs/<hash space owing to the content-addressed hash of the trans-
of file >” actions. Moreover, the content-addressed scheme is applied
E. IPFS Connection to access the transactions of block using the hash value
provided by the IPFS distributed storage. In the proposed
Fig.8, shows the connection of IPFS to see the details of model, we are storing the hash of the transaction rather than
status, files and peers on distributed environment. The status storing the complete transaction or original transaction to
describes bandwidth occupied by the IPFS during storage ensure the efficient storage scheme for blockchain network.
and access of transaction. As shown in Fig.9 and Fig.10, the our proposed structure of storage model can be utilized
details of all peers can be verified in IPFS such as how many with the other types of transaction files such as video and
peers are connected at a time and how many are accessing audio on blockchain. The existing storage model like bitcoin,
the resource on IPFS. The all peers are verified by the ”PEER ethereum, hyperledger suffers from the storage of bulky data
ID” and their ipfs address. Moreover we can also see the in the distributed ledger of blockchain network. Thus, our
peers location on IPFS. model can also be applied on existing storage model to
To establish the connection with IPFS the url must be reduce the size of each block.
followed ”127.0.0.1:5001/webui”.
References
F. Access of Bandwidth by IPFS
[1] Andreas, M., and Masteing Bitcoin. ”Unlocking Digital Cryptocurren-
The process of data storage and access on IPFS distributed cies.” (2015): 49-68.
network takes bandwidth which is shown in Fig. 11, There [2] Zheng, Z., Xie, S., Dai, H., Chen, X., & Wang, H. (2017, June). An
overview of blockchain technology: Architecture, consensus, and fu-
are two different types of bandwidth is occupied by the IPFS ture trends. In 2017 IEEE International Congress on Big Data (BigData
such as “IN” and “OUT” bandwidth. The “IN” bandwidth is Congress) (pp. 557-564). IEEE
250
2019 Fifth International Conference on Image Information Processing (ICIIP)
251