HOPR is building a privacy-focused network featuring a built-in incentive model. The reviewed HoprChannels contract allows nodes to create a payment channel between each other and authorize transfer of HOPR token between them. These transfers are done via a ticket system, where each ticket has a certain predefined probability to win. Winning causes a transfer of tokens between the channel participants. On a code level the channels are unidirectional, meaning channel “A to B” is not equal to “B to A”.
To keep the whole process fair, the winning probability depends on variables that are unknown in advance. For each ticket emitted by A for the “A to B” channel, B has a commitment that is unknown to A. Meanwhile, B does not know this proof of relay in advance and has to transfer the message further to the network to know it. This process makes HOPR’s proof-of-relay incentive mechanism cheat-proof and ensures relay node operators actually do their work to get paid.
Each of these unidirectional channels has “channelEpoch”, “ticketEpoch”, and “ticketIndex” as associated variables, which the ticket emitter is assumed to take in account during the generation.