A Credit-Based Approach for Overcoming Free-Riding Behaviour in Peer-to-Peer Networks

,

(peers). While security threats remain an issue for many networks (e.g., [Zhang, Wang, Cao et al. (2018)]), one of the fundamental problems suffered by such networks concerns unfairness, whereby many users have a tendency to free-ride by unfairly consuming resources while contributing very little or no resources. While this problem is not unique to P2P networks, e.g., [Sweeney (1973); Roberts (2008)], it remains relatively new in the field of information sciences. Its impact on P2P networks varies depending on the type of service and the network architecture. For instance, in a wireless ad-hoc network, a selfish node degrades network performance with latency and increased loss rate [Zarifzadeh, Yazdani and Nayyeri (2012)]. In a file-sharing P2P system, free-riding affects the system in two significant ways: It limits the number of shared files and reduces the number of popular files available [Ramaswamy (2003)]. A variety of approaches have been developed to thwart free-riding behaviour in P2P systems. These approaches are mainly categorised as monetary-, reciprocity-, and reputation-based [Feldman and Chuang (2005)]. In the first category, monetary-based approaches, payment is expected for consumed resources; peers are paid based on resources consumed by other peers while paying for those they themselves consume, e.g., [Trajkovska, Rodriguez, Cervino et al. (2014)]. In the second category, P2P systems utilising a reciprocity-based approach allow exchange of services among peers based on their level of contributions. This approach is employed by, for instance, BitTorrent in its tit-for-tat technique [Legout, Liogkas, Kohler et al. (2007)]. Finally, the reputation-based approach maintains reputation information about peers that is constructed from feedback from other peers [Karakaya, Korpeolu and Ulusoy (2009)], e.g., [Dennis and Owenson (2016)]. Incentives have been found to encourage cooperation amongst peers in P2P systems. Incentives can vary and include services, monetary incentives, peer ratings and time-tolive (TTL). This paper proposes a unique monetary incentive approach that disfavours and penalises free-riding behaviours via denial of download requests in P2P networks. The proposed approach is based on incentives used by credit card companies to encourage timely reimbursement so as not to incur added interest. Similar to a credit card, a peer is given a 'grace period' during which they must reimburse the network with a resource of equivalent quantity. If a peer fails to reimburse the system within that time, then interest is incurred in the form of doubling the number of resources to be reimbursed. Requests for download are denied until the peer cooperates fairly. The objective of the proposed approach is to encourage fairness among peers in P2P networks and to entice cooperation among participating peers with timely contributions. The remainder of this paper is organised as follows. First, the related work section reviews studies into overcoming and controlling free-riding behaviour. Second, the proposed credit-based free-riding solution is fully discussed. The third section describes the experimental setup for conducting simulations. Experimental results are presented and discussed in the fourth section. The final section summarises and concludes the paper and briefly suggests directions for future research.

Related work
Free-riding behaviour has been observed in high levels in various P2P systems. Gnutella, a decentralised file-sharing P2P network, was found to harbour a large number of free-riders (70%), with only 25% of peers fulfilling 99% of all requests on the network [Adar and Huberman (2000)]. The state of the network was later examined and was found to be still vulnerable to free-riders, and its vulnerability was in fact markedly increasing [Hughes, Coulson and Walkerdine (2005)]. Free-riding is known to adversely affect the robustness and expandability of P2P networks and to degrade performance. Incentive schemes have been devised for P2P sharing networks to encourage cooperation and reduce the impact of free-riding behaviour. This scheme is borrowed from economics and management and applied to the information sciences. It targets and rewards behaviour deemed desirable and punishes unwanted behaviour. In the case of P2P networks, cooperating peers are rewarded with monetary payments, services, and TTL among other incentives [Krishnan, Smith, Tang et al. (2002)]. Free-riders, in contrast, are penalised for not cooperating. The literature proposes several incentive-based schemes. In this section, we briefly review several works on each of the incentive-based approaches: monetary, reciprocity and reputation. Finally, we note some of the known limitations of these approaches.

Monetary-based approaches
In a monetary-based approach, also known as a micropayment scheme, peers are expected to pay and be paid for services they consume and produce, respectively. This approach typically uses virtual currency such as XPay or tycoon, which is stored for each peer in an accounting module. To exchange services, a settlement module, typically maintained by a single authority, oversees transactions. Such pricing of transactions encourages contributions from peers while penalising freeriding behaviour. Schemes within monetary-based approaches differ in their pricing methods and the underlying exchange mechanisms. A game theoretic model was constructed and its performance was analysed under several payment mechanisms, including flat-rate and quantized micropayments [Golle, Leyton-Brown, Mironov et al. (2001)]. However, these mechanisms did not discourage free-riding. Another approach utilised a central authority-a broker-to open and close accounts in P2P networks and for arbitration [Yang and Garcia-Molina (2003)]. The micropayment scheme PPay was found to optimistically reduce a broker's load and involvement. An auction-based payment scheme was proposed in a wireless network environment to price packet forwarding [Chen and Nahrstedt (2004)]. An auction process was used to assign price rates and bandwidth to routers. With each passing packet, bidding ensued for resources. Similar to PPay [Yang and Garcia-Molina (2003)], ConQuer [Mondal, Madria and Kitsuregawa (2009)] provided incentives by utilising a broker-based mobile P2P model to auction data and encourage cooperation. More recently, Trajkovska et al. [Trajkovska, Rodriquez, Cervino et al. (2014)] proposed and adapted a method based on monetary discounts and a utility model derived from taxation incentive schemes. Their model proved feasible as it increased participation and collaboration among peers.

Reciprocity-based approaches
Reciprocity-based approaches are based on the barter system, which involves the exchange of resources based on the contribution level of each peer. In this scheme, peers either base their exchange with other peers on their own past experiences (direct experience) or on the collective experience of all other peers (indirect experience). The tit-for-tat strategy implemented in BitTorrent is a reciprocity-based scheme, wherein peers upload pieces of content to those peers willing to supply pieces [Cohen (2003)]. It disfavoured free-riding behaviour by "choking" peers unwilling to supply content. A treatbefore-trick scheme was also proposed for a BitTorrent-like P2P network to penalize freeriding behaviour [Shin, Reeve and Rhee (2009)]. This approach was based on secret sharing of content encrypted with a symmetric secret key. The encrypted content was shared with other peers, along with generated sub-keys. This approach effectively reduced free-riding behaviour that attempts to circumvent countering techniques. A connection management protocol for unstructured P2P networks was presented by Karakaya et al. [Karakaya, Korpeolu and Ulusoy (2008a)] to alleviate problems resulting from free-riding. They proposed utilising two different connection types to differentiate service requests and service provision. The protocol adapts a P2P topology and pulls contributing peers together while pushing free-riders away. A similar push-and-pull protocol was adopted by Oliveira et al. [Oliveira, Prado, De Lima et al. (2015)] to insulate free-riding nodes in P2P networks that distribute video streams. It also classified uncooperative nodes. Their approach thus combined aspects of reciprocity-and reputationbased schemes.

Reputation-based approaches
In reputation-based approaches, past histories of behaviour and trust are utilised to track bad behaviour. Reputation is defined by Wang et al. [Wang and Vassileva (2003)] as one peer's belief in another's reliability and honesty based on recommendations from other peers. This approach aims to deter bad behaviour by building trust among peers in a network. Behaviours such as free-riding and malice are detected and penalised. One of the earliest reputation-based approaches [Gupta, Judge and Ammar (2003)] mapped a dynamic reputation score to each peer in a decentralised unstructured network based on that peer's behaviour and capabilities. Wang et al. [Wang and Vassileva (2003)] developed a Bayesian network-based model that similarly lets peers communicate their experiences with others. This local view of the network relied on the honesty of peers in sharing this information. However, this assumption is often unrealistic. Gupta et al. [Gupta and Somani (2005)] later presented a game model of interaction between peers in a P2P system. The game's pure and mixed strategy equilibrium was studied, where all peers were assumed to be selfish. The contribution reputation of a peer was directly proportional to what a peer could download in a given time period. While all these approaches were found to inhibit free-riding behaviour, their use of a binary score was not fully effective for the size of the resources downloaded or their popularity. In an unstructured P2P network context, a framework was devised to monitor a peer's contribution to the network to counteract free-riding behaviour [Karakaya, Korpeolu and Ulusoy (2008b)]. This scheme indirectly forced free-riders to cooperate by monitoring both resources originating from a peer and those received by the peer. Other approaches filter out free-riding behaviour based on the trustworthiness of peers [Azzedin (2010)]. Using an activity-based filtering algorithm, free-riding behaviour was identified by quantity of contributions or lack thereof and the content of contributions. A more recent reputation system used blockchain technologies [Dennis and Owenson (2016)] to store reputation scores from completed transactions based on file type rather than human opinion. This approach reduced unfair ratings and maintained the integrity of the reputation system.

Implementation limitations
While the reviewed approaches alleviate some of the consequences of free-riding behaviour, several limitations remain in their application to P2P network [Karakaya, Korpeolu and Ulusoy (2009)]. With monetary-based approaches, centralised modules for settlement and accounting can cause scalability issues, communication overhead and single points of failure. For instance, ConQuer [Mondal, Madria and Kitsuregawa (2009)] maintains an economic model that computes data items, prices and broker and relay commissions. Reciprocity-based approaches rely on uniquely identifying peers and linking them to their values, a method that can be bypassed by free-riders (e.g., [Cohen (2003)]). Another issue with reciprocity-based approaches concerns the quality of published resources, as malicious peers might contribute fake services or files. Similar to monetarybased schemes, reputation approaches suffer from centralization and communication overhead. This type of approach also raises the issue of reputation reliability. For instance, Gupta et al. [Gupta, Judge and Ammar (2003)] and Wang et al. [Wang and Vassileva (2003)] proposed approaches wherein reputation is collected based on previous interactions and relies on the honesty of the communicating nodes. The proposed credit-based approach is similarly based on monetary incentives by considering a peer's upload rate and time to reimbursement. Its simplicity overcomes some of the centralisation drawbacks and overhead of some monetary-and reputation-based approaches. Unlike reciprocity schemes, the contribution level of peers is session-based and its value is credibly derived.

Proposed credit-based approach
The architecture of the credit-based approach is comprised of three components: an upload manager, a download manager, and a time manager. The upload manager tracks the number of uploaded resources. The download manager is responsible for approving or denying download requests from all peers. After downloading a file, a peer is entitled to a finite period of time (i.e., grace period) from the time of download during which they must reimburse the network with a file upload; if they do not do so, subsequent service requests are denied. This time until reimbursement is tracked by the time manager, and benefits provided to peers are dependent on that time. This component responds to download requests as follows: I. A download request from a first-time peer is approved for download, and the timer is initiated. II. A download request from an existing peer is subject to a time check; if the timer is within the grace period and the peer has already uploaded one or more files, then the download request is approved, and timer is restarted. III. A download request from an existing peer whose grace period lapsed is subject to further checks; if the peer has already uploaded two or more files, then the download request is approved and the timer is restarted. Otherwise, the download request is denied. The main steps of the algorithm underlying the credit-based approach are shown in Fig. 1. The download requests from all peers are monitored in the proposed approach. Download requests from first-time peers are approved and a timer is initiated. For subsequent download requests, the upload manager notifies the system of the number of uploads by the requesting peer. If the user has uploaded one or more files, the timer (which is initiated with every new download) is compared against the allotted grace period. If the time of request is within the grace period, then the download request is approved. If the grace period has lapsed, then the quantity of uploads by that user is checked. If the peer uploaded two or more files, then the download request is approved and the timer is restarted. Otherwise, the request is denied. Of course, subsequent download requests are also denied if the peer fails to upload any files.

Experimental setup
The aim of this paper is to introduce a novel credit-based approach that can be applied to P2P networks to overcome free-riding behaviour and reduce its ill-effects. This is possible with early detection of potential free-riders and denial of their download requests. The primary hypothesis is that the proposed approach will mitigate the effect of free-riding in P2P systems and improve the download experience of non-free-riding peers. An evaluation framework was implemented to test this hypothesis. Utilised software tools include jGRASP and Eclipse Java EE Developer tools. The tools run in a Windows operating system environment. The simulations are conducted on a system with an Intel Core i5 processor, 1.60 GHz, 2.29 GHz, and 4 GB of RAM. The following performance measures were considered: I. Number of downloads: This measure refers to the number of downloads per peer by all types of peers in the network. The measure is indicative of peers' level of satisfaction; the higher the number of downloads per peer, the more satisfied the peer. II.
Number of uploads: This measure refers to the number of uploads per peer by all types of peers in the network. The measure is indicative of peers' contributions to the network. Two experiments were designed to evaluate the simulation based on number of downloads and uploads: I.
In the first experiment, the proportion of free-riders was varied from 10% to 90% in increments of 10%. II.
In the second experiment, a variable grace period was used. The grace period assigned to downloading peers (i.e., non-free-riding peers) varied across the range [time/4, time/3, time/2], where time=(# of peers-#of free-riders)×MAX # of uploads per peer. The proposed approach aims to curb free-riding behaviour by disfavouring free-riders. Other, non-free-riding, peers are presented as one of two models: I. Fast peers reimburse the network with one or more uploads within the allotted grace period. II. Slow peers fail to upload a resource within the grace period but are able to reimburse the network with two or more files after that time. A variable number of fast and slow peers is also considered based on the total number of peers and the number of free-riders: Number of slow/fast peers=(# of peers-# of free-riders)×50% The rest of the parameters were considered to be constants at the following values: I. Number of peers=100 peers. II.
Number of files=20 files for each peer. III.
Maximum number of uploads for each peer=10 files. The rest of this section describes the application of the models and the steps carried out for each run of the simulation and cycle, where each transaction equals one cycle.

Procedure
The network is assumed to be static with a fixed number of peers. That is, no new peers can join the network and no peers can leave the network. There is no limit to the number of files a peer can download, whereas uploads are limited to a maximum of 10 files per peer. All peers had equal opportunities of requesting files. Files can be downloaded at any time. Simulation steps were as follows: I. The number of peers is initialized (100), and each peer is assigned a role: free-rider, fast peer, or slow peer. Role assignment is based on the percentages of each peer in the simulation run. II.
Next, a grace period is calculated based on the varying percentages of peers. III.
At each cycle, peers are chosen randomly to either download or upload files (i.e., downloader or uploader). IV.
During the simulation run, peers interact with each other based on their roles (see Tab. 1). V.
When a peer uploads a resource, the upload counter for that peer increases by one, as does the counter for that peer type. The cycle number also increases by one. However, if a peer fails to upload a file (this could be a free-rider or a slow peer), then the cycle number does not increase. VI.
When a peer downloads a resource, the download counter for that peer increases by one. So does the download counter for that peer type. The cycle number also increases by one. VII.
As contributing peers reach the maximum upload limit (10 files), the cycle concludes, and the simulation run ends. The simulation run is repeated first for varying percentages of free-riders and then for various grace periods. For each completed run, the number of downloads per peer and number of downloads per type of peer are calculated.

Results and discussion
This section compares the performance of the simulations utilizing our proposed creditbased approach against the performance of a benchmarked system prior to applying the proposed approach. The experiments are conducted by running the simulation tool a number of times at varying percentages of free-riders and grace periods. Fig. 2 shows the number of downloads completed by free-riders and non-free-riders under escalating percentages of free-riders. Fig. 2(a) shows the number of downloads before applying the credit-based approach to overcome free-riding behaviour, while Fig. 2(b) displays the results after applying the proposed approach.

Variable percentages of free-riders
(a) The number of downloads by freeriders and non-free riders before applying the credit-based approach.
(b) The number of downloads by freeriders and non-free riders after applying the credit-based approach.

Figure 2:
The effect of varying the percentage of free-riders (a) before and (b) after applying the credit-based approach to overcome free-riding behaviour As expected, Fig. 2(a) shows that before applying our approach, when the percentage of free-riders increased, the number of downloads increased as well. It was also anticipated that as the number of free-riders escalated, the number of downloads from non-free-riders would decrease. The figure indeed shows that after the percentage of free-riders increased to 40%, the number of downloads by free-riders decreased along with the number of downloads by non-free-riders. This is because the number of contributing peers (i.e., nonfree-riders) decreases because the simulation assumes a fixed number of users. It is evident that as the number of free-riders increases within a network, the network's performance will be harmed. Fig. 2(b) displays the number of downloads completed by peers after applying the proposed credit-based solution. It is clear that under all percentages of free-riders, as anticipated, the number of downloads by free-riders was lower in comparison to downloads by free-riders in the benchmark simulation. This is because free-riders' download requests were denied as they failed to contribute within the allotted grace period. Because the effect of freeriding was greatly reduced after applying the proposed approach, the number of downloads by non-free-riders was markedly increased. Thus, download priority was given to contributing peers. The effect of varying the percentages of free-riders is shown by peer type in Fig. 3 before and after applying the proposed credit-based approach. As was clarified earlier, the number of downloads by free-riders (see Fig. 3(a)) markedly decreased after applying the proposed method. As expected, there was a gradual increase in the number of downloads as the number of free-riders increased in the network. This is because first-time download requests of all peers were approved, while subsequent requests were only approved if the download resources have been reimbursed. This clearly indicates that the proposed method effectively detected potential free-riders and mitigated their effect on the network.
(a) The number of downloads by freeriders before and after applying the creditbased approach.
(b) The number of downloads by non-free riders before and after applying the creditbased approach.

Figure 3:
The effect of varying the percentage of free-riders before and after applying the credit-based approach to (a) free-riders and (b) non-free-riders The effects of applying the credit-based approach on non-free-riders is illustrated in Fig.  3(b). It is clear that under varying percentages of free-riders, the number of downloads when the credit-based method is applied is higher than the number of downloads before it is applied. This is because the free-riding effect is reduced with early detection of freeriding behaviours. This indicates that non-free-riding peers were given priority in contrast to what is seen without the proposed method. Because this simulation limits the number of uploads by each peer, the total number of downloads by non-free-riders decreased as the percentage of free-riders increased. shows that the number of downloads from free-riders was lower than the number of downloads by non-free-riders (excluding network saturation of free-riders at 90%). The effect on non-free-riding peers was also evident; the number of downloads by fast peers is greater than the number of downloads by slow peers. This is because the proposed approach rewards (i.e., approves download requests) reimbursement within the grace period, since no interest is expected. Thus, slow peers' delay in reimbursement further delays their reward.
The main findings of varying the percentage of free-riders indicate a considerable effect on the number of downloads upon applying the proposed credit-based approach. It is clear that applying the credit-based approach greatly reduced the number of downloads from free-riders, for instance a network that consisted of 70% free-riders reduced their number of downloads from 166 to 70 downloads. At an even lower percentages, the decrease was more evident (e.g., at 30% the number of downloads decreased from 249 to 30 downloads). The proposed approach also impacted the number of downloads by non-free-riding peers.
In a network composed of 70% free-riders, the proposed approach increased the number of downloads by non-free-riders from 34 to 230 downloads. The results also demonstrated the effect of the credit-based approach on the timely compensation of fast peers over slow peers who must reimburse with interest. While the reduction of free-riding behaviour benefited both types of peers, fast peers were favoured over slow peers as they did not incur interest (see Fig. 4). This indirectly offers an incentive for timely contributions. Fig. 5 shows the number of downloads of fast and slow peers at varying percentages of free-riders and varying grace periods. The simulated grace periods include periods equal to 1/4, 1/3, and 1/2 of the total time. It is evident in Fig. 5(a) that as the duration of the grace period increased, the number of downloads from fast peers increased as well. This is largely due to the fact that the longer grace period denied other peers requests for downloads for that length of time. This particularly affects slow peers as they attempt to reimburse the network after that period. Because this simulation limits the number of uploads from each peer, the chance for fast peers to download increases. Fig. 5(b) clarifies these results. Downloads by slow peers decreased as the grace period increased. After the grace period passed without being reimbursed by a slow peer, the peer was expected to reimburse the system with two uploads instead of one. And because the system after the credit-based approach was not compensated, slow peers were prevented from downloading files. And as the simulation limited uploads to 10 files, the chance to download was won by fast peers.

Variable grace periods
(a) Fast peers' downloads at varying percentages of free-riders and periods.
(b) Slow peers' downloads at varying percentages of free-riders and periods.  6 demonstrates the effect of varying the grace period duration on the number of uploads performed by non-free-riders, i.e., fast and slow peers. This assumes no limits to the number of uploads per peer and a total time of 10,000 units. The figure shows that as grace period duration increased, the number of uploaded files decreased. This indicates that the shorter grace period provided an incentive for peers to upload as soon as they can contribute. Also, with a shorter grace period, the number of files in the network increased, which is a desirable state in a P2P network.

Conclusion and future work
Peer-to-peer (P2P) systems facilitate the direct exchange of digital contents to encourage sharing and collaboration among individual peers. However, free-riding raises a number of challenging issues that hinder this sharing due to their unfair consumption of resources from other peers without offering any in return. A clear gap in the literature has been identified as existing approaches falls short of effectively addressing free-riding behaviour in P2P networks. In this paper, an approach based on credit cards and grace periods for discouraging free-riding behaviour in P2P networks was proposed. The approach encourages timely reimbursement of system resources (files) to avoid incurring interest. In the case of P2P networks, free-riders are denied download requests if they fail to reimburse the network during the grace period. Simulation results show that the credit-based method effectively manages free-riding behaviour and achieves its objectives of enticing cooperation and achieving fairness among participating peers. The system clearly provides appropriate incentive for peers to contribute and fairly consume resources.
The main contributions of this paper can be summarised as follows: I. Design and implementation of a novel approach for discouraging free-riding based on a monetary-type credit incentive. This approach has not been previously considered. II.
Thorough evaluation of the proposed system with varying percentages of free-riders and variable grace periods. III.
Facilitation of digital content exchange among peers in P2P networks with fair consumption without any compromising. For future work, we intend to improve and extend the proposed methods in the following ways: I. Enhance the system by varying grace periods based on the popularity of downloads. II.
Mitigate the effect of free-riders that attempt to cheat this approach by repeatedly consuming one file, leaving the network, and then re-joining the network and consuming again. III. Further enhance the system by tracking and checking the quality of uploaded files to ensure that the same file is not repeatedly uploaded or that the uploaded file is in fact fake. IV.
Comparatively assess the performance of the proposed credit-based approach against similar algorithms to determine its success rate and runtime performance.