Racing on the Tangle II. Protocol
The full article was originally published by Evaldas Drąsutis on Medium. Read the full article here.
Continued from Racing on the Tangle I. Vision
Transaction confirmation nowadays is up to the Coordinator (a.k.a. Coo). Coo is a trusted 3rd party and we have to rely on it. That doesn’t help us to make the game trustless.
If not for Coo, it wouldn’t be easy to determine who came first in the race: exact confirmation time would be subjective measure on the Coo-less tangle. With Coo we are dealing with an index of the confirming milestone instead of exact confirmation time (milestone indices play the role of a clock). If two transactions were confirmed by different milestones, indices of those milestones tell us which one came first. If both were confirmed by the same milestone, there’s no way of knowing which one was first by definition.
This makes the jury’s decision about who came first rather simple in today’s tangle. It would take an assembly of oracles to make a decision in coo-less tangle though.
In today’s tangle the prize fund can be distributed among winners only with the help of a trusted 3rd party: the organizer. The organizer is the one who owns seeds of registration and prize fund addresses. It is up to the organizer to run the reward distribution algorithm.
To make the race trustless, oracles, smart contracts and value transfer gateways will be needed for the jury. That will come with Qubic.
Who can be the organizer of the race? Anyone trusted. The question who is trusted and who’s not is outside the scope of the race itself. There must be some reputation system behind.
It is not possible to completely avoid the organizer’s function because someone has to announce a new race. However, in the trustless version that would be the organizer’s only function because the rest (announcing the start, account ownership, reward distribution etc) can be run by smart contract in the Qubic environment.
Open and permissionless Qubic environment would allow to make even judging itself permissionless. I can imagine different versions of judges (qubics) coming to decision by voting in the jury (assembly).
I believe this kind of game is rich enough to be testing ground or even proof-of-concept for different aspects of Qubic. It would be interesting to test the idea of permissionless and trustless racing game as such: without any 3rd parties involved in decision making, only the technical aspects of organization.
Meanwhile, the organizer of the race and whoever controls the Coo can’t be participants of the race due to conflict of interest.
1. Announcement of the race and registration of participants
The organizer publicly announces the registration address. The seed behind is owned by organizer.
All initial information about the race will be contained in confirmed bundle attached to the registration address. It includes race id, minimum deposit, registration period, required length of the sequence for PoD, and probably more data.
Participants will have to transfer a minimum amount (or more) of iotas to the address’s balance until the registration is closed. The registration bundle will have to contain the participant’s name chosen by him/her and probably other information in agreed format in the message part of the bundle. Only confirmed bundles count.
Hash of the registration bundle (or fixed part of it, to fit into tag field) will be used as the unique id of the participant during the race.
The registration is over when the organizer transfers the entire prize fund from the registration address to the prize fund address. Registration is not possible after the moment iotas are transferred. All balance that has not been transferred (confirmed later) will be considered a donation.
In the Qubic version this stage would be really trustless. The prize fund will be controlled by smart contract (oracle). The entire registration process will be controlled by the jury (qubics run by oracles). It would automatically stop the registration phase and announce registered participants.
All iota would be transferred to the prize fund account by smart contract with the help of a special gateway (this part is still unclear in the Qubic’s architecture)
2. Start and the race
Race starts the moment when the organizer publishes special target address by attaching special transaction to the registration address. Target address is owned by the organizer, too. Target address (hash) serves two purposes:
- each sequence of transfers (proof of distance, PoD) must end with confirmed transfer to the target address: that will be A(N) address for each participant;
- each bundle in the valid PoD must contain this address in its message segment along with the participant’s id tag. This will prevent precalculated PoD attack.
Immediately after target address becomes public, participants start building their PoD sequences.
The progress of the race can be monitored by anyone in the tangle by knowing each participant’s id tag. By retrieving and analyzing respective transactions, one can see the progress of a particular participant, how close to the finish it is. Other actors can help the participants e.g. by promoting their transactions.
3. Finish of the race
The race is considered finished when at least M participants (M>=3) fulfill end conditions and there’s clear evidence who came 1st, 2nd, 3rd. With the today’s tangle there might be a situation when two participants finish their PoD under the same milestone index. This part of judging rules is still to be defined. The race may be prolonged or some tie result can be accepted.
In Qubic environment, the jury/assembly of oracles would make a decision. There’s no guarantee that clocks of oracle machines are synchronized, therefore quorum comes into play and decision of who’s 1st, 2nd, 3rd is made by analyzing timestamps of transactions and voting.
Finish condition is considered fulfilled if participant confirms the bundle of transfer of 1 iota to the target address and that bundle points to the valid Proof Of Distance.
Validity of PoD can be calculated with certainty. However, the final responsibility is on the organizer who owns and runs the jury algorithm.
In Qubic environment validation of PoD can be a collective decision of the jury of judges, oracles each running their qubics, own versions of PoD validators.
Distribution of rewards
After the decision is taken, the prize fund is distributed according to the formula. In the current tangle it can only be done by the organizer running its algorithms and applying seeds.
In the Qubic environment the final stage may be managed by jury: a smart contract, run by an assembly of oracles. Smart contract receives PoD-s, decides who’s 1st, 2nd, 3rd, and initiates prize fund distribution automatically using value transfer gateways.
Feedback is appreciated 🙂
Donations 💚: RLW9PUQJXCIWJRSYQSMIT9BOHIKALVYFSBHJWGTXCVQUUPHLOTBDZVJVNRUSWCXIOPGICGND9YPNEJOIBTDZYABAQD