Skip to content

Paying out bandwidth tokens in TrustChain

Martijn de Vos edited this page Feb 27, 2019 · 2 revisions

This technical document describes the process of how bandwidth tokens are paid out.

Bandwidth tokens are paid out when a circuit is destroyed by any peer. Circuit destruction could be caused by circuit peers going offline, no data being transmitted over the circuit or by sending invalid packets over it. We provide an example of payouts over a simple circuit that looks like this:

D ----- R1 ----- R2 ----- E

Where D is the initiator of a circuit (usually a peer that downloads some data using an exit node), R1 and R2 are relay nodes in the circuit, and E is an exit node. When the circuit is destroyed, the circuit initiator (D) should payout bandwidth tokens to R1, R2 and E to reward them for the provided services.

Paid out bandwidth tokens flow over the circuit from the circuit initiator to the end of the circuit. First, D pays tokens to R1 and then R1 transfers some of these tokens to R2. Finally, R2 transfers tokens to E. Assume that a total of 100MB has been downloaded by D. The payout scheme looks like this:

  500MB    300MB    100MB
D ----- R1 ----- R2 ----- E

If all nodes start with a balance of zero, the final token balances look like this: D: -500MB, R1: 200MB, R2: 200MB, E: 100MB. Note that the relays are rewarded for handling both incoming and outgoing traffic. The exit node is (only) rewarded for processing incoming traffic in the darknet.

When browsing the trust graph in Tribler, you will see that there are MBs taken, since you are getting paid first and then transfer a part of this payout the subsequent hop in the circuit. Also note that for every payout, there are two TrustChain transaction created: one where you counter-sign a transaction with incoming tokens and one where you transfer these tokens to the next hop in the circuit. We aim to improve this mechanism and the way we visualize contributions to the Tribler network, based on the feedback of users.

The example given above assumes a simple data circuit. Payouts in end-to-end encrypted circuits proceed slightly different. Since these e2e-circuits consists of a circuit part initiated by the downloader and a circuit part initiated by the seeder and since the downloader does not know the length of the circuit initiated by the seeder, they only pay for a single hop on the side of the seeder.

Open issues of the payout mechanism are described in https://github.com/Tribler/tribler/issues/4255.