arXiv:1906.09355v3 [cs.NI] 27 Jun 2019 akta a etcldsml.Ti sdet h nature the to due is This simply. tackled be can that certain task a guarantee peers. to contributing for able performance allocation, contributes be of it bandwidth will need level what system fair to essential equal the guarantee an bandwidth Accordingly, receives to is peer network a download it where P2P slower Thus, a peers. cause for contributing free-riders for consequence, times a free-r called is As resources return in using [6]. network anything of giving th P2P behavior without using others The as of a members. own well other of as of their contributions resources infrastructure for of users the resources encourage should Therefore, on P2P [5]. [4]. dependent [3], users highly problems security are many ot networks cause file to can including [1], passing which messages nodes applications, nodes and net- other many processing also these distributed for have and sharing, resources In networks users provide These users. other to of [2]. own capability resources its the the has uses of node resources each works, the uses which and users the for time. fairness download of the i level decrease approach appropriate our an that free-ridin cle provide revealed overcome results findings to can our simulation immu approach addition, The In proposed channels, network. issue. our secure our fair how achieve a that with to to show it next possible combining spying, also and to incenti is cryptography Addition other it from doing. what method, of help is incapable getting This are betrayals by fairly. prevent as more such to treated methods able be importantly, to is more Leecher Seeders and method makes transactions and This Leecher-to-Leecher Seeders in infr more. an of network contribute propose work a the we to to paper, lightens i leads fairne that this which providing freeloaders tructure model In security of apparent. of based become importance incentive rise have fairness. the users and manage Gnutella, for difficulties to like mechanisms seeing networks proper after resour use P Therefore, However, not Early protocols. protocols. management did P2P P2P in resource networks role in important Therefore, an role plays users. management important own an their plays of sources arbnwdhalcto nPPntok snta easy an not is networks P2P in allocation bandwidth Fair solution distributed a is network (P2P) Peer-to-Peer A Terms Index Abstract nIcnieScrt oe oPoieFairness Provide to Model Security Incentive An tvn nttt fTechnology of Institute Stevens Pe-oPe ewrsaedsge orl nre- on rely to designed are networks —Peer-to-Peer 1 et optrScience Computer dept. st [email protected] cmoet omtig tl,syig insert styling, style, formatting, —component, e esy USA Jersey, New aae Berenjian Samaneh .I I. NTRODUCTION o ert-erNetworks Peer-to-Peer for nvriyo liosa Chicago at Illinois of University et ahmtc,Statistics, Mathematics, dept. n optrScience Computer and 2 nd [email protected] able s iding hcg,USA Chicago, helps ae Hajizadeh Saeed arly ally, can her as- 2P ne ve ce ss n e g s . eoefelaeso nrnefins o ako proper a of lack for may [7]. fairness [8]. users honestly infringe infrastructure many or resources act, deliberate freeloaders own a become cannot their be the can specify peers regarding free-riding to and Although advance upon available in relied P2P resources be in perception bandwidth Moreover, no of router. amount is schedu a to can for there and that bandwidth networks resources, entity of all central allocation to no fair access is arbitrate there and which control in networks P2P of iuain.Fnly ecnld h ae nscinVI. through section method in we paper proposed V the our conclude we section of to Finally, In simulations. possible functionality is well. of the it as use analyze how channels proper show communication with we protect section, it elaborate this improving we to In by IV cryptography. approach approach section incentive proposed in In an networks. our fairness P2P as in providing approach fairness components proposed provide for respective our introduces work its III and existing Section the networks. P2P review we II network. against fair in channels a providing our methodology by to secure next standard that can spying, show the we line RSA, we combining is i.e. Furthermore, and cryptography, goal well. help our as but getting Seeders focus freeloaders, only protect against not to do Leechers This Leecher- we protecting words, and networks. on other Leecher-to-Leecher P2P In both transactions. in protect to-Seeder fairness to for us provides enables infrastructure which method proper incentive For an network. a of the propose work in we longer the purpose, stay mitigating this to by them encourage Also, way, encourage we network. Seeders, this are put the In users to to Leechers. more contribute way downloads, of to a free shoulder getting in the of on designed instead traffics be the should of network most fair a reasons, l akt,Lehr hs emnlge r ae rmBi from taken are terminologies These Leecher. packets, all eadt norg sr o oecoeain BitTorrent cooperation. more for users encourage to reward 1 ic Seeders Since h eto h ae sognzda olw.I section In follows. as organized is paper the of rest The netv-ae ytm sal osdrsm omof form some consider usually systems Incentive-based o ipiiy ecl oe ihalpces edradno and Seeder packets, all with nodes call we simplicity, For 1 I R II. r ntentokol o altruistic for only network the in are et optrEngineering Computer dept. 3 ELATED rd [email protected] nvriyo Guilan of University eaErhm Atani Ebrahimi Reza ah,Iran Rasht, W ORK Tretprotocol. tTorrent e without des le d is one of the first major attempts which used incentive in authors suggested the use if a new P2P file sharing scheme its protocol [9]. It proposed a tit-for-tat (TFT) mechanism in based on the repeated Public Good (PG) game model. They order to incentivize peers to contribute resources to the system mostly focused on trust evaluation, repeated interactions, and and discourage free-riders. As an important benefit, TFT iterative self-learning techniques. The idea is to induce all encourages peers for more contribution without the need for peers to share files as many as possible by incorporating a centralized infrastructures. However, one important challenge trust-based P2P mechanism. The simulation results showed regarding BitTorrent is that the robustness of the system is that the proposed scheme is able to maintain system efficiency questionable. This is due to the fact that many of the contribu- as high as possible respond to current network conditions for tions for improving the performance are unnecessary and can adaptive management. be reallocated or refused while still improving performance Trust management systems are methods to establish word- for strategic users. As a result, there are always some peers of-mouth for P2P networks. This means that based on transac- who contribute more data to the system than others. tions between nodes, they evaluate a degree of trust for each It was shown that a cetralized authority can improve the node which is mostly used for establishing a fair network. fairness in BitTorrent [10]. In [11] and [12], the authors used Finding a malicious user from its neighbors is a selection BitTorrent infrastructure to build their own fairness models. problem. Methods such as fuzzy decision making [17], [18] The main idea is to incentivize seeder stay longer in the Bit- and genetic-based algorithms [19] can be used to select the Torrent network. The authors argued that download bandwidth free-riders from multiple criteria. A successful trust manage- of a leecher is the sum of all its associated peers’ upload ment system that uses this approach is [20]. The [16], [21] are bandwidth, so redistribution of its associated peers’ upload other examples of trust management systems. EigenTrust is the bandwidth could manage the leecher’s download bandwidth. name of an approach proposed In [16]. This method uses an Although these approaches can help those peers who stay algorithm to decrease the number of downloads of inauthentic longer in the network get better download speed, in some cases files in a P2P network that assigns each peer a unique global they increase the overall download completion time. trust value, based on the peer’s history of uploads. For this Next to BitTorrent and its derivatives, there are other purpose, the authors proposed a distributed and secure method incentive methods which take an independent approach such to compute global trust values, based on power iteration. These as [13]–[15]. In [13], the authors mainly focused on locating values are then used by peers to select the peers from whom free-riders and taking actions against them. They proposed a they download. framework in which each peer monitors its neighbors, decides As a result, the network will be able to identify malicious if they are free-riders, and takes appropriate actions. Moreover, peers and isolates them from the network. EigenTrust is able their approach does not require any permanent identification to decrease the number of inauthentic files on the network, of peers or security infrastructures for maintaining a global even under a variety of conditions where malicious peers reputation system. The results revealed that their proposed cooperate in an attempt to subvert the system. In [21], the framework is able to reduce the effects of free- riding and authors have introduced an approach to predict a peer’s co- can, therefore, increase the performance of a P2P network. operation level, focusing on the cooperation induced by the Although this is an interesting approach, it suffers from a P2P protocol rather than the cooperation that results from low number of downloads by contributors which arise from user behavior or bandwidth limitation. This method mainly false detection in determining free-riders. This will ultimately focuses on live streaming applications. By investigating the influence the performance. correlation between a peer’s cooperation level, the authors In [14], the authors have proposed a Gnutella-like unstruc- tried to show that three centrality metrics, namely out-degree, tured P2P file sharing network that utilizes free-riders to index out-closeness, and betweenness, are positively correlated with files. This method is aimed to assist route query messages to the cooperation level. Based on this, they proposed a non- destination peers. The authors suggested modifying a peer’s linear regression model to measure peer’s out-degree in the neighbor table construction so that a free-rider has a lot of non- recent past to predict its cooperation level value in the near freeloaders as its overlay neighbors, while a non-freeloader’s future. neighbors are mostly free-riders. Moreover, each peer also keeps information about its neighbors’ files so that when III. THE PROPOSED METHOD a peer receives a query, it can determine if its neighbor In this section, we propose an incentive model which has the queried file, or needs to forward query messages to can be used in versatile infrastructures. In our presented continue the search. The findings obtained from this approach model, we increase fairness for both Leechers and Seeders. showed that the proposed method is able to improve search At first, we define how two Leechers should exchange packets efficiency. However, one important security threat regarding and further demonstrate the mechanism for Leecher-to-Seeder this approach is that the authors assumed that peers faithfully transactions. execute the program so that they follow the protocol designed by the program to build their neighbor tables and A. Protecting Leecher-to-Leecher Transactions to relay query messages. If an adversary hacks the program, In this procedure, we aim to force Leechers to upload as then it will be able to change the protocol. In [15], the much as they download from others. To this end, we consider (1),(2) Request SeederSeeder

‘ (3) Upload P acket X , K (1) Request 1 n1 (3) Upload Packet ( , )

s , K ‘ )

2

(2) Request s (7) Send Key Node 1 Node 2 K” Node 1 ‘ (4) Upload P acket X 2, K n X 2 1 K’ s K ” (8) Send Key s (4) Upload Packet (x

(5) Upload Packet X 1 , K’s Node 1 (5) Send K“ NodeNode 12 n 2

X , K’ (6) Upload Packet 2 s (6) Send K“ n 2

Fig. 1. The process of data exchange between two Leechers. Fig. 2. The process of data exchange between two Leechers and a Seeder.

K′ and K′′ as two separate keys which are required by all → D ′′ n1 n1 : crypt( (X2),Kn2 ) nodes in the network. We define E(X), for encryption and ′′ (3) 2 → 2 D 1 D(X) for decryption of data X. Each node in the network  n n : crypt( (X ),Kn1 ) is represented as ni, i = 0, 1,...,k. If ni wants to encrypt ′ It is important to be pointed out that, afte receiving Q5, data X, it should use Kn . Therefore, we define function ′′ i n2 can leave the process without sharing Kn2 with n1. crypt E X ,K′ for encryption of data X with key K′ . On ( ( ) ni ) ni Since we forced him to upload, economically we take away the other hand, for ni to decrypt data X, it is always required the incentives for betrayal. In real world applications, such to use K′′ , we have crypt D X ,K′′ for decryption of data ni ( ( ) ni ) behavior can even become disadvantageous. As nodes can X with key K′′ . ni mark them and refuse the future transactions. In Fig. 1, a better Suppose n1 and n2 are two Leechers which want to ex- view of this process is demonstrated. change data X1 and X2. In the first step, n2 sends the query package Q1 = (REQ,X1,n1) at which it requests data X1 B. Protecting Leecher-to-Seeder Transactions from n1. After receiving Q1, n1 sends Q2 = (REQ,X2,n2) To protect Seeders, we need to reduce their workloads for n2 to ask for data X2. Before sending X1, n1 encrypts X1 by relegating the traffics to Leechers. In this way, we force ′ with Kn1 . Accordingly, before sending X2, n2 encrypts X2 Leechers to take responsibility for their downloads and engage ′ with Kn2 . them to upload process. As a result, Seeders by reducing their work are encouraged to stay longer in the network. This n2 → n1 Q1 REQ,X1,n1 : = ( ) concept is first introduced in [22] with a P2P management  n1 → n2 : Q2 = (REQ,X2,n2)  → ′ (1) system. In this work, we show that it is still possible to protect  n1 n1 : crypt(E(X1),Kn1 )  ′ Seeders in an incentive model. n2 → n2 : crypt(E(X2),Kn ) 2 Suppose that n1 and n2 are in contact with s, as the  When the encryption process completes, package Q3 = Seeder. Suppose n1 sends Q1 = (REQ,X1&X2,s) to ask ′ (X1,Kn1 ,n2) will be sent to n2. The decryption procedure for X1 and X2 from s. In the same way, n2 sends Q2 = ′′ for getting X1 requires Kn1 , so n2 must continue the trans- (REQ,X1&X2,s) for asking the same data from s. After ′ action. After receiving Q3 and performing the encryption Seeder s receives Q1, it encrypt X1 with Ks. In the same way, ′ ′ process, n2 will send the package Q4 = (X2,Kn2 ,n1) to after receiving Q2, it encrypst X2 with Ks. After encryption, ′′ ′ n1. To complete this procedure, nodes n1 and n2 need Kn1 s sends Q3 = (X1,Ks,n1) to send the encrypted data X1 for ′′ ′ and Kn2 respectively to decrypt their downloaded data. The n1 and Q4 = (X2,Ks,n2) to send the encrypted data X2 for process of exchanging the keys is done by n1 which sends n2. ′′ the package Q5 = (EXC,Kn1 ,n2) to n2. Doing this, it ′′ n1 → s : Q1 = (REQ,X1&X2,s) forwards Kn1 to n2. Accordingly, receiving Q5, n2 sends ′′ ′′ → 6 1 1 1  n2 s : Q2 = (REQ,X1&X2,s) Q = (EXC,Kn2 ,n ) to n . As a result, n gets Kn1 . ′  s → s : crypt(E(X1),Ks) ′  ′ (4) n1 → n2 Q3 X1,K ,n2  s → s crypt E X2 ,K : = ( n1 )  : ( ( ) s) → ′ → ′  n2 n1 : Q4 = (X2,Kn2 ,n1) s n1 : Q3 = (X1,Ks,n1)  → ′′ (2)  → ′  n1 n2 : Q5 = (EXC,Kn1 ,n2)  s n2 : Q4 = (X2,Ks,n2)  ′′  n2 → n1 : Q6 = (EXC,Kn ,n1)  2 For decryption process , both n1 and n2 need to obtain  ′′ At this stage, both nodes receive their requested data and Ks . In order to do this, s can force them to cooperate and ′′ ′′ ′′ have the keys for decryption. Using Kn2 and Kn1 , nodes n1 upload for each other. Therefore, to obtain Ks , n1 sends ′ and n2 extract X2 and X1 respectively. Q5 = (X1,Ks,n2) to upload X1 for n2. Accordingly, n2 ′ sends Q6 = (X2,Ks,n1) to upload X2 for n1. In this stage, The key Kasy is the symmetric key which can be used to ′′ both n1 and n2 shared their resources. For n1 to obtain Ks , encrypt and decrypt data X. Keys Kapu and Kapr are used n2 sends Q7 = (ACK,X1,s) to indicate X1 is received and as a public and private key respectively. They are essential ′′ s is allowed to share Ks with n1. Node s after receiving Q7, parameters in the RSA algorithm. After generating the keys, ′′ ′′ sends Q8 = (EXC,Ks ,n1) to the key Ks for n1. A sends query package Q2 = (EXC,Kapu ,B) to exchange its public key with B. After B receives the package Q2, it → ′ n1 n2 : Q5 = (X1,Ks,n2) follows the same pattern by generating Kb as its symmetric ′ sy n2 → n1 : Q6 = (X2,Ks,n1)  key, Kbpu as the public key and Kbpr as private key of  n2 → s : Q7 = (ACK,X1,s)  RSA algorithm. As like as the previous procedure, Kbsy is  → ′′ (5)  s n1 : Q8 = (EXC,Ks ,n1) for encrypting and decrypting data X. After the keys are → n1 s : Q9 = (ACK,X2,s) generated,, B sends Q3 = (EXC,Kb , A) to complete the ′′ pu  s → n2 : Q10 = (EXC,Ks ,n2)  public key exchange with A.  For n2 to receive the key, n1 should apply for the same → process. This means that after receiving Q8, n1 sends Q9 = B A : Q1 = (REQ,Xa, A) → 2 a (ACK,X2,s) to indicate it has received X2 from n2. After  A B : Q = (EXC,K pu ,B) (7) ′′  → 3 b receiving Q9, node s sends Q10 = (EXC,Ks ,n2) in order to B A : Q = (EXC,K pu , A) ′′ forward Ks to n2. In the last step, n1 and n2 which acquired  Once the process of exchanging Ka and Kb finishes, X1, X2 and their keys, decrypt X1 and X2. pu pu A encrypts data Xa with Kasy . When encryption process ′ ′′ 4 a n1 → n1 : crypt(D(X1),Ks ) completes, A sends the query package Q = (X ,Kasy ,B) to ′′  n1 → n1 : crypt(D(X2),Ks ) B and forward the encrypted data Xa to it. After receiving Q4, ′′ (6) b b  n2 → n2 : crypt(D(X1),Ks ) B encrypts data X with K sy . Once this process completes, B  ′′ n2 → n2 : crypt(D(X2),Ks ) sends Q5 = (Xb,Kbsy , A) to A in order to deliver encrypted  data Xb to it. This protocol follows the procedure shown in equaton 9 and the whole process is illustrated in Fig. 2. → A A : crypt(E(Xa),Kasy ) ′  A → B : Q4 = (Xa,Ka ,B) IV. IMPROVINGTHE BASIC DESIGN sy (8)  B → B crypt E Xb ,Kb  : ( ( ) sy ) We can use the common protocols in cryptography to further → B A : Q5 = (Xb,Kbsy , A) improve our basic model in the previous section. In practice,   by using symmetric key encryption, only one key is required In this stage, both nodes received their data. To exchange for doing both process of encryption and decryption. As a Kasy and Kbsy , we use RSA methodology to be able result, we do not need to have two separate keys for each to protect them from line spying. To exchange Kasy and node. Also, we can further improve this method and protect Kbsy , at first A uses crypt(E(Kasy ),Kbpu ) to encrypt Kasy communications against line spying. To this end, we use RSA with Kbpu and uses Q6 = (Kasy ,Kbpu ,B) to send the algorithm [23] which requires two new keys for each node. encrypted key Kasy for B. After receiving Q6, B uses Suppose Alice (A) and Bob (B) want to exchange data Xa, D crypt( (Kasy ),Kbpr ) to open the Kasy first, and then uses Xb. First, B sends the query package Q1 = (REQ,Xa, A) D crypt( (Xa),Kasy ) to receive data Xa. To complete the to request Xa from A. After receiving Q1, A generates three transaction, B sends Q7 = (Kbsy ,Kapu , A) to send the different keys, Kasy , Kapu and Kapr . encrypted key Kbsy for A. As the last step, A at first D uses crypt( (Kbsy ),Kapr ) to open the Kbsy , and then uses (1) Request D crypt( (Xb),Kbsy ) to receive data Xb.

(2) Upload packet A Ka sy → A A : crypt(E(Kasy ),Kbpu ) →  A B : Q6 = (Kasy ,Kbpu ,B)

(3) Upload packet B Kb sy  B → B crypt D Ka ,Kb  : ( ( sy ) pr ) Alice { Ka sy , K bpu , K apr } Bob { Ka sy , K bpu , K apr }   B → B crypt D Xa ,Ka (9)  : ( ( ) sy )  → B A : Q7 = (Kbsy ,Kapu , A) → D (4) Send A A : crypt( (Kbsy ),Kapr ) Ka sy _Kb pu   A → A : crypt(D(Xb),Kb )  sy  Kb _Ka pu  (5) Send sy The above protocol is shown in Fig. 3. All data exchanges for both Leecher-to-Leecher and Leecher-to-Seeder, described in previous section should adapt and follow these steps. In this way, next to providing fairness for the network we can shield Fig. 3. The process of data exchange, using cryptography methods. the communication channels as well. V. ANALYSIS AND SIMULATION RESULTS were divided into 100 smaller packets. Simulation was stopped In this section, we evaluate the effectiveness and function- when all nodes finished their downloads and left the network. ality of our proposed approach through simulation. For this The result of this experiment can be seen in Fig. 5. purpose, we use a network similar to Bitorrent protocol. In 200 this environment, we initially compare our method with a Our Method 80% Willingness network which only relies on willingness on the users. In order 60% Willingness 40% Willingness to appropriately examine the effectiveness of our approach, 150 20% Willingness 10% Willingness we mainly focus on the evaluation propagation, fairness for 5% Willingness Seeders, fairness for all nodes (Seeders and Leechers) and free-riding prevention. In the next step (see Section V-D), by 100 introducing tit-for-tat for nodes, we compare our method with

Bittorrent. Average of Packets 50 A. Propagation of Packets Initially, we examine the packet propagation among nodes 0 in the overlay. For this purpose, at each time interval, we 0 2e+07 4e+07 6e+07 8e+07 1e+081.2e+081.4e+081.6e+081.8e+082e+08 calculated the average of all packets in the network. This Time shows how much time does it take for the nodes to complete Fig. 5. Results of fairness Examination for Seeders. their downloads tasks. Even though our method showed better performance com- 200 Our Method pared to its rivals (except in one case), but the difference is not 80% Willingness 60% Willingness significant. This is mainly because we used only 10 Seeders 40% Willingness 150 20% Willingness against 990 Leechers. As a result, most of the transactions 10% Willingness 5% Willingness were between Leechers. It is expected when Seeders have more opportunities to relegate their uploads, the result will be 100 more transparent. We further examine this situation in Section V-D when we put our method against Bittorrent.

Average of Packets The overall average of uploads is useful to see how traffic 50 is relegated from Seeders. But using overall uploads does not reveal fairness. To better understand the situation consider two pairs of nodes. One pair with (90, 10) uploads and the other 0 0 2e+08 4e+08 6e+08 8e+08 1e+09 1.2e+09 pair with (50, 50) uploads. Even though both of them have the Time same mean, in the first pair, fairness is not served. Therefore, we have to use the variance of uploads. Variance shows to Fig. 4. Simulation results show that using our method is beneficial for data propagation in the network. which extent nodes deviated their uploads from the mean of all uploads. For this experiment, we used a static network of 1000 nodes For this experiment we used a network of 100 nodes and and initialised it with 10 Seeders. The data were divided into 10 Seeders with 100 packets. We made sure that network 100 smaller packets. Simulation stopped when all nodes in the network completed their downloads. The result is shown 6000 in Fig. 4. As it can be seen, we compared our method with the willingness of users. By forcing users to upload more, they 5000 used the extra resources and could complete their downloads sooner. The results clearly shows that our approach enables 4000 nodes to download more packets in a certain time period compared to other willingness categories. 3000 Variance

B. Fairness for Users 2000 To measure fairness for Seeders, the most important factor is their number of uploads. Therefore, we examine the mean 1000 of all uploaded packets for them at each time interval. For this experiment, a dynamic network of 1000 nodes is used. In this 0 OurMethod80% 60% 40% 20% 10% 5% scenario, we assumed that Leechers would simply leave the Willingness for Upload network after completing their downloads. We used 10 Seeders and distributed them in the network evenly. Moreover, the data Fig. 6. Results of fairness examination for all nodes. is completely static so we could examine the behaviors of vantage of our method comes from Leecher-to-Seeder trans- every node in the network. Simulation was running until all actions. The reason is that Bittorrent did not implement any Leechers finished their downloads. As we can see in Fig. 6, mechanisms to help Seeders in the network. Therefore, we when less users are willing to share, most probably other examine two main factors: 1- how much Leechers are forced users (mostly Seeders) get abused. This shows that when to upload more and 2- how much Seeders upload less. network does not implement a proper fairness mechanism, 80 altruistic users are most vulnerable entities which suffer from BitTorrent Our method such infrastructure. The result shows that as much as the 70 willingness level decreases, the variance increases which is an indicator about the deviation from the mean of all uploads. In 60 this experiment, our approach showed the minimum variance 50 among other examined methods. 40

C. Freer-riding Prevention Upload 30 Another important issue that we examine is free-riding prevention. The only way that freeloaders can live in a network 20 shielded with our method is 1- using optimistic-unchock2 and 10 2- using Seeders when they do not have anyone to force them 0 for contribution. Since the amount of downloads they can get 1 2 3 4 5 6 7 8 9 10 from this way is significantly smaller, freeloaders have a hard Leecher time to finish their downloads. Fig. 8. The capability of our approach to encourage Leechers to upload more. 6.2e+08 Our method 50% Willingness Since Seeders play a crucial role in this experiment, we 6e+08 chose a smaller network with 30 nodes and 6 Seeders which were distributed evenly in the network. We used 100 packets 5.8e+08 in the network. In the first experiment (Fig. 8), we show how much our method makes Leechers to take responsibility for 5.6e+08 their downloads. Simulation stopped when all of Leechers

Time 5.4e+08 finished their downloads. After finishing downloads they could leave the network or stay and become another Seeder. For this 5.2e+08 purpose, 10 Leechers were chosen randomly for our analysis. The result is shown in Fig. 8. As we can see, in most cases, 5e+08 by using our method, Leechers uploaded more. In addition, compared to Bittorent, the reliance on Seeders is lower. 4.8e+08 1 2 3 4 5 Freeloaders 70 BitTorrent Our Method Fig. 7. The efficiency of our approach for keeping freeloaders for a much 60 more longer time in the network. 50 For this experiment, we implemented a network with 500 40 nodes and 100 packets. We had 10 Seeders and 5 freeloaders which were distributed evenly in the network. Simulation was 30 stopped when all freeloaders finished their downloads. We

Average of Uploads 20 put our method against a 50% willingness network. As it can be seen in Fig. 7 with our method, freeloaders have 10 to stay much longer in the network. Clearly, almost in all 0 0 2e+06 4e+06 6e+06 8e+06 1e+071.2e+071.4e+071.6e+071.8e+07 scenarios, in the network which benefits from our approach, Time the freeloaders have to stay three times longer than a 50% willingness network. Fig. 9. With the proposed method Seeders tend to upload less. D. A Comparison with Bittorrent In the second experiment (Fig. 9), we aimed to analyse the In a Leecher-to-Leecher transaction, unlike Bittorrent, we number of uploads for Seeders. As we already mentioned, we prevent betrayals before they take place. Another main ad- had six Seeders in the network which were distributed evenly in the overlay. The average of uploads for all six Seeders at 2In optimistic-unchoke, Leechers always uploads for a random node without each time interval is shown in Fig. 9. As it can be seen, as considering if it is uploading back. In this way, new nodes also get a chance to acquire some packet. This helps newcomers to engage in future transactions the time increases, the average of uploads of Seeders increases [?]. as well. However, in a network which uses our approach, this increment is slightly lower than Bittorent. This confirms the [14] Y. Joung, T. H. Chiu, S. Chen, “Cooperating with free riders in functionality of our approach against Bittorent. At the end unstructured P2P networks,” Computer Networks, vol. 56, no. 1, 198–212 (2012) of the simulation time, this difference in the average number [15] S. Kim, “Repeated public goods game mode for trust based P2P of uploads, reaches its maximum limit. This reveals how our networks,” Wireless Personal Communications, vol. 79, no. 1, 473–485 approach performs better as the time increases. (2014) [16] S. D. Kamvar, M. T. Schlosser, and H. Garcia-Molina, “The Eigentrust algorithm for reputation management in P2P networks,” in Proceedings of VI. CONCLUSION AND FUTURE WORK the 12th International Conference on World Wide Web, Hungary, 640–651 Fairness is one of the most important challenges in P2P (2003) [17] Razeghi, B., Hatamian, M., Naghizadeh, A., Sabeti, S., & Hodtani, G. A. communications. In this paper, we proposed an incentive- (2015, April). A novel relay selection scheme for multi-user cooperation based and fully distributed model that is aimed to accurately communications using fuzzy logic. In 2015 IEEE 12th International provide fairness in P2P networks. Our approach supports both Conference on Networking, Sensing and Control (pp. 241-246). IEEE. [18] Berenjian, S., Shajari, M., Farshid, N., & Hatamian, M. (2016, Septem- Leechers and Seeders against freeloaders. The former is met ber). Intelligent automated intrusion response system based on fuzzy by making Leechers upload as much as they download from decision making and risk assessment. In 2016 IEEE 8th International others. The latter is guaranteed by reducing the workload of Conference on Intelligent Systems (IS) (pp. 709-714). IEEE. [19] Hatamian, M., Barati, H., Movaghar, A., & Naghizadeh, A. (2016). Seeders by relegating the traffics to Leechers. Consequently, CGC: centralized genetic-based clustering protocol for wireless sensor we force Leechers to take responsibility for their downloads networks using onion approach. Telecommunication systems, 62(4), 657- and engage in the uploading process. As a result, they are 674. [20] Naghizadeh, A., Razeghi, B., Meamari, E., Hatamian, M., & Atani, R. encouraged to stay longer in the network. We further showed E. (2016). C-trust: A trust management system to improve fairness on that by combining the standard methodology in cryptography, circular P2P networks. Peer-to-Peer Networking and Applications, 9(6), i.e. RSA, we can secure our channels against line spying 1128-1144. [21] G. D. Gonalves, . Cunha, A. B. Vieira, and J. M. Almeida, “Predicting next to providing a fair network. Our findings obtained from the level of cooperation in a Peer-to-Peer live streaming application,” the simulation results clearly shows the effectiveness and Multimedia Systems, vol. 22, no. 2, 161–180 (2016) applicability of our approach by decreasing the download time, [22] Naghizadeh, A. (2016). Improving fairness in peer-to-peer networks by separating the role of seeders in network infrastructures. Turkish Journal providing an appropriate level of fairness among peers, and of Electrical Engineering & Computer Sciences, 24(4), 2255-2266. preventing free-riding. [23] R. L. Rivest, A. Shamir, and L. Adleman, “A method for obtaining digital signatures and public-key cryptosystems,” Communications of the REFERENCES ACM, vol. 21, no. 2, 120–126 (1978) [1] Y. Tang, H. Wang, and W. Dou, “ Trust based incentive in P2P network,” in Proceedings of the IEEE International Conference on E-Commerce Technology for Dynamic E-Business, China (2004) [2] Naghizadeh, A., & Shahbahrami, A. (2017). Binary search routing equiv- alent (BSRE): a circular design for structured P2P networks. Transactions on Emerging Telecommunications Technologies, 28(4), e3012. [3] Naghizadeh, A., Berenjian, S., Meamari, E., & Atani, R. E. (2016). Structuralbased tunneling: preserving mutual anonymity for circular P2P networks. International Journal of Communication Systems, 29(3), 602- 619. [4] Naghizadeh, A., Berenjian, S., Razeghi, B., Shahanggar, S., & Pour, N. R. (2015, January). Preserving receiver’s anonymity for circular structured P2P networks. In 2015 12th Annual IEEE Consumer Communications and Networking Conference (CCNC) (pp. 71-76). IEEE. [5] D. Guo, Y. Kwok, X. Jin, and J. Deng, “A performance study of incentive schemes in peer-to-peer file-sharing systems,” The Journal of Supercomputing, vol. 72, no. 3, 1152–1178 (2016) [6] D. Hughes, G. Coulson, and J. Walkerdine, “Free riding on gnutella revisited: The bell tolls?,” IEEE Distributed Systems Online, vol. 6, no. 6 (2005) [7] N. Balouchzahi, M. Fathy, and A. Akbari, “An efficient infrastructure based service discovery in vehicular networks using P2P structures,” The Journal of Supercomputing, vol. 72, no. 3, 1013–1034 (2016) [8] K. Lu, J. Wang, and M. Li, “An Eigentrust dynamic evolutionary model in P2P file-sharing systems,” Peer-to-Peer Networking and Applications, vol. 9, no. 3, 599–612 (2016) [9] B. Cohen, “Incentives build robustness in BitTorrent,” in Proceedings of P2PEcon (2003) [10] Naghizadeh, A., Razeghi, B., Radmanesh, I., Hatamian, M., Atani, R. E., & Norudi, Z. N. (2015, April). Counter attack to free-riders: Filling a security hole in BitTorrent protocol. In 2015 IEEE 12th International Conference on Networking, Sensing and Control (pp. 128-133). IEEE. [11] R. R. Izhak-Ratzin, “Improving the BitTorrent protocol using different incentive techniques,” Ph.D. dissertation, Dept. CS., UCLA, USA (2010) [12] M. Li, “Improving performance of BitTorrent network through incentive mechanism,” M.Sc. thesis, San Jose State University, USA, (2011) [13] M. Karakaya, I. Krpeog, “Free riding in peer-to-peer networks,” Com- puter Networks, vol. 52, no. 3, 675–694 (2008)