electronics

Article IOTA-BT: A P2P File- System Based on IOTA

Li-Yuan Hou, Tsung-Yi Tang and Tyng-Yeu Liang *

Department of Electrical Engineering, National Kaohsiung University of Science and Technology, Kaohsiung 807618, Taiwan; [email protected] (L.-Y.H.); [email protected] (T.-Y.T.) * Correspondence: [email protected]; Tel.: +886-7-3814526 (ext. 15508)

 Received: 31 August 2020; Accepted: 28 September 2020; Published: 1 October 2020 

Abstract: (BT) is the most popular peer-to-peer file-sharing system. According to official BT information, more than 100 million active users use BT for file transfers every month. However, BT mainly relies on either a central tracker (tracker) or (DHT) for locating file seeders while it runs a risk of a single point of failure or cyber-attacks such as Sybil and Eclipses. To attack this problem, we proposed a Peer-to-Peer (P2P) file-sharing system called IOTA-BT by integrating BitTorrent with IOTA in this paper. The advantages of IOTA over blockchain include scalability for high throughput, compatibility with Internet of Things (IoT) footprints, zero transaction fees, partition-tolerant, and quantum-resistant cryptography. The autopeering and neighbor selection of the Coordicide of IOTA is aimed at defending a Sybil or Eclipse attack. IOTA-BT inherits these advantages from IOTA. Moreover, our experimental results have shown that the cost of executing BT functions, such as releasing torrent files and retrieving seeder information on IOTA-BT, is acceptable for improving the security of BT. IOTA-BT can indeed efficiently provide users with a P2P file-sharing environment of higher security.

Keywords: P2P; file sharing; BitTorrent; blockchain; IOTA

1. Introduction Peer-to-Peer (P2P) file sharing [1] is a digital content sharing technology based on P2P networks, allowing users to cost-effectively books, music, movies, and software files. Without any doubt, BitTorrent [2] is the most well-known and used P2P file-sharing system. According to official BitTorrent (BT) information, more than 100 million active users use BT for file transfers every month. When BT was launched in 2001, it used a tracker to provide the seeder information for clients to their desiring file from the file seeders. Currently, BT usually applies a Distributed Hash Table (DHT) [3] to distribute the information of file seeders. By using a DHT, users obtain the location of seed nodes that own the file without a centralized tracker. Although the previous two methods are useful for clients to acquire information about file seeders, the central has a single point of failure. When the tracker fails or shuts down, the BT becomes unable to see the information of file seeders. In contrast, a DHT is vulnerable to cyber-attacks, such as Sybil [4], Eclipse, and Pollution [5]. With the consideration of system security, we try to develop a P2P file-sharing system based on the blockchain technology in this paper. Since Satoshi Nakamoto published BitCoin [6] in 2008, blockchain has drawn lots of attention from researchers. Not only does it use decentralized nodes to maintain the network to achieve decentralization, but it also uses a miner verification mechanism to generate tokens. Consequently, intangible assets in the virtual world can be brought into the real world to achieve a substantial asset transfer. BitCoin is undoubtedly the pioneer of virtual currency, allowing the world to see the potential of blockchain. Therefore, blockchain has become a hot research topic, and many blockchain-based applications, such as system design [7], product traceability [8], crowdsourcing [9],

Electronics 2020, 9, 1610; doi:10.3390/electronics9101610 www.mdpi.com/journal/electronics Electronics 2020, 9, 1610 2 of 15 energy markets [10], education credit [11], edge computing [12], and vehicular networks [13], have been proposed in recent years. In the Ethereum [14] network, a DHT is usually used as a selection mechanism of peer nodes. However, the maintenance of the blockchain network is Proof-of-Work (PoW) by miners. Although malicious nodes can enter and exit the network arbitrarily, they must make their computing power exceed 51% of the entire network if they want to launch an attack. Additionally, it is time-consuming to allow subsequent transactions to be attached to the illegal chain to make the tampered content valid. Therefore, malicious network attacks on the blockchain are not cheap. The consensus mechanism successfully maintains the security of the blockchain network. There have been many studies [15–17] using blockchain technology in related file storage applications to achieve access control, file ownership, and file originality. Although PoW can maintain the security of the entire blockchain, any transaction requires miners to verify, and it takes a certain amount of time to perform operations to verify the transaction, which makes blockchain transactions inefficient. To resolve this problem, some alternative ways of substantially speeding up blockchain transaction throughputs have been proposed in past research. For example, the Lightning network [18] is a second layer technology used for improving the transaction speed of blockchains. The second layer consists of multiple payment channels between two users. Using the channels, the users can make or receive payments from each other. The transactions in the channels are updated to the blockchain only when two users open and close a channel. However, a failure at one lightning node may easily crash the entire network. Besides, lightning networks are vulnerable to cyber-attacks because they are required to be online at all times. RapidChain [19] is a solution proposed to solve the bottleneck of low transactions per second (TPS), low scalability, and low storage capacity of BitCoin. The consensus mechanism in the RapidChain system is to form a reference committee by nodes and introduce the concept of epoch to iterate the members of the reference committee. Since the routing protocol between the client and the committee refers to Kad (Kademlia), the composition of the committee is continuously updated to avoid Sybil attacks. Polkadot [20] is aimed at creating a network protocol to solve the isolation of the blockchain. By establishing a multi-chain architecture, all different blockchains connected to this architecture can exchange information. To achieve this goal, Polkadot uses Parachain for data calculation and transaction information processing. Through multiple parallel chains, the horizontal expansion of the blockchain can be achieved to improve the performance of blockchains. On the other hand, Polkadot uses Relaychain to verify the blocks given by each Parachain and provide proof of finality. Omnilayer [21] is a software layer built on top of BitCoin, which provides users with a distributed and peer-to-peer platform for trading. The advantage of Omnilayer is its ability to support user-generated currencies and smart property while its drawback is that it is inherently vulnerable to malicious attacks. Although the previous distributed technologies are useful for improving the performance of blockchains, they are dependent on miners and need pay fees for transaction proof. Therefore, they are not cost-effective for a voluntary file-sharing environment such as BitTorrent. Fortunately, the emergence of IOTA [22] has dramatically improved the efficiency of blockchain transaction verification. It abandoned the chain structure of the previous blockchain and used DAG (Directed Acyclic Graph) to form its Tangle network. Whenever users need to post a transaction, they only need to verify two past transactions to complete the transaction process, which significantly improves the throughput and scalability of the blockchain. More important is that IOTA supports zero transaction fees and does not rely on miners for transaction proof. Therefore, IOTA has been widely used in the Internet of Things. For example, the IOTA Data Market [23] cooperates with many well-known companies for secure storage and transactions. Bilal Shabandri [24] et al. proposed publishing data collected by IoT devices (such as smart meters and smart charging systems) to the Tangle network for enhancing privacy and security. As previously described, we propose an IOTA-based BitTorrent system called IOTA-BT for P2P file sharing in this paper. By replacing the central tracker, it solves a single point of failure and avoids Electronics 2020, 9, 1610 3 of 15 the problem of DHTs being vulnerable to cyber-attacks because it inherits the advantages of IOTA. When a BT client attempts to be the seeder of a file, it publishes the seeder information to the IOTA network. When other clients want to download the file, they can query the transaction content on any IOTAElectronics node, and 2020, then 9, x FOR know PEER theREVIEW seeder and file information. Therefore, the proposed system3 of supports15 the distributed query and ensures the accuracy of information. In addition, this research tries to add a network. When other clients want to download the file, they can query the transaction content on any timestamp when BT clients are seeding so that later other clients can quickly find the latest information IOTA node, and then know the seeder and file information. Therefore, the proposed system supports aboutthe the distributed seeder nodes. query and ensures the accuracy of information. In addition, this research tries to add Thea timestamp remaining when chapters BT clients of this are paperseeding are so organized that later other asfollows. clients can Section quickly2 introduces find the lates relevantt backgroundinformation knowledge. about the seeder Section nodes.3 describes the framework of IOTA-BT. Section4 discusses the efficiency ofThe the remaining proposed chapters system. of Sectionthis paper5 presents are organized the conclusions as follows. ofSection this paper 2 introduces and our relevant future work. background knowledge. Section 3 describes the framework of IOTA-BT. Section 4 discusses the 2. Backgroundefficiency of the proposed system. Section 5 presents the conclusions of this paper and our future work. 2.1. BitTorrent 2. Background The communication of the BT network is mainly dependent on HTTP, and the transmission content is mainly2.1. BitTorrent the information recorded in the torrent file. The text encoding of the seed file adopts Bencode. The main contentThe communication consists of the of the file BT name network (name), is mainly the URL dependent list of the on tracker HTTP, (announce),and the transmission theSHA-1hash valuecontent of the fileis mainly information the information (infoHash), recorded the inpath the torrent and capacityfile. The text of encoding a single file,of the the seed description file adopts of the nameBencode. (file), the The size main of allcontent files consists (length), of andthe file the name size ( ofname each), the file URL segment list of the (pieceLength). tracker (announce Whenever), a clientthe wantsSHA- to1hash download value of athe file file on information the BT network, (infoHash the), the seed path file and of capacity this file of must a single be file, obtained the first. Baseddescription on the information of the name recorded (file), inthe the size seed of file,all files the client(length can), and determine the size if of it each currently file segment owns some of (pieceLength). Whenever a client wants to download a file on the BT network, the seed file of this file the blocks of the file or not and then request the remaining blocks from the reverse node, and finally, must be obtained first. Based on the information recorded in the seed file, the client can determine if combineit currently all the blocksowns some into of a the complete blocks of file. the file or not and then request the remaining blocks from the Thereverse original node, BTandnetwork finally, combine is mainly all the composed blocks into of a complete a peer and file. tracker. The tracker belongs to the client–serverThe architecture. original BT networkIt is responsible is mainly forcomposed maintaining of a peer the seederand tracker. lists ofThe files. tracker When belongs a peer to requests the the tracker,client the– trackerserver architecture. returns the seeder It is responsible list to the for peer maintaining for subsequent the seeder node lists communication of files. When and a peer file transfer. Peer isre aquests client the node tracker, that the has tracker a unique returns peer the ID seeder with list a length to the peer of 20 for bytes. subsequent A peer node can communication download and seed a and file transfer. Peer is a client node that has a unique peer ID with a length of 20 bytes. A peer can specific file to become the seeder of this file. If a peer wants to know other peers that own a specified file, it download and seed a specific file to become the seeder of this file. If a peer wants to know other peers must relythat onown the a specified tracker’s file, assistance it must rely to on know the tracker the information’s assistance of to the know seeders the information that have of the the required seeders file. Thethat basichave the seeding required process file. is shown in Figure1. After a client generates a seed file for a specified file, it createsThe basic a connection seeding process request is shown to the in trackerFigure 1. andAfter sends a client the generates peer ID, a seed IP, file port, for anda specified status of its nodefile, to the it creates tracker. a connection Then, the request tracker to the creates tracker aand peer sends list the according peer ID, IP, to port, its and corresponding status of its node infoHash, whichto records the tracker. the received Then, the node tracker information, creates a peer and list then according returns to the its peercorresponding list and the infoHash, interval which parameters of therecords heartbeat the received to the peer. node Afterinformation, each heartbeat and then return intervals the time peer islist reached, and the interval the client parameters must send of node the heartbeat to the peer. After each heartbeat interval time is reached, the client must send node information again to let the tracker confirm that the client is still alive. Besides, it waits for file requests information again to let the tracker confirm that the client is still alive. Besides, it waits for file requests from otherfrom other clients clients for thefor the rest rest of of the the time. time.

FigureFigure 1. 1.The The seedingseeding process process of ofBitTorrent BitTorrent (BT) (BT)..

Electronics 2020, 9, 1610 4 of 15 Electronics 2020, 9, x FOR PEER REVIEW 4 of 15

OnOn the the other other hand, hand, the the file file download download processprocess is shown in in Figure Figure 2.2. A A client client must must use use the the seed seed file to sendfile to a requestsend a request to the trackerto the tracker recorded recorded in the in file the content. file content. After After receiving receiving the seederthe seeder list andlist and heartbeat parameters,heartbeat itparameters, sends the fileit sends request the file to therequest seeders to the recorded seeders inrecorded the peer in listthe andpeer waitslist and for waits the seedersfor to replythe and seeders receive to reply the fileand partitionsreceive the comingfile partitions from coming the seeders. from the The seeders. client The confirms client confirms if the file if partitionsthe file partitions are the same as those recorded in the seed file to ensure the integrity of the file. After are the same as those recorded in the seed file to ensure the integrity of the file. After receiving all the receiving all the file partitions, the client can assemble these file partitions to form the complete file. file partitions, the client can assemble these file partitions to form the complete file. At the same time, At the same time, it can choose to become a seed of the file to serve other clients that need the same it canfile. choose to become a seed of the file to serve other clients that need the same file.

Figure 2 2.. TheThe download download process process of BT of. BT.

BecauseBecause the the tracker tracker has has the the risk risk ofof aa singlesingle point of of failure, failure, it itcannot cannot stably stably provide provide the thequality quality of fileof transmission. file transmission. Therefore, Therefore, the the current current BT BT network network adopts adopts a a DHT DHT (Distributed (Distributed Hash Table Table)) for for node node information exchange. DHTs discard the centralized server and hashes the nodes and data into information exchange. DHTs discard the centralized server and hashes the nodes and data into values. values. The value of the node is its node number in the DHT network, and the value of the data is the Thetarget value node of the for node storage. is its By node dispersing number the ininformation the DHT in network, the nodes and of the DHT value network, of the data the single is the target nodepoint for ofstorage. failure By problem dispersing generated the information by the centralized in the server nodes is of solved. the DHT BT’s network, DHT network the single uses point of failureKademlia problem (Kad) generated[25]. The contents by the centralized of the hash server list stored is solved. in Kad BT’s are DHTdescribed network as follows. uses Kademlia(1) (Kad)Keywords: [25]. The it contentsis used to ofquery the the hash corresponding list stored in file Kad name are or described information. as follows. Performi (1)ng SHA Keywords:-1 hashing it is used to queryof the thekeywords corresponding to obtain a fileresult name with or 160 information. bits as the key, Performing the corresponding SHA-1 result hashing is the of file the message keywords to obtainlist. a(2 result) File index: with 160according bits as to the the key, query the result, corresponding the node that result owns is a the file fileis found. message The list.SHA (2)-1 hash File index: accordingvalue of to the the file query is used result, as the the key. node The corresponding that owns a file value is found. is the information The SHA-1 of hash the node. value In of Kad, the file is usedthe as node the key.length The is 160 corresponding bits, the same value as peer is theID. informationThe distance ofbetween the node. nodes In is Kad, not based the node on the length is physical distance or the number of routers, but the XOR method is used for judgment. Assume that 160 bits, the same as peer ID. The distance between nodes is not based on the physical distance or the the two nodes are a and b, respectively. The distance d is equal to a XOR b. The smaller the value of numberd is, the of routers,closer the but nodes the are. XOR Kad method represents is used the forkey judgment.of the keyword, Assume file index, that the and two node nodes ID by are 160 a and b, respectively.bits to simplify The distancethe query dformat is equal so that to a any XOR query b. The uses smaller the same the format value input of d to is, achieve the closer the thedesired nodes are. Kadpurpose. represents the key of the keyword, file index, and node ID by 160 bits to simplify the query format so that anyIn the query past usesdecade, the some same research format has input been to conducted achieve the for desired the improvement purpose. and application of BitTorrent.In the past For decade, example, some F. Costa research et al. [ has26] applied been conducted the data distribution for the improvement technique of andBitTorrent application to of BitTorrent.the BOINC For middleware. example, F. Their Costa goal et al. was [26 to] applieddecentralize the dataBOINC distribution’s data model technique to take ofadvantage BitTorrent of to the BOINCclient middleware. network capabilities. Their goal Michael was Burford to decentralize [27] proposed BOINC’s using data HTTP model or FTP to servers take advantage as seeds for of client networkBitTorrent capabilities. . Michael As this Burford is supported [27] proposed in widespread using clients, HTTP seeding or FTP for servers a BitTorrent as seeds download for BitTorrent could be conducted entirely with a company or personal HTTP/FTP servers. Florian Adamsky et al. downloads. As this is supported in widespread clients, seeding for a BitTorrent download could [28] demonstrated that the BitTorrent protocol family is vulnerable to distributed reflective denial- be conductedof-service (DRDoS entirely) attacks. with aTheir company experiments or personal reveal that HTTP an /attackerFTP servers. can exploit Florian BitTorrent Adamsky peers et to al. [28] demonstratedraise network that traffic the BitTorrent dramatically. protocol Additionally family, is they vulnerable observed to thatdistributed the most reflective popular denial-of-service BitTorrent (DRDoS)clients attacks.are the most Their vulnerable experiments ones. reveal A. Bhakuni that an et attacker al. [29] canproposed exploit a BitTorrentdetection-cum peers-punishment to raise network traffi c dramatically. Additionally, they observed that the most popular BitTorrent clients are the most vulnerable ones. A. Bhakuni et al. [29] proposed a detection-cum-punishment mechanism to detect and punish free-riders in the P2P network. Their experimental results prove that the proposed Electronics 2020, 9, x FOR PEER REVIEW 5 of 15

Electronics 2020, 9, 1610 5 of 15 mechanism to detect and punish free-riders in the P2P network. Their experimental results prove that the proposed punishment mechanism improves the performance of the P2P network by decreasing thepunishment download mechanism times of non improves-free-rider the performancepeers of the network of the P2P and network punishes by decreasingfree-riders theby increasing download theirtimes download of non-free-rider times. R. peers Bindal of et the al. network [30] proposed and punishes a biased free-riders neighbor selection by increasing approach their to download enhance BitTorrenttimes. R. Bindal traffic et locality. al. [30] proposedThe simulation a biased result neighbor showed selection that the approach proposed to enhanceapproach BitTorrent maintains tra theffic nearlylocality. optimal The simulation performance result of showedBitTorrent that in thea variety proposed of environments approach maintains and reduces the nearly the cross optimal-ISP traffic.performance of BitTorrent in a variety of environments and reduces the cross-ISP traffic. On the otherother hand,hand, the the IPFS IPFS (InterPlanetary (InterPlanetary File File System) System [31) ][31 recently] recently received received much much attention attent fromion fromresearchers. researchers. IPFS is IPFS a protocol is a protocol and peer-to-peer and peer network-to-peer that network combines that the combines four mature the fourtechnologies, mature technologies,including BitTorrent, including Git, BitTorrent, DHT, and Git, SFS DHT, (self-certified and SFS naming)(self-certified technology. naming It) allowstechnology. participants It allows in participantsthe network in to the communicate network to withcommunicate each other with for storing,each other requesting, for storing, and requesting, transmitting and verifiable transmitting data. verifiableIts operating data. principle Its operating is to divideprinciple files is into to divide blocks files to be into hashed blocks and to savebe hashed them inand blocks save tothem avoid in blocksduplicate to avoid files on duplicate the Internet. files on However, the Internet. the files However, in IPFS the must files be in broadcasted IPFS must tobe avoid broadcasted file-access to avoidfailure file after-acc aess single failure point after of oaffl singleine. In point contrast, of offline. BT nodes In contrast, can freely BT enter nodes and can exit freely the network, enter and share, exit theand network, download share, files. and Since download IPFS also files. uses Since a DHT IPFS for locatingalso uses which a DHT node for haslocating the target which file, node it faces has the the targetsame securityfile, it faces problem the same existing security in BT. problem existing in BT.

2.2. IOTA IOTA IIOTAOTA is a decentralized ledger technology proposed by David Sønstebø, Sergey Sergey Ivancheglo, Ivancheglo, Dominik Schiener, and Dr. Serguei Serguei Popov Popov in in 2015. It It is is dedicated dedicated to to the the Internet Internet of of Things and MachineMachine-to-Machine-to-Machine (M2M)(M2M)communication communication and and is is also also applicable applicable to P2Pto P2P file sharing. Compared. Compared with withBitCoin BitCoin and Ethereum,and Ethereum, IOTA IOTA uses Tangleuses Tangle to store to transactions,store transactions, as shown as shown in Figure in Figure3. 3.

Figure 3. TangleTangle network network..

InIn the the Tangle Tangle network, network, except except for the for first the genesis first genesis transaction transaction (genesis), (genesis the rest) of, the the transactions rest of the transactionsare initiated are using initiated the Markov using Chainthe Markov Monte Chain Carlo Monte (MCMC) Carlo algorithm (MCMC to) algorithm select two to transactions select two transactionsand verify if and they verify are legal. if they Since are IOTAlegal. Since needs IOTA to verify needs the to other verify two the transactions other two transactions when initiating when a initiatingtransaction, a transaction, the more transactions the more transact initiatedions per initiated unit time, per the unit higher time, thethe throughputhigher the throughput of transaction of transactionverification, verification,thereby eliminating thereby the eliminating dependence the of dependencethe distributed of ledger the distributed on miners. ledger IOTA transactions on miners. IOTA(TX) can transactions be divided (TX into) can Input be divided TX and into Output Input TX. TX Input and O TXutput is used TX. Input to withdraw TX is used money to withdraw from the monaddressey from and cannotthe address be a zero-value and cannot transaction. be a zero-value Output transaction. TX can be usedOutput to collectTX can payments be used to or collect record paymentsdata and can or record be valued data or and zero-value can be valued transactions. or zero-value Several transactions. transactions Several are made transactions into a bundle are made and intochecked a bundle by the and IOTA checked nodes. by The the sumIOTA of nodes. value inThe abundle sum of mustvalue be in 0 a to bundle prove must that the be transaction0 to prove that is a thebreak-even. transaction Moreover, is a break all-even. transactions Moreover, in the all bundletransactions are either in the accepted bundle orare rejected. either accepted After the or bundle rejected. is Afteraccepted, the bundle the internally is accepted, recorded the internally transactions recorded are added transactions to the Tangle are added ledger. to the Tangle ledger. InIn terms of implementation,implementation, IOTAIOTA referencereference implementationimplementation (IRI) (IRI) has has been been proposed, proposed, which which is is a aset set of of JAVA JAVA open-source open-source software. software. The The client client cancan joinjoin thethe IOTAIOTA networknetwork as a node by executing executing IRI. IRI. The main functions of IRI are (1)(1) verifying transactions, ( (2)2) storing and diss disseminatingeminating transactions, transactions, and ( (3)3) interacting with the client library. In message transmission, IRI IRI uses uses the gossip protocol to disseminate transactions. transactions. When When the the IRI IRI node node receives receives the the transaction transaction sent sent by by the the neighbor neighbor node, node, it comparesit compares its its database. database. If Ifthe the transaction transaction is isnot not stored stored in in the the database, database, it it is is verified verified and and stored stored in in the the database, and then is forwarded to other neighbors.

Electronics 2020, 9, 1610 6 of 15

When the client wants to initiate a transaction, the process is described as follows. (1) Prepare Input and Output TX and add them to the bundle. The sum of the bundle value must be zero. (2) Hash Electronics 2020, 9, x FOR PEER REVIEW 6 of 15 the address, value, tag, timestamp, currentIndex, lastIndex, and other information in all TXs through the spongeWhen function the client to generate wants to a initiate bundle a hashtransaction, and fill the the process bundle is hashdescribed into theas follows. TX. (3) ( Use1) Prepare the bundle hashI andnput private and Ou keytputto TX generate and add the the signaturem to the bundle. of Input The TX sum and of fill the the bundle signature value intomust Input be zero. TX. ( (4)2) Use API’sHash getTransactionsToApprove the address, value, tag, timestamp to obtain, currentIndex, Tips from IRIlastIndex, and fill and in other trunk information and branch in all in TXs each TX. (5) Performthrough PoWthe sponge for each function TX in to the generate bundle a bundle and fill has theh and hash fill into the bundle nonce. ha (6)sh Sendinto the the TX. bundle (3) Use to IRI the bundle hash and private key to generate the signature of Input TX and fill the signature into Input for verification, storage, and broadcasting to complete the transaction initiation. On the other hand, TX. (4) Use API’s getTransactionsToApprove to obtain Tips from IRI and fill in trunk and branch in the transaction query process is as follows: (1) Call the findTransaction function by the hash values of each TX. (5) Perform PoW for each TX in the bundle and fill the hash into nonce. (6) Send the bundle bundle,to IRI address, for verification, tags, and storage, approves and to broadcasting return the hashto complete value ofthe the transaction transaction. initiation. (2) Call On thethe getBundleother functionhand, to the view transaction the detailed query transaction process is as content follows: by (1 parsing) Call the the findTransaction hash value. function by the hash Tovalue proves of bundle, the ownership address, tags, of theand messageapproves to and return prevent the has interferenceh value of the from transaction. spam, ( IOTA2) Call usesthe the frameworkgetBundle of function MAM (Masked to view the Authenticated detailed transaction Message). content The by parsing basic principle the hash value. of MAM is to use the cotyledonsTo of prove the Merkle the ownership hash tree of to the generate message a signature.and prevent The inter rootference generates from anspam, address. IOTA Theuses signature the preventsframework the sender of MAM from being(Masked impersonated. Authenticated The Message root is) used. The to basic calculate principle the addressof MAM where is to use the messagethe is sentcotyledons and record of the the root Merkle of thehash next tree generation to generate hash a signature. tree. Through The root the generationalgenerates an address.alternation The of the signature prevents the sender from being impersonated. The root is used to calculate the address hash tree, IOTA prevents sending messages to the same address for a long time to avoid spam attacks. where the message is sent and record the root of the next generation hash tree. Through the According to the white paper of Coordicide [32], IOTA adopts a Sybil protection mechanism based generational alternation of the hash tree, IOTA prevents sending messages to the same address for a on manalong thattime isto regardedavoid spam as attacks. a hard to obtain resource as well as a form of a reputation, which can be assignedAccording to trustworthy to the nodes.white paper As mana of Coordicid is creditede [32 as], IOTA part ofadopts regular a Sybil transactions, protection nodesmechanism need not alwaysbased use on their mana account’s that is regarded private keys as a hard to sign, to obtain and then resource avoid as a well severe as securitya form of risk.a reputation, Besides, which IOTA uses an autopeeringcan be assigned mechanism to trustworthy to make nodes. new As nodes mana easily is credited join theas part network of regular and transactions, avoid an attacker nodes need targeting specificnot nodesalways duringuse their the account peering’s private process. keys On to thesign, other and then hand, avoid Bitinfocharts a severe security [33] and risk. Etherscan Besides, [34] revealIOTA that uses the block an autopeering time is 13.2 mechanism s and the to value make of new TPS nodes is 12.5 easily in thejoin Ethereum the network network. and avoid If aan client intendsattacker to add target a transactioning specific nodes into the during blockchain the peering in two process. minutes, On the it mustother hand spend, Bitinfochart 150 Gwei,s which[33] is and Etherscan [34] reveal that the block time is 13.2 s and the value of TPS is 12.5 in the Ethereum about USD 1.13. In contrast, the client in the IOTA mainnet adds a transaction bundle into the Tangle network. If a client intends to add a transaction into the blockchain in two minutes, it must spend 150 only by verifying another two bundles, and it need not pay anything. The IOTA 1.5 office report Gwei, which is about USD 1.13. In contrast, the client in the IOTA mainnet adds a transaction bundle depictsinto the the value Tangle of only TPS by as oververifying 1000. another IOTA two is more bundles, efficient and andit need economical not pay anything. than Ethereum The IOTA for 1.5 clients. As previouslyoffice report discussed, depicts the this va studylue of exploits TPS as IOTAover 1000. instead IOTA of Ethereum is more efficient to implement and economical the BT framework than basedEthereum on the distributed for clients. ledgerAs previously technology. discussed, this study exploits IOTA instead of Ethereum to implement the BT framework based on the distributed ledger technology. 3. IOTA-BT 3. IOTA-BT The architecture of IOTA-BT is shown in Figure4. It uses the original BT tracker mechanism but discards theThe previousarchitecture centralized of IOTA-BT settings is shown and in Figure runs the 4. It tracker uses the on original each client.BT tracker The mechanism main functions but of the localdiscards tracker the previous include packagingcentralized nodesettings information and runs the into tracker transactions on each client. and sendingThe main them functions to IOTA of for the local tracker include packaging node information into transactions and sending them to IOTA for storage, searching for transactions containing node information, assisting the client in disseminating storage, searching for transactions containing node information, assisting the client in disseminating and collecting node information, seeding and downloading. and collecting node information, seeding and downloading.

FigureFigure 4. 4. IOTA-BTIOTA-BT architecture architecture..

Electronics 2020, 9, 1610 7 of 15

Electronics 2020, 9, x FOR PEER REVIEW 7 of 15 Client-side operations include creating the torrent file, seeding, and downloading. In IOTA-BT, file publishersClient-side must operations store their include seed creating files in the IOTA, torrent as shownfile, seeding, in Figure and downloading.5. The process In isIOTA described-BT, as follows:file publishers (1) Generate must a store seed their file forseed the files specified in IOTA, file as throughshown in BT Figure Client. 5. The (2) process Pack the is seeddescribed file andas time stampfollows: with ( the1) G MAMenerate message a seed file and for the enter specified the transaction file through initiation BT Client. process. (2) Pack the (3) seed Combine file and transactions time intostamp bundles with through the MAM the message prepareTransfers and enter the function. transaction (4) initiation Use getTransactionsToApprove process. (3) Combine transactions to request IRI, performinto b tipundles select through to verify the twoprepareTransfers pieces of data function. and return (4) Use the getT TX hashransactionsToApprove of the two transactions. to request (5) Send the transactionIRI, perform tip and select TX hashto verify to thetwo PoWpieces node of data for and proof return of the workload TX hash byof the attachToTangle. two transactions. (6) (5 Finally,) Send the transaction and TX hash to the PoW node for proof of workload by attachToTangle. (6) the transaction is stored and broadcasted by IRI through storeTransactions and broadcastTransactions. Finally, the transaction is stored and broadcasted by IRI through storeTransactions and After completing the publishing process, the client can start file seeding and become the seeder for file broadcastTransactions. After completing the publishing process, the client can start file seeding and sharing.become Users the seeder can use for the file rootsharing. to perform Users can the use MAM the ro transactionot to perform query the MAM and transaction can acquire query the detailand and releasecan timeacquire of the the detail seed and file. release time of the seed file.

FigureFigure 5. PublishingPublishing process process in IOTA in IOTA-BT.-BT.

To successfullyTo successfully share share files files with with other other users, users, the the file file owner owner must must seed seed the the files files and and become become aa seeder seeder for transmitting the file to the users in need. The seeding process of IOTA-BT is shown in for transmitting the file to the users in need. The seeding process of IOTA-BT is shown in Figure6. Figure 6. The seeder in IOTA-BT must have the entire shared file and the MAM Root when the file is The seeder in IOTA-BT must have the entire shared file and the MAM Root when the file is released. released. TheThe seeding seeding process process consists consists ofof the following steps: steps: (1) (1) The The client client generates generates torrent torrent for a given for a given file andfile and obtains obtains the the infoHash infoHash of of thethe file.file. ( (2)2) Send Send infoHash, infoHash, root, root, and and node node information information to theto local the local tracker.tracker. (3) (3 After) After receiving receiving thethe requestrequest analysis, analysis, the the local local tracker tracker uses uses the theroot rootto query to query the MAM the MAM messagemessage to obtainto obtain the the timestamp timestamp and and the the seed seed file. file. (4)(4) GenerateGenerate the the designated designated address address for for sending sending the transactionthe transaction through through generateAddress. generateAddress. (5) ( Record5) Record the the own own node node information information in the transaction transaction and sendand the send transaction. the transaction. (6) Query (6) Query all transactions all transactions under under the specifiedthe specified transaction transaction address address and and obtain all transactionobtain all transaction hash. (7) hash. Perform (7) Perform transaction transaction hash hash decoding decoding to to obtain obtain the the bundlebundle list list and and return return the the transactions in the bundle. (8) After receiving the list of nodes recorded in the transaction, the transactions in the bundle. (8) After receiving the list of nodes recorded in the transaction, the local local tracker creates a peer list of the specified infoHash in its database (Swarm), records all node tracker creates a peer list of the specified infoHash in its database (Swarm), records all node information information in the list, and returns the peer list to the client. As previously described, clients do not in theneed list, to download and returns and the scan peer the entire list to Tangle the client. to find Astransactions previously of interest described, related clients to IOTA do-BT. not need to download and scan the entire Tangle to find transactions of interest related to IOTA-BT.

Electronics 2020, 9, 1610 8 of 15

ElectronicsElectronics 2020 20,20 9,, x9 ,FOR x FOR PEER PEER REVIEW REVIEW 8 of8 15of 15

FigureFigure 6. SeedingSeeding process process in inIOTA IOTA-BT.-BT. Figure 6. Seeding process in IOTA-BT. WhenWhen the the IOTA-BT IOTA-BT clientclient obtains obtains the the MAM MAM Root Root of a ofshared a shared file, it can file, download it can download the file. Th thee file. download process is shown in Figure 7. (1) Use the root to query MAM transactions and obtain seed The downloadWhen the processIOTA-BT is client shown obtains in Figure the 7MAM. (1) Use Root the of roota shared to query file, it MAM can download transactions the file. and Th obtaine files recorded in transactions. (2) Determine whether to proceed with the download process by seeddownload files recorded process is in shown transactions. in Figure (2)7. ( Determine1) Use the root whether to query to MAM proceed transactions with the downloadand obtain seed process comparing the size of the file it owns with that recorded in the seed file. (3) If the previous step byfiles comparing recorded the in transactions.size of the file (2) it Determine owns with whether that recorded to proceed in the with seed the file. download (3) If the process previous by step comparingdetermines the to size proceed of the with file the it download owns with process, that recorded the client inperforms the seed the file. heartbeat (3) If processthe previous to obtain step determinesthe peer tolist. proceed (4) Send withfile request the download inquiries process,to each node the recorded client performs in the peer the list heartbeat and ask whether process the toobtain determines to proceed with the download process, the client performs the heartbeat process to obtain the peernode has list. the (4) specified Send file file request block. If inquiriesthe node has to the each file node block, recorded it sends the in file the block peer to list the andclient. ask After whether the peer list. (4) Send file request inquiries to each node recorded in the peer list and ask whether the the nodereceiving has all the file specified blocks, the file cl block.ient assembles If the node the file has blocks the file to form block, a complete it sends file. the file block to the client. node has the specified file block. If the node has the file block, it sends the file block to the client. After After receiving all file blocks, the client assembles the file blocks to form a complete file. receiving all file blocks, the client assembles the file blocks to form a complete file.

Figure 7. Download process in IOTA-BT.

To filter invalid node information, IOTA-BT sets an expiration date for node information. As a Figure 7. Download process in IOTA-BT. result, outdated information becomesFigure invalid 7. Download over time. process The inclie IOTA-BT.nt must register periodically to make others know it is alive to provide file transfer services. However, the continuous registration of the To filter invalid node information, IOTA-BT sets an expiration date for node information. As a sameTo filter address invalid also increases node information, the cost of searching IOTA-BT for sets transactions. an expiration Therefore, date this for noderesearch information. adopts the As a result,result, outdated outdated informationinformation becomes invalid invalid over over time. time. The The clie clientnt must must register register periodically periodically to make to make others know it is alive to provide file transfer services. However, the continuous registration of the others know it is alive to provide file transfer services. However, the continuous registration of the samesame address address alsoalso increasesincreases the cost cost of of searching searching for for transactions. transactions. Therefore, Therefore, this this research research adopts adopts the the

Electronics 2020, 9, 1610 9 of 15

Electronics 2020, 9, x FOR PEER REVIEW 9 of 15 time difference registration method proposed by Tsung-Yi Tang [35]. The principle of the method is time difference registration method proposed by Tsung-Yi Tang [35]. The principle of the method is shown in Figure8. shown in Figure 8.

Figure 8. TTimeime difference difference registration registration method method..

IOTA’sIOTA’ natives native address address generation generation is is to to generate generate a seta set of addressesof addresses by by hashing hashing a seed a seed with with a length a oflength 81 tryte of and81 tryte a positive and a integerpositiveindex. integer Each index. address Each address can be usedcan be repeatedly used repeatedly if there if is there no amount is no of moneyamount transfer of money behavior, transfer and behavior, a single and address a single can address contain can multiple contain transactions. multiple transactions. If there is If a there transfer behavior,is a transfer the behavior, balancewill the balance be transferred will be transferred to the address to the of address the next of index the next for index storage. for storage. In this study,In thethis root study, of the the MAM root message of the MAM recorded message in the recorded seed file in was the used seed as file the wa seeds used of the as generated the seed of address, the generated address, and the time difference between the current time and the release time of the MAM and the time difference between the current time and the release time of the MAM message was used message was used as the index to form a time difference address for node registration. As a as the index to form a time difference address for node registration. As a consequence, the newest consequence, the newest node information can be registered at the latest time address. When a client node information can be registered at the latest time address. When a client searches for the seeder of a searches for the seeder of a specific file, it can efficiently obtain the newest node information in the specific file, it can efficiently obtain the newest node information in the latest time slot. For example, latest time slot. For example, after obtaining the root of the MAM message, a client registers at time afterpoint obtaining A and packs the rootits node of the information MAM message, into a message, a client and registers sends atit to time a designated point A and address, packs which its node informationis generated into as follows: a message, (1) calculate and sends the gap it to between a designated the time address, stamp in which the MAM is generated message and as follows:time (1)point calculate A. (2) theDivide gap the between gap by the the time length stamp of a intime the slot MAM to obtain message the slot and index time value point for A. (2)storing Divide the the gapmessage. by the ( length3) Perform of a address time slot generation to obtain by the using slot the index slot valueindex forvalue storing and MAM the message. message r (3)oot. Perform The addressprevious generation process will by usingbe executed the slot again index when value registration and MAM is message performed root. next The time previous (time processpoint B) will. beWhen executed clients again need whento know registration the latest information, is performed they next only time need (time to query point in B).the Whenlatest slot clients to obtain need to knowthe currently the latest alive information, node information. they only needTherefore, to query it is in useful the latest for filtering slot to obtain out the the expired currently node alive nodeinformation information. and reducing Therefore, unnecessary it is useful data for search filtering time. out the expired node information and reducing unnecessary data search time. 4. Performance Evaluation 4. Performance Evaluation We have evaluated the performance of IOTA-BT on IOTA public chain in this paper. In an experimentalWe have evaluatedenvironment, the we performance set up three ofIRI IOTA-BTnodes located on IOTA on Tokyo public Japan, chain London in this U.K, paper. and Los In an experimentalAngeles U.S environment,by using virtual we machines set up three from IRI the nodes Google located Cloud onPlatform, Tokyo Japan,and built London up one U.K, IRI node and Los Angelesby one PC U.S in by our using lab. These virtual four machines nodes were from used the for Google transaction Cloud listening Platform, and and broadcasting. built up oneThe IRI nodecommunication by one PC inbetween our lab. clients These and four IRI nodesnodes wererelied usedon HTTP for transaction-ping. Besides, listening the IRI andnodes broadcasting. adopted TheZMQ communication (zero message betweenqueue) to clients acceptand and IRIlisten nodes to transactions. relied on HTTP-ping. According to Besides, our estimation, the IRI the nodes adoptedaverage ZMQ cost of (zero HTTP message-ping was queue) 0.0473 to ms, accept and andthe average listen to time transactions. cost of transaction According broadcasting to our estimation, was the425.656 average ms. cost On the of HTTP-ping other hand, wasthe client 0.0473 node ms, used and thein this average performance time cost evaluation of transaction was one broadcasting PC that has one Intel i7-8700 CPU and one Nvidia 1080Ti graphic cards and 32GB RAM. Its job was mainly was 425.656 ms. On the other hand, the client node used in this performance evaluation was one PC to do transaction storing, broadcasting, and PoW. On the other hand, IOTA-BT API was deployed by that has one Intel i7-8700 CPU and one Nvidia 1080Ti graphic cards and 32GB RAM. Its job was mainly OpenFass, and the client performed transaction packing and transferring. The time interval of to do transaction storing, broadcasting, and PoW. On the other hand, IOTA-BT API was deployed heartbeats was set as 3 min. Our experiments were focused on the costs of releasing transactions and by OpenFass, and the client performed transaction packing and transferring. The time interval of

Electronics 2020, 9, 1610 10 of 15

Electronics 2020, 9, x FOR PEER REVIEW 10 of 15 heartbeatsElectronics 20 was20, 9, setx FOR as PEER 3 min. REVIEW Our experiments were focused on the costs of releasing transactions10 of 15 and torrent files and the cost of obtaining seeder information. Our experimental results are discussed torrent files and the cost of obtaining seeder information. Our experimental results are discussed as as follows. follows. First, publishing an IOTA transaction needs five steps: bundle, getTransactionToApprove (GATT), First, publishing an IOTA transaction needs five steps: bundle, getTransactionToApprove attachToTangle(GATT), attachToTangle (ATT), storeTransactions (ATT), storeTransactions (ST), and ( broadcastTransactionsST), and broadcastTransactions (BT). In this(BT) experiment,. In this ae bundlexperiment, had a onlybundle one had transaction, only one transaction, and the depth and the of getTransactionToApprovedepth of getTransactionToApprove was 1; thewas mwm1; parameterthe mwm ofparameter attachToTangle of attachToTangle in the mainnet in the was m 14.ainnet The wa clients 14. usedThe client Nvidia used GTX Nvidia 1080Ti GTX to perform 1080Ti to PoW. performThe experimentalPoW. result is shown in Figure9. In the figure, BUNDLE means the time of packing a transaction.The experimental GATT is the result time is spentshown on in tipFigure select 9. In by the the figure, MCMC BUNDLE algorithm. means ATT the time is the of cost packing of PoW. STa transaction. is the cost ofGATT storing is the a transactiontime spent on on tip IRI. select BT by is thethe MCMC broadcasting algorithm. time ATT of IRI. is the The cost experimental of PoW. resultST is demonstratesthe cost of storing that a the transaction biggest coston IRI. of BT publishing is the broadcasting a transaction time is of spent IRI. The on ATTexperimental (i.e., PoW), andresult the demonstr other costsates are that almost the biggest negligible. cost Moreover,of publishing the a getTransactionToApprove transaction is spent on ATT function (i.e., PoW of) IOTA-BT, and APIthe canother change costs are the almost traversal negligible. depth Moreover, of MCMC the algorithm getTransactionToApprove by the depth parameter. function of The IOTA influence-BT API can change the traversal depth of MCMC algorithm by the depth parameter. The influence of ofAPI traversal can change depth the on traversal the cost depth of the of tipMCMC select algorithm is depicted by the in depth Figure param 10. Theeter. traversalThe influence depth of has traversal depth on the cost of the tip select is depicted in Figure 10. The traversal depth has influence influencetraversal if depth the transaction on the cost isof boundthe tip toselect unreliable is depicted tips. in The Figure shorter 10. The the traversal depth depth, has the influence more easily if the transaction is bound to unreliable tips. The shorter the traversal depth, the more easily bound boundif the transaction the transaction is bound is to unreliableto unreliable tips. tips. However, The shorter the the IOTA-BT traversal transaction depth, the is more zero-fee easily transactions. bound the transaction is to unreliable tips. However, the IOTA-BT transaction is zero-fee transactions. The Thethe transactiontransaction is verification to unreliable does tips. not However, affect the theoperation IOTA-BT transaction of IOTA-BT. is zero Therefore,-fee transactions. IOTA-BT The set the transaction verification does not affect the operation of IOTA-BT. Therefore, IOTA-BT set the traversaltransaction depth verification as 1 for reducing does not the affect cost ofthe transaction operation publishing. of IOTA-BT. Therefore, IOTA-BT set the traversal depth as 1 for reducing the cost of transaction publishing.

Figure 9. 9. CostCost of of transaction transaction publishing publishing..

12 12 10.89 10.89

10 10

8 7.25 8 7.25 6.01 6.01 6 5.38 ms 6 5.38 5.16 ms 5.16

4 4

2 2

0 0 5 4 3 2 1 5 4 3 2 1 depth

Figure 10. The cost of tip select by different traversal depths. Figure 10. TheThe cost cost of of tip tip select select by by different different traversal traversal depths depths..

Electronics 20202020, 9, 1610x FOR PEER REVIEW 11 of 15 Electronics 2020, 9, x FOR PEER REVIEW 11 of 15 On the other hand, the IOTA mainnet requires the mwm parameter of PoW must be equal to or largerOnOn than the the 14. other other We hand,evaluatedhand, thethe IOTAIOTA the cost mainnetmainnet of PoW requiresrequires by CPU the and mwm GPU, parameter respectively. of of PoW PoW IOTA must must used be be theequal equal original to to or or APIlargerlarger of than IOTAthan 14. 14. to We Weexecute evaluatedevaluated PoW thetheby costCPUcost ofof while PoWPoW using by CPU the and and ccurl GPU, GPU, library respec respectively. oftively. OpenCL IOTA IOTA to doused used PoW the the byoriginal original GPU. APITheAPI transaction of of IOTA IOTA to to content execute execute was PoWPoW statically byby CPUCPU assigned. whilewhile using Figure the ccurl 11 shows library library that of of the OpenCL OpenCL average to to timedo do PoW PoWof publishing by by GPU. GPU. The1TXThe transactionand transaction 5TX 200 content content times. Compared waswas staticallystatically with assigned.assigned. the i7-8700 Figure CPU, 11 using shows a that thatGPU the the effectively average average timereduces time of of publishing publishingthe 10% of 1TXthe1TX PoW and and 5TXcost. 5TX200 200 times. times. ComparedCompared withwith the i7-8700i7-8700 CPU, using a a GPU GPU effectively effectively reduces reduces the the 10% 10% of of thethe PoW PoW cost. cost.

Figure 11. Cost of Proof-of-Work (PoW). FigureFigure 11.11. Cost of Proof Proof-of-Work-of-Work ( (PoW).PoW). In IOTA-BT, the file owner must publish a torrent file to IOTA in the form of MAM, so that users In IOTA-BT, the file owner must publish a torrent file to IOTA in the form of MAM, so that users can queryIn IOTA-BT, it through the filethe ownerMAM mustRoot. publishWe used a torrentCPU and file GPU to IOTA to publish in the form torrent of MAM,files 100 so times that users and can query it through the MAM Root. We used CPU and GPU to publish torrent files 100 times and calculatescan query itthe through average the time MAM of Root. publishing We used torrent CPU files. and GPU The result to publish is shown torrent in filesFigure 100 12,times which and calculates the average time of publishing torrent files. The result is shown in Figure 12, which includescalculates MAM the average address time generation of publishing and transaction torrent files. initiation. The result Since is shown the GPU in Figurespends 12 less, which time includeson PoW includes MAM address generation and transaction initiation. Since the GPU spends less time on PoW whenMAM initiating address generation a transaction, and it transaction can reduce initiation. the time spent Since theon transaction GPU spends publishing. less time onAlthough PoW when the when initiating a transaction, it can reduce the time spent on transaction publishing. Although the timeinitiating cost aof transaction, transaction it publishing can reduce theis about time spent6~8 s on, it transactionis acceptable publishing. for improving Although the thesecurity time costof file of time cost of transaction publishing is about 6~8 s, it is acceptable for improving the security of file sharingtransaction in BitTorrent. publishing is about 6~8 s, it is acceptable for improving the security of file sharing in BitTorrent. sharing in BitTorrent.

FigureFigure 12. 12. Cost CostCost of ofof publishing publishingpublishing a a Masked Masked Authenticated Message Message (( (MAM)MAMMAM)) transactiontransaction transaction.. .

WhenWhen the the client client joins joins into intointo IOTA IOTA-BT,IOTA--BT,BT, it it needs needs to register its its node node nono no mattermatter matter whatwhat what itit it wantswants wants to to to do. do. do. TheThe steps steps of of node node registrationregistration consistconsist ofof thethe followingfollowing steps: ( (1)1)) P Performerform thethe MAMMAM queryquery to to obtain obtain infoHash,infoHash, the ththee file filefile block block block list, list, list, file file file release release release time, time, time, and other and and other information. information. (2) Use ((22 the)) UseUse current the the current timecurrent to generate time time to to generatethegenerate registered the the registered addressregistered based addressaddress on the basedbased time on dionff theerence.the time (3) difference. Send its node (3)) Send information itsits nodenode in informationinformation the form of general inin the the formtransactions.form of of general general In transactions. Figuretransactions. 13, Fetch In In FigureFigure MAM 13,13, represents FFetchetch MAM the represents time of querying the timetime MAM ofof queryingquerying content MAM MAM to obtain content content the totorrentto obtain obtain file the the and torrent torrent release file file time,and and release release Generate timetime TX,, GGenerateenerate is the time TX is required the time to required generate toto generate thegenerate transaction the the transaction transaction address, address,address, and and SSendend TX TX is is the the time time required required for for sending a new transaction by by verifying verifying two two other other

Electronics 2020, 9, 1610 12 of 15

Electronics 2020, 9, x FOR PEER REVIEW 12 of 15 and Send TX is the time required for sending a new transaction by verifying two other transactions. Electronicstransactions. 2020, 9 The, x FOR experim PEER REVIEWental result shows that it takes only 1.6 s to register a node, and12 of the 15 The experimental result shows that it takes only 1.6 s to register a node, and the performance difference performance difference between the CPU and GPU is only about 200 ms, mainly due to the time betweentransactions.difference the CPU of PoW. The and experim GPU isental only result about shows 200 ms, that mainly it takes due only to the 1.6 times to diregisterfference a node, of PoW. and the performance difference between the CPU and GPU is only about 200 ms, mainly due to the time difference of PoW.

Figure 13. Registration cost. Figure 13. Registration cost. ForFor obtaining obtaining node node information informationFigure fast, fast, 13. IOTA-BTIOTA Registration-BT adopts adopts cost. a a time time difference difference node node registration registration mechanismmechanism to to improve improve its its eefficiency.fficiency. Assume Assume that that every every six minutes six minutes is regarded is regarded as a time as slot, a time and slot, the nodeFor obtainingsends a heartbeat node information every three fast,minutes. IOTA The-BT node adopts will agenerate time difference at most 480 node transactions registration for andmechanism the node sends to improve a heartbeat its efficiency. every three Assume minutes. that every The six node minutes will generateis regarded at mostas a time 480 slot, transactions and for registeringregistering the same service service in in one one day. day. If Ifa aservice service has has only only one one available available node, node, the theuser user can canquery query thethe nodeavailable sends node a heartbeat information every of three this serviceminutes. from The at node most will two generate data. This at moststudy 480 measures transactions the time for the available node information of this service from at most two data. This study measures the time registerinspent on geach the stagesame ofservice the registration in one day. process. If a service PoW has is onlynot neces one availablesary for generatingnode, the user addresses can query and spent on each stage of the registration process. PoW is not necessary for generating addresses and thefinding available transactions. node information Therefore, of this this experiment service from is at measured most two by data. using This the study CPU, measures and the the result time is findingspentshown transactions. on in each Figure stage 14. Therefore, Inof the figure,registration this Generate experiment process. Address is PoW measured is is the not time neces by usingofsary generating thefor CPU,generating the and registered theaddresses result address, is and shown in FigurefindingFind TX 14 transactions. . is In the the time figure, used Therefore, Generate to find this the Address experiment registered is the isaddress, measured time of Get generating by TX using is the the thetime CPU, registered spent and on the getting address, result the is Find TX isshowntransaction, the time in Figure used and 14.Decode to findIn the theTX figure, registeredis the Generate time of address, parsingAddress Get the is TXthetransaction istime the of time generating content. spent In onthe the getting registered process, the Generateaddress, transaction, andFindAddress Decode TX takes isTX the is the the time most time used time, of to parsing findbut it the is the almost registered transaction constant. address, content. Secondly, Get In TX the the is time process,the timespen Generatetspent on Decode on getting Address TX, Find the takes the mosttransaction,TX and time, Get butTXand depends itDecode is almost onTX the constant.is thecurrent time Secondly,loadof parsing status the ofthe IRI. timetransaction It spentcan be onseencontent. Decode from In the the TX, results process, Find that TX Generate andDecode Get TX Address takes the most time, but it is almost constant. Secondly, the time spent on Decode TX, Find dependsTX time on is the most current affected load by status the number of IRI. of It transactions. can be seen IOTA from- theBT uses results a time that difference Decode TX registration time is most TX and Get TX depends on the current load status of IRI. It can be seen from the results that Decode affectedmechanism by the to number filter outdated of transactions. information, IOTA-BT which can uses effectively a time di reducefference the registrationamount of useless mechanism node to TX time is most affected by the number of transactions. IOTA-BT uses a time difference registration filterinformation outdatedinformation, and improve whichthe efficiency can eff ofectively fetching reduce node information. the amount of useless node information and mechanism to filter outdated information, which can effectively reduce the amount of useless node improveinformation the effi andciency improve of fetching the efficiency node information. of fetching node information.

Figure 14. Cost of obtaining node information.

FigureFigure 14. 14.Cost Cost of obtaining node node information information..

Electronics 2020, 9, 1610 13 of 15 Electronics 2020, 9, x FOR PEER REVIEW 13 of 15

Finally, we attempted to compare the performance difference difference between IOTA IOTA-BT-BT and traditional BT. However, the cost of PoW is dependent on the the computational computational power of of used used resources. resources. Therefore, Therefore, we focusedfocused only on the cost of getting the the peer peer list list here. here. We We set set up up four four BT BT nodes nodes in in Taiwan, Taiwan, Tokyo Tokyo,, LondoLondon,n, and L Losos Angeles ( (LA),LA), re respectively.spectively. The node in Taiwan played the tracker server in the BT framework and and the seed node for a shared file.file. In contrast, the other nodes fetched the peer list for downloading thethe sharedshared filefile fromfrom thethe Taiwan Taiwan node. node. We We measured measured how how much much it costit cost the the other othe nodesr nodes to toacquire acquire information information about about the the Taiwan Taiwan node. node The. T measurementhe measurement result result is shown is shown in Figure in Figure 15. The 15. node The nodein Tokyo in Tokyo spent thespent least the time least while time the while node the in node London in London spent the spent most the time. most The time. average The cost average of getting cost ofthe getting peer list the is peer 310 ms. list Comparedis 310 ms. Compared with Figure with 14, the Figu timere 14, diff theerence time is difference only 415 ms. is only It is ignorable415 ms. It for is ignorableusers compared for users with compared the time with of file the downloading. time of file downloading. As previously As discussed, previously IOTA-BT discussed, can IOTA support-BT canhigher support security higher for P2Psecurity file sharing for P2Pthan file sharing traditional than BT traditional with a few BT extra with costs. a few extra costs.

Tokyo 111.2

London 534.4

LA 285.8

0 100 200 300 400 500 600 ms

Figure 15. Cost of ge gettingtting a peer list in the BT network network..

5. Conclusions Conclusions and and Future Work IInn this paper, we have successfully developed an IOTA IOTA-based-based BitTorrent system based on distributed ledger technology. IOTA IOTA-BT-BT enables the original BT framework to be executable on thethe IOTA mainnetmainnet to to support support a P2Pa P2P file-sharing file-sharing service service with with higher higher security, security, availability, availability, and public and public access. Theaccess. experimental The experimental result shows result that shows the that client the takes client only takes 6~8 only s to release6~8 s to a release seed file a seed in the file IOTA in the mainnet, IOTA mandainnet, then and other then clients other can clients query can the query detail the of detail the seed of the file seed through file through any IOTA any mainnet IOTA m nodeainnet within node withinone second. one second. Besides, Besides, a node a takes node only takes 1.4 only and 1.4 0.7 and s to register0.7 s to itsregister heartbeat its heartbeat and obtain and the obtain peer list,the peerrespectively. list, respectively. It is almost It is negligible almost negligible for users for because users the because time intervalthe time of interval issuing of a issuing heartbeat a heartbeat in the BT innetwork the BT isnetwork 10 min. is Therefore, 10 min. Therefore, it is recommended it is recommended that the time that interval the time length interval of issuinglength of a heartbeatissuing a heartbeatcan be further can be shortened further shortened to increase to theincreas frequencye the frequency of information of information exchange exchange and reduce and thereduc timee the of timfilee downloading. of file downloading. On the On other the hand, other thehand, experiment the experiment resultalso result shows also thatshows IOTA-BT that IOTA can-BT indeed can indeedeffectively effectively reduce thereduce number the number of unnecessary of unnecessary transaction transaction searches andsearches decoding. and decoding. Finally, the Finally, efficiency the efficiencyof IOTA-BT of isIOTA indeed-BT acceptableis indeed acceptable for P2P file for sharing. P2P file sharing. IOTA recently has released the Coordicide white paper, and it is ready to move towards version 2.0. Its Its goal goal is is to to achieve achieve true true decentralization, decentralization, abolish abolish the PoW the mechanism, PoW mechanism, and realize and smart realize contracts smart withcontracts more with application more application value. We willvalue. exploit We will IOTA exploit 2.0 smart IOTA contracts 2.0 smart to makecontracts IOTA-BT to make evolve IOTA into-BT a evolveP2P file into trading a P2P system file trading in the future. system Additionally, in the future. service Additionally discovery, service is a critical discovery issue for is foga critical computing. issue forSince fog the computing. resources Since of fog the computing resources areof fog distributed computing to are diff erentdistributed network to different levels or network organizations, levels ora central organizations, service discovery a central service mechanism discovery is not mechanism practical and is realistic.not practical We willand developrealistic. aWe distributed will develop and publica distributed service discovery and public mechanism service discovery for fog computing mechanism by referencing for fog computing the framework by referencing of IOTA-BT. the framework of IOTA-BT.

Author Contributions: Conceptualization, T.-Y.L.; Data curation, L.-Y.H.; Funding acquisition, T.-Y.L.; Investigation, T.-Y.L.; Methodology, T.-Y.T. and T.-Y.L.; Project administration, T.-Y.L.; Resources, L.-Y.H.;

Electronics 2020, 9, 1610 14 of 15

Author Contributions: Conceptualization, T.-Y.L.; Data curation, L.-Y.H.; Funding acquisition, T.-Y.L.; Investigation, T.-Y.L.; Methodology, T.-Y.T. and T.-Y.L.; Project administration, T.-Y.L.; Resources, L.-Y.H.; Software, L.-Y.H. and T.-Y.T.; Supervision, T.-Y.L.; Validation, L.-Y.H.; Visualization, L.-Y.H.; Writing—review & editing, T.-Y.L. All authors have read and agreed to the published version of the manuscript. Funding: This research was funded by the Ministry of Science and Technology in Taiwan grant number [MOST 108-2221-E-992-030]. Acknowledgments: We would like to thank the support of the Ministry of Science and Technology in Taiwan on this study under the project number: MOST 108-2221-E-992-030. Conflicts of Interest: The authors declare no conflict of interest.

References

1. Saroiu, S.; Gummadi, P.K.; Gribble, S.D. Measurement study of peer-to-peer file sharing systems. In Multimedia Computing and Networking 2002; International Society for Optics and Photonics: Bellingham, WA, USA, 2002; Volume 4673. 2. BitTorrent. Available online: https://www.bittorrent.com/ (accessed on 27 September 2020). 3. Karger, D.; Lehman, E.; Leighton, T.; Panigrahy, R.; Levine, M.; Lewin, D. Consistent Hashing and Random Trees: Distributed Caching Protocols for Relieving Hot Spots on the World Wide Web. In Proceedings of the Twenty-Ninth Annual ACM Symposium on Theory of Computing, El Paso, TX, USA, 4–6 May 1997; pp. 654–663. 4. Wang, L.; Kangasharju, J. Real-world Sybil attacks in BitTorrent mainline DHT. In Proceedings of the 2012 IEEE Global Communications Conference (GLOBECOM), Anaheim, CA, USA, 3–7 December 2012; pp. 826–832. 5. Timpanaro, J.P.; Cholez, T.; Chrisment, I.; Festor, O. Bittorrent’s mainline DHT security assessment. In Proceedings of the 2011 4th IFIP International Conference on New Technologies, Mobility and Security, Paris, France, 7–10 February 2011; pp. 1–5. 6. Bitcoin. Available online: https://bitcoin.org/en/ (accessed on 27 September 2020). 7. Xu, X.; Weber, I.; Staples, M.; Zhu, L.; Bosch, J.; Bass, L.; Pautasso, C.; Rimba, P. A Taxonomy of Blockchain-Based Systems for Architecture Design. In Proceedings of the 2017 IEEE International Conference on Software Architecture (ICSA), Gothenburg, Sweden, 3–7 April 2017. 8. Lu, Q.; Xu, X. Adaptable Blockchain-Based Systems: A Case Study for Product Traceability. IEEE Softw. 2017, 34, 21–27. [CrossRef] 9. Li, M.; Weng, J.; Yang, A.; Lu, W.; Zhang, Y.; Hou, L.; Liu, J.N.; Xiang, Y.; Deng, R.H. CrowdBC: A Blockchain-Based Decentralized Framework for Crowdsourcing. IEEE Trans. Parallel Distrib. Syst. 2019, 30, 1251–1266. [CrossRef] 10. Mengelkamp, E.; Notheisen, B.; Beer, C.; Dauer, D.; Weinhardt, C. A blockchain-based smart grid: Towards sustainable local energy markets. Comput. Sci. Res. Dev. 2018, 33, 207–214. [CrossRef] 11. Turkanovi´c,M.; Hölbl, M.; Košiˇc,K.; Heriˇcko,M.; Kamišali´c,A. EduCTX: A Blockchain-Based Higher Education Credit Platform. IEEE Access 2018, 6, 5112–5127. [CrossRef] 12. Stanciu, A. Blockchain-based Distributed Control System for Edge Computing. In Proceedings of the 2017 21st International Conference on Control Systems and Computer Science (CSCS), Bucharest, Romania, 29–31 May 2017. 13. Yang, Z.; Yang, K.; Lei, L.; Zheng, K.; Leung, V.C. Blockchain-Based Decentralized Trust Management in Vehicular Networks. IEEE Internet Things J. 2018, 6, 1495–1505. [CrossRef] 14. Ethereum. Available online: https://ethereum.org/en/ (accessed on 27 September 2020). 15. Li, J.; Wu, J.; Chen, L. Block-secure: Blockchain-based scheme for secure p2p cloud storage. Inf. Sci. 2018, 465, 219–231. [CrossRef] 16. Zyskind, G.; Nathan, O.; Pentland, A.S. Decentralizing privacy: Using blockchain to protect personal data. In Proceedings of the 2015 IEEE Security and Privacy Workshops, San Jose, CA, USA, 21–22 May 2015. 17. Zhang, Y.; Xu, C.; Cheng, N.; Li, H.; Yang, H.; Shen, X. Chronos++: An accurate blockchain-based timestamping scheme for cloud storage. In IEEE Transactions on Services Computing; IEEE: Piscataway, NJ, USA, 2020; Volume 13, pp. 216–229. 18. Lightning Network. Available online: https://lightning.network/ (accessed on 27 September 2020). Electronics 2020, 9, 1610 15 of 15

19. Zamani, M.; Movahedi, M.; Raykova, M. RapidChain: Scaling Blockchain via Full Sharding. In Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security, ACM, Toronto, ON, Canada, 15–19 October 2018; pp. 931–948. 20. Polkadot. Available online: https://polkadot.network/ (accessed on 27 September 2020). 21. Omni Layer. Available online: https://www.omnilayer.org/ (accessed on 27 September 2020). 22. IOTA. Available online: https://www.iota.org/ (accessed on 27 September 2020). 23. IOTA. IOTA Data Marketplace. Available online: https://data.iota.org/ (accessed on 27 September 2020). 24. Shabandri, B.; Maheshwari, P. Enhancing IoT security and privacy using distributed ledgers with IOTA and the Tangle. In Proceedings of the 2019 6th International Conference on Signal Processing and Integrated Networks (SPIN), Noida, India, 7–8 March 2019. 25. Maymounkov, P.; Mazieres, D. Kademlia: A Peer-to-Peer information system based on the XOR metric. In International Workshop on Peer-to-Peer Systems (IPTPS); Springer: Berlin/Heidelberg, Germany, 2002; pp. 53–65. 26. Costa, F.; Silva, L.; Fedak, G.; Kelley, I. Optimizing the data distribution layer of BOINC with BitTorrent. In Proceedings of the 2008 IEEE International Symposium on Parallel and Distributed Processing, Miami, FL, USA, 14–18 April 2008; pp. 1–8. 27. Burford, M. WebSeed–HTTP/FTP Seeding (GetRight Style). 2008. Available online: Bittorrent.org (accessed on 27 September 2020). 28. Adamsky, F.; Khayam, S.A.; Jäger, R.; Rajarajan, M. P2P File-Sharing in Hell: Exploiting BitTorrent Vulnerabilities to Launch Distributed Reflective DoS Attacks. In WOOT’15: Proceedings of the 9th USENIX Conference on Offensive Technologies; ACM: Berkeley, CA, USA, 2015; p. 3. 29. Bhakuni, A.; Sharma, P.; Kaushal, R. Free-rider detection and punishment in BitTorrent based P2P networks. In Proceedings of the 2014 IEEE International Advance Computing Conference (IACC), Gurgaon, India, 21–22 February 2014; pp. 155–159. 30. Bindal, R.; Cao, P.; Chan, W.; Medved, J.; Suwala, G.; Bates, T.; Zhang, A. Improving Traffic Locality in BitTorrent via Biased Neighbor Selection. In Proceedings of the 26th IEEE International Conference on Distributed Computing Systems (ICDCS’06), Lisboa, Portugal, 4–7 July 2006; p. 66. 31. IPFS. Available online: https://ipfs.io/ (accessed on 27 September 2020). 32. IOTA Foundation. The Coordicide. Available online: https://files.iota.org/papers/Coordicide_WP.pdf (accessed on 27 September 2020). 33. BitInfoCharts. Available online: https://bitinfocharts.com/ (accessed on 27 September 2020). 34. Etherscan/Ethereum Gas Tracker. Available online: https://etherscan.io/gastracker (accessed on 27 September 2020). 35. Tang, T.-Y. A service discovery framework for fog computing based on distributed ledger technology. Unpublished.

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).