Hi, Habr!
Today I will talk about how we developed the transaction mixer for our messenger. While talking about the concept as a whole; I hope it will be interesting for both developers and those who are passionate about anonymity, data protection and the rest of encryption.
Brief background. As you already know, our messenger functions on its own blockchain, and it implements translations of several cryptocurrencies in chat rooms. Add: communication between wallets are public. Therefore, the fact of correspondence and transfer of tokens is available and confirmed on the blockchain. But sometimes the fact of communication (or transfer of funds) can be compromising! Everybody remembers the Three Musketeers and the Queen's suspensions, right?
')
Our users have indicated to us that it is time to eliminate this "loophole in privacy." So we, first of all, removed the message transactions and service transactions from our block browser. Therefore, an ordinary user already now can not establish the fact of correspondence between the two numbers.
But transactions are still stored in the blockchain, and their metadata can be retrieved using the API. Therefore, we decided to create a transaction mixer, which could be connected if it is important to hide the fact of transfer or correspondence.
The principle of work: to collect and share
We decided to use a technology similar to the one used by popular anonymous cryptocurrencies: Z-Cash, Monero and others.
The mixer here acts as an intermediary. Like any user of our messenger, he will have a unique address. When sending a message or transfer via a mixer, a record will appear in the blockchain that user A has committed a transaction to the address of the mixer.
The mixer collects messages and translations, and sends them to recipients from its address. User B will not receive the message from user A, but from the mixer.
The more people use the service, the greater the anonymity it gives. When a mixer has many inbound and outbound transactions, it is difficult to track exactly which address user A sent the message to. In addition, the mixer will do intermediate transactions between internal wallets.
No one can be trusted
On the Internet, you can not trust anyone, including the mixer. Therefore, we made it so that the intermediary could not decipher the text of the message - only the address of the recipient. This is achieved by the fact that the message is encrypted twice.
Classic dispatch mechanism
The mechanism for sending through the mixer
Let me explain in words how the process happens.
- For the first time, Alice encrypts the message text with Bob's key.
- Then he adds Bob’s address and encrypts it with the Mixer Key again.
- The mixer can decrypt only its part and get the address of Bob.
- After that, Mixer adds her address to Alice’s encrypted message and encrypts it with Bob's key.
- Bob retrieves the message from the blockchain; when it is first decoded, it recognizes the sender, and with the second, the message text.
However, the mixer knows the addresses of the senders and recipients, and there is potentially a risk of disclosing this information. With higher cyber paranoia, you can protect yourself by 146% using a system of several mixers.
Some more gourmet cuisine
Cryptocurrency payments within our messenger can also be made through a mixer. So the connection between the wallets will be hidden. The sender indicates the transfer amount, the address and the maximum time delay, and the mixer sends the tokens in parts and at different times. It will collect transactions of several users and make transactions between internal wallets, and thus hide communications between recipients and senders.
At the same time, the cryptocurrency will be stored for some time in its wallets. Therefore, the mixer will have to be trusted. To cheat was unprofitable, we will introduce a fee for registration of public mixers and make ratings.
The founders of the mixer will have a choice whether to make it public (accessible to everyone), while taking a fee for transactions and making a profit. Or not to register it in the general register. Then the mixer will be anonymous, but it will not receive profit from transactions. This is an option for those who want to set up a service for themselves - for example, for correspondence of company employees.
If we successfully implement the concept, a little later I will make a “technical” post on the same topic.