![](https://csdnimg.cn/release/download_crawler_static/17145832/bg3.jpg)
J. Wang et al. / Future Generation Computer Systems ( ) – 3
Fig. 1. Activity diagram for leechers using Quota-Encryption.
3.1. Modeling leechers
Fig. 1 depicts the activity diagram for leechers using Quota-
Encryption. Specifically, whenever (1) setting up a connection,
or (2) receiving an encrypted block or decryption key, or (3)
finishing sending an encrypted block or decryption key, the leecher
evaluates two functions and determines whether it can send an
encrypted block and decryption key without (or at least making
it difficult) being exploited by other leechers.
Given an arbitrary leecher i and one of its neighbors j, a
j
i
counts
the encrypted blocks that i has received from j so far but for which
the corresponding decryption keys are still missing; b
j
i
counts the
encrypted blocks together with the corresponding decryption keys
i has received from j so far. c
j
i
represents the number of encrypted
blocks that i has sent to j so far without offering corresponding de-
cryption keys; d
j
i
represents the number of encrypted blocks with
decryption keys that i has sent to j so far. These four variables are
the only first-hand information that Quota-Encryption relies on.
The contributiveness function f (a
j
i
, b
j
i
, c
j
i
, d
j
i
) determines
whether i is allowed to send an encrypted block to j. Similarly, the
optimism function g(a
j
i
, b
j
i
, c
j
i
, d
j
i
), determines whether i is allowed
to send a decryption key to j. By simplifying the notation, thereafter
we omit subscript and superscript (i.e. i and j) on a
j
i
, b
j
i
, c
j
i
, d
j
i
.
3.1.1. Modeling obedient peers
The obedient peers are common in BitTorrent, and their
contributiveness function f
o
(a, b, c, d) is as follows. The purpose
of the parameter ω is to limit the number of encrypted blocks
obedient peers can prepay, and an assisting function I(x) returns
a boolean result for evaluating a condition x.
f
o
(a, b, c, d)
=
false c ≥ ω
true c < ω and a − c ≥ 0 and b − d ≥ 0
I(|a − c| ≤ b − d) c < ω and a − c < 0 and b − d ≥ 0
I(a − c ≥ |b − d|) c < ω and a − c ≥ 0 and b − d < 0
false c < ω and a − c < 0 and b − d < 0.
(1)
Whenever c < ω, f
o
(a, b, c, d) is divided into four cases:
• If a − c ≥ 0 and b − d ≥ 0, then the obedient peer has an
advantage over its neighbor: a − c ≥ 0 means that it possesses
more encrypted blocks than the neighbor; b − d ≥ 0 means
that it receives more blocks than the neighbor. As a result, it is
allowed to send an encrypted block.
• If a − c < 0 and b − d ≥ 0, then the obedient peer examines
whether it has an advantage over its neighbor: if the deficit of
encrypted blocks abs(a − c) is no larger than the surplus of
blocks b − d, then it is allowed to send an encrypted block.
Otherwise, it is forbidden to do so.
• If a − c ≥ 0 and b − d < 0, then the obedient peer examines
again whether it has an advantage over its neighbor: if the
surplus of encrypted blocks a−c is no smaller than the deficit of
blocks abs(b − d), then it is allowed to send an encrypted block.
Otherwise, it is forbidden to do so.
• If a − c < 0 and b − d < 0, then the obedient peer is in
a disadvantageous position. Hence, it is forbidden to send any
encrypted block.
The optimism function (see Eq. (2)) determines whether an
obedient peer is allowed to send a decryption key: a ≥ ψ states
that it should receive at least ψ encrypted blocks from its neighbor,
where ψ represents the quota requirement of Quota-Encryption;
c > 0 is straightforward as the obedient peer has sent at least one
encrypted block but has not offered the corresponding decryption
key so far; b − d ≥ 0 prevents the obedient peer from offering too
many decryption keys.
g
o
(a, b, c, d) =
true a ≥ ψ and c > 0 and b − d ≥ 0
false otherwise.
(2)
According to the previous definition, if any leecher uploads less
than ψ encrypted blocks to an obedient peer, then the leecher
will never receive decryption keys. If any leecher uploads exactly
ψ encrypted blocks to an obedient peer while not offering any
decryption key, then the former can decrypt at most one encrypted
block but at a cost of uploading ψ encrypted blocks. If any leecher
sends fake blocks, in general it will intentionally avoid offering
the corresponding decryption keys as long as possible. In order
to identify this misbehavior early, Quota-Encryption resorts to the
revealing strategy of decryption keys: leechers explicitly designate
which decryption key their neighbor should offer next. For the
sake of simplicity, this paper employs a random revealing strategy
— the leecher requests its neighbor to offer the decryption key
for an encrypted block that is randomly chosen among those
at hand. Also, whenever leechers identify fake blocks or do not
receive decryption keys in a reasonable time period, they punish
the corresponding neighbors by discarding encrypted blocks the
neighbor prepaid before.
3.1.2. Modeling free riders
The free riders never send encrypted blocks and decryption keys
to their neighbors. Hence, their contributiveness and optimism
functions are:
f
f
(a, b, c, d) = false, g
f
(a, b, c, d) = false (3)
3.1.3. Modeling conservative strategic peers
The conservative strategic peers work almost same as the
obedient peers with the only difference that they reactively send
encrypted blocks and decryption keys. Their contributiveness
function is:
f
o
(a, b, c, d)
=
false c ≥ ω
true c < ω and a − c > 0 and b − d > 0
I(|a − c| ≤ b − d) c < ω and a − c ≤ 0 and b − d > 0
I(a − c ≥ |b − d|) c < ω and a − c > 0 and b − d ≤ 0
false c < ω and a − c ≤ 0 and b − d ≤ 0.
(4)
Eq. (5) defines the optimism function of conservative strategic
peers, and it is quite similar to Eq. (2). The only difference lies in
b − d > 0, which dictates that the conservative strategic peers are
allowed to send decryption keys only if they receive more blocks
than their neighbors.
g
c
(a, b, c, d) =
true a ≥ ψ and c > 0 and b − d > 0
false otherwise.
(5)
Please cite this article in press as: J. Wang, et al., Resisting free-riding behavior in BitTorrent, Future Generation Computer Systems (2009),
doi:10.1016/j.future.2009.05.014