Techtalk: Differences between public and private trades
2 months ago
After our Update 7.0 the private trade was temporarily broken while public trades still functioned as intended. So some of our community wondered how this was possible. In this techtalk, we will not only explain the differences but also what caused the error in detail.
Generally speaking private and public trades work in the same way but for private trades, we do not write all required data in the blockchain. To explain the process better, let’s go through it step by step:
Read also: How public trades work
If someone wants to trade an asset privately, the trade out is written in the blockchain as a transaction, exactly like a public trade. That means it also requires a transaction fee. Now the second transaction which is needed when trading publicly, is not required in a private trade because the trade offer is not engraved in the blockchain. Consequently, no one knows its details. This makes it impossible for a stranger to finalize the trade.
The trade offer is only encoded as a Base 64 string and contains hardly any information other than the price and how the price must be combined with the trading token which was signed by the seller. The rest is gibberish.
Base 64 strings are anything but a secure encoding. Every client and even some online services can decode it. However, it is not supposed to be secure, it is there to make the sending and receiving of data more convenient.
When the information is viewed by a potential buyer and is decrypted he knows what the trade-in will look like. Now he is able to combine the signed trading token with the correct amount of coins to create a transaction with a valid signature.
The price information is created and stored locally which is why it is not only possible to set a new price after the trade out is created but gamers are also able to create multiple different offers for the same asset.
This is possible because the signature — which is part of the Base 64 string — describes what a valid transaction must look like, in other words, how the coins and the trading token should be combined. Consequently, there is an infinite number of possible signatures but all signatures for the same price are the same.
So what went wrong in Update 7.0?
When a private trade is created, no miner fee is needed, and hence no fee rate is added. But we had to set a fixed fee in update 6.1 because the automatic fee was insufficient to create public trades. We classified the problem with the public trades as fatal because we wanted to release an update as fast as possible. So, we reduced the testing phase to an absolute minimum. Unfortunately, the edge case was not found before the release.