BitTorrent was long believed to be robust to free-riding behavior. Yet, some recent studies show that misbehaving peers download far more than they upload and free riders even upload nothing at all. In order to guarantee the upload fairness among peers, this paper proposes a quota-based encrypted block trading protocol (Quota-Encryption for short). The basic idea is for peers to prepay a "quota" of encrypted blocks to each other and then to alternately reveal decryption keys. Simulation results show that it guarantees better upload fairness among peers, making the free-riding behavior impossible in BitTorrent. (c) 2009 Elsevier B.V. All rights reserved.