How does this work? Whats done? What's left to do?
Yesterday with the help of a few people ( @elgeko @crimsonclad ) I tested the secured transaction mechanisms and memory management satisfactorily. Allow me to run down why and how these work:
Much like Hive Engine, Decentralized Limitless User eXperiences tokens exist on a "side" chain. Roughly speaking this means that state (the current facts, the state of things) is changed solely by on chain transactions. Where these two protocols differ is Hive Engine is a centralized service, while DLUX aims to be a decentralized service. Relying on the cryptography of HIVE DLUX would meet the standard definition of a block chain.
On HE to swap tokens you send a custom JSON or a Hive Transfer and their server reads it and makes changes to their state. If you're Justin Sun or somebody else hated by as few as one person conceivably HIVE engine could confiscate or alter your tokens. DLUX on the other hand is meant to be run by several people. Where much like HIVE itself it would take a majority of witnesses to alter accounts and balances.
Now the tricky part is switching your HIVE tokens for DLUX tokens. Yes, much like bitcoin you can send your tokens to somebody and grow the ecosystem without an automated interface. Price discovery is obscured and easily manipulated. So knowing that every person who runs a DLUX node will also have a Hive account I could take advantage of a key feature available on Hive: Escrow Transactions!
In simple terms running a node is much like playing Settlers of Catan. You have a clearly defined rule book with clearly defined ways to earn points. Now you want to trade some wood(HIVE) for some bricks(DLUX). You can see everybody who is playing. You, Alice, sends an escrow transaction of 1 wood, hoping to receive 2 bricks, to Bob with Charlie as the escrow agent. The rules are simple enough, if Bob or Charlie mishandle the escrow transaction all the players will force them to dump 4 bricks with Alice receiving 2 of the bricks. If Dan, Erin, or Floyd... or even Bob or Charlie wish to spend 2 bricks to get the one wood they'll send a custom Json transaction letting all the player know they accept the terms. All the players adjust the wood/brick balances as the escrow transaction goes through and Bob finally sends the wood to the purchasing player. If the last transfer fails to happen Bob will have 4 bricks subtracted from his balance by all, and two will return to the purchasing player. By collateralizing the transaction the worst that can happen from the point of view of the initial and purchasing players is a failed transaction. From the point of view of the bad actor the best they can do is pay double the listed price for a resource.
The above has been tested for HIVE to DLUX, DLUX to HIVE, HBD to DLUX, and DLUX to HBD. The mediating transactions are all deterministic and expected by all node runners. In addition escrow transactions expire, and users can cancel their own trades. The memory management of this has also been tested.
Now imagine that nobody wants to buy 1 wood for 2 bricks... Dan then posts a trade for 1 wood for 5 bricks. This price condition has decollateralized the first trade. Meaning the best a bad actor can do is beat the current price by 20%. To prevent this trades will not be accepted by the players if they are outside of 20% of the current price; and all current trades will be dropped if the current(volume weighted) price will fall outside of 50-150% of the trade price.
The above restrictions have yet to be fully implemented and tested.
The good news is that this open source mechanism can work to build trustless token markets on HIVE with enough support from the community. What's good for DLUX will be good for everybody who wants to build on Hive. In addition the group of node running the token will also be able to deterministically control a multi-signature wallet. Making even cross chain exchanges(bridges) possible. Chainlink to Hive anybody?
My goal is to build this protocol that can be run by any community.
You can hear more this Sunday at 5PST on The Cryptocurrency Generation in AltSpaceVR hosted by @qwoyn (of @hashkings and @etherchest )