In yet another display of the growing strength of the Lisk ecosystem, Forging Delegate ThePool has announced the introduction of a gambling Dapp called LDice. The announcement on October 8th makes LDice the first proof-of-concept gambling Dapp to be designed for Lisk Blockchain. Karek, a member of the team, shared a link to the article on ThePool’s own Discord channel as well as Lisk’s. The article on Medium gives a brief overview of the PoC application and the challenges they have anticipated going forward.

They make clear in the article that their work on the project so far has impressed upon them the usefulness of the SDK in producing fast blockchain applications very quickly. One particular comparison they highlighted is that the roll results are returned in just five seconds on Lisk following submission of the transaction. They found that the same process on Ethereum took a minimum of 30 to 60 seconds to return, assuming the transaction was valid with an appropriate fee.

As outlined on Github, they were able to achieve this speed because the block interval of the application was set to 5 seconds and the rolling logic was structured with the aid of a custom transaction. For now, the functionality still needs some work but the PoC lets a user bet a desired amount of token, pick a number to roll under, from range 2–99. Then the user “sends transaction type 12 with asset {“bet_number”:38}. When the transaction is executed, the result is written to the sender account asset in database and balance appropriately updated”.

With time they expect to be able to implement the following features:

Treasury for a native token

A means for gambling with multiple tokens “including but not limited to LSK, with deposit feature via federated peg dex and later with different solution proposed by LiskHQ“

Max profit limited by the percentage of current treasury holdings for a given token

Native token rights to profit from the treasury revenue

Verify and debug undoAsset

A proper client-side application

Additional verification in validateAsset

Ensure true randomness on all forging nodes

If you are more curious about LDice check out the Basic client Html application accessible through http://159.65.53.193 and the Explorer accessible at port 6040: http://159.65.53.193:6040

In a follow-up article, they discussed the complexity of the random number generator issue, especially when it comes to blockchain implementation. It seems like there’s no way to avoid the deterministic approach of using block hash or the pitfalls of atmospheric noise. They explained that “with lisk-sdk 2.3.6, there is very limited choice to solve this problem using just a custom transaction because at the time of execution of applyAsset, there is no access to block storage and especially no possibility to know current block signature as this happens before block generation.”

In light of the current difficulties, a new profit calculation class with the ‘draw’ logic has been developed to be required by a new drawing.js module that listens to event chain:blocks:change and processes drawing accordingly, shortly after block generation. The result is that random numbers can be based on the latest block signature, without waiting for a couple of upcoming blocks, and there is a very small amount of time for an attacker to manipulate drawing results. The only way for forging delegate would be to include different transactions in a block to change block signature and in effect, rolled number. This part has been developed by Corbifex, that made its pool request to ThePool, that then modified it to support treasury.

There is always the option to base rolled numbers on hashes from multiple blocks, however, that comes with the drawback of a delayed result of the bet. With the help of npm library Prando, the rolled number is now deterministic depending on transaction signature and current block signature. ThePool has certainly been hard at work since the rollout of their new website back in August. LDice is the latest in a string of contributions to Lisk since they became an independent forging delegate in 2016. They have previously developed a wallet manager and popular liskstats.net.

———————————————-

Lisk Magazine is a project supported by Lisk Italian Group and EliteX.

Support our work, vote for Lisk Magazine.