EpicDice is Open Source now

in #epicdice5 years ago

Artboard 5@20x.png

EpicDice is a decentralized gaming platform built on top of Steem blockchain with absolute transparency and fairness. Join the most epic fun today!

https://epicdice.io/


EpicDice is Open Source now

In accordance with EpicDice's manifesto to be the most transparent and fair casino, we've decided to open-source the core code of our business, dice game. So it's clear how every bet is being handled every step of the way. Many platforms promise a fair game but don't open up their code for peer-review. We can understand that sharing vital code this way would potentially create uninvited rivals, but we believe more that open-sourcing could uplift the platform in a compelling way.

While trust in a closed system can be convenient at times, nothing is more trustable than mathematical certainty and utter transparency.

GitHub repository: https://github.com/casinosteem/EpicDice

Brief explanation of the code

Block was read based on block number and always trying to catch the latest block.

 try:
            blockchain = Blockchain()
            print('Block : ' + str(getblock))
        except:
            print("Latest Block")
        try:
            block = Block(getblock)
        except:
            block = None
            printX('###########################')
            printX('#### End of Block #########')
            printX('###########################')

Iterating each transaction on every block to check any transaction is send to @epicdice, then storing all crucial value into global variable which later will be stored into local database for processing.

 for i, txs in enumerate(block.transactions):
                for (j, tx) in enumerate(txs['operations']):
                    if tx['type'] == 'transfer_operation' and tx['value']['to'] in [watching]:
                        if tx != None:
                            transId = txs['transaction_id']
                            precision = str(tx['value']['amount']['precision'])
                            nai = tx['value']['amount']['nai']
                            fromWho = tx['value']['from']
                            toWho = tx['value']['to']
                            amount = tx['value']['amount']['amount']
                            ref_block_num = txs['ref_block_num']
                            transaction_num = txs['transaction_num']
                            block_num = txs['block_num']
                            memo = tx['value']['memo']
                            transType = tx['type']

Calculation of the possible winning payout and go through a series of validation checking.

   win = (float(finalAmount) * 100/factor) * ( 1 - houseEdge)
                            win = float_round(win, 3, round)

Most crucial part of entire program, it calculates result of bet based on transactionID , this code is same as Javascript found on the website Fairness tab

 while result > 999999:
            try:
                chop = txid[offset:endValue]
                offset += 5
                endValue = offset + length
                result = int(chop, 16)
                printX('chop ' + chop)
                printX('txid ' + txid)
                printX('result ' + str(result))

                try:
                    tempResult = result % (10000)/100
                    printX('Below Rounding Result : ' + str(tempResult))
                    tempResult = int(round(tempResult))
                    printX('After Rounding Result : ' + str(tempResult))
                    if tempResult == 0:
                        printX('tempResult is zero .. trying next 5 char ')
                        result = 1000000
                except Exception as e:
                    print('error '+ str(e))
            except:
                result = -1

Determining winning or losing bet of "Above" or "Under"

 won = 0
        factor = 0
        if result > -1:
            result = tempResult
            processed = True
            try:
                details = memo
                prediction = ""
                details = str(details).lower()
                rate = 0
                betType = 0
                if 'over' in details:
                    indexOfSpace = memo.index(" ")
                    rate = int(memo[indexOfSpace:indexOfSpace + 3])
                    prediction = memo[:5+3]
                    betType = 1
                    factor = 100 - rate
                    if result > rate:
                        won = 1
                elif 'above' in details:
                    indexOfSpace = memo.index(" ")
                    rate = int(memo[indexOfSpace:indexOfSpace+ 3])
                    prediction = memo[:6+3]
                    betType = 1
                    factor = 100 - rate
                    if result > rate:
                        won = 1
                elif 'below' in details or 'under' in details:
                    indexOfSpace = memo.index(" ")
                    rate = int(memo[indexOfSpace:indexOfSpace + 3])
                    prediction = memo[:6+3]
                    betType = 2
                    factor = 0 + rate - 1
                    if result < rate:
                        won = 1
                else:
                    factor = 0   
            except:
                factor = 0

Payout of winning bet and the generation of memo

if won == 1 and factor > 0:
                processed = False
                payout = (float(amount) * 100/factor) * (1 - houseEdgeParam)
                payout = float_round(payout, 3, round)
                try:
                    transactionJSON = {}
                    transactionJSON["diceRolled"] = str(result)
                    transactionJSON["TransactionId"] = txid
                    transactionJSON["BlockNumber"] = str(block)
                    transactionJSON["isValid"] = True

                    clientTransfer(watching, user, str(payout) + " " + asset, 'You have Won! Dice Rolled: ' + str(result) + ". Your Prediction: " + prediction + ". Multiplier: " +  str(multiplier) + ". Win Chance: " + str(factor)+ "%" + '\n' + json.dumps(transactionJSON))
                    print('>>>>>>>>>>  ' + user + ', You Won! . Dice Roll : ' + str(result) + " Your Prediction: " + prediction + ". Multiplier: " +  str(multiplier) + ". Win Chance: " + str(factor)+ "%" + '\n' + json.dumps(transactionJSON) + " amount " + str(amount) + " currency " + asset)
               
                except Exception as e:
                    print('ERROR SENDING MONEY ' + str(e))

Notification of losing bet processing.

elif won == 0:
                payout = 0.001
                try:
                    transactionJSON = {}
                    transactionJSON["diceRolled"] = str(result)
                    transactionJSON["TransactionId"] = txid
                    transactionJSON["BlockNumber"] = str(block)
                    transactionJSON["isValid"] = True
                    clientTransfer(watching, user, str(payout) + " " + asset, 'You Lost. Dice Rolled: ' + str(result) + ". Your Prediction: " + prediction + ". Multiplier: " +  str(multiplier) + ". Win Chance: " + str(factor)+ "%" + '\n' + json.dumps(transactionJSON))
                    print('>>>>>>>>>> ' + user + ', You Lost. Dice Roll : ' + str(result) + " Your Prediction: " + prediction + ". Multiplier: " +  str(multiplier) + ". Win Chance: " + str(factor)+ "%" + '\n' + json.dumps(transactionJSON) + " amount " + str(amount) + " currency " + asset)
                  
                except Exception as e:
                     print('ERROR SENDING MONEY 2 ' + str(e))        

Development updates

Interesting treats are being prepared in the kitchen now! As one may already learn from the post of our mod @hitmeasap, EPC Airdrop is definitely the next big thing we are cooking right now together with mobile support development. We don't have much detail to expose about the Airdrop until the backend system is ready and testing is done. The team is always working towards a better service both in higher technical and branding level. Be sure to stay tuned by following the official account @epicdice or joining our discord channel for direct communication with us.

Keep up that epicness!

Earn EPC via delegation

EPC is the only token to earn from the daily dividend and prize pool in STEEM. Every 1 SP delegation earns 2 EPC daily. It takes one day for the delegation to be effective in order to receive the dividend from the moment of delegation.

Quick delegation via Steemconnect links below:

100 SP | 500 SP | 1000 SP | 5000 SP | 10000 SP


Join our Discord server for better communication.

Sort:  

1 steem = 2 epc daily
Price: 0.00015 STEEM / $0.00005
X 730
= .1095

APR of 11% is based on the sell which is 50% higher than the buy.
I'm not even going with the demand price and could immediately buy 1.5 Million EPC at that price.

The APR for delegating Steem in exchange for EPC is very underwhelming given the demand for EPC. You should consider adjusting it based on price. Right now 1 steem for 4 daily would be somewhat tempting.

I've suggested this option to the team and I'm glad we're seeing the same way for the delegation. I'm hoping the team will re-consider this suggestion.

🎅🏿

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

It's possible that they do not need too much SP at the moment. After all, their business model is not based on SP, but gambling, which requires some SP that can provide enough RCs.

That is my thought too. If people go for it at this rate, why not?

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

I second this... There should be adjustments.

Posted using Partiko Android

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

Market price is way to easy to manipulate at this thin volume and order book. Even if it is not, adjusting a fixed reward rate according to a fluctuating market measurement is never a good idea. There are several ways to earn EPC like betting, trading, delegation and taking part in giveaways. We glad that you have found the better acquiring way for yourself. Delegation would still serves its purpose for non-risk-takers.

Thanks for the support.

I agree market price is easy to manipulate, also changing the amount constantly would be annoying so pick a term of sayba week or a month and that the median or average price for the next month. As i mentioned, 20% wouldn't be unfair.

I agree EPC from daily prize or gambling os a reward. Hpwever EPC from delegating is not a reward, it is rent (unless maybe you look at delegating to a gambling fund as charity, lol). Therefore, rent should should be rewarded at a consistant rate.

Someone else mentioned that you guys probably don't really need delegations and I imagine this could be a reason. Either that or there are enough suckers around here who have a very ignorant form of speculating since as I mentioned one can delegate at 20% and then buy nearly double the amount of EPC tokens with their additional income. This means you are taking advantage of the financially illiterate which kinda seems like something a casino would do.

So your idea that non risk takers are better off delegating is silly because they are much better off buying until the price doubles.

Posted using Partiko Android

It's not their job to babysit the financially illiterate. If people don't like the reward, they can remove their delegation.

Posted using Partiko Android

I am having a hard time understanding your motive to say such a thing. Being an EPIC dice apologist is such an interesting persona.
Were you taken advantage of in a similar way before?
Why you think it is a reward and not income? Do you also think your paycheck or rent is a reward?
It sounds like you are as financially illiterate as the people their delegation program takes advantage of.

Posted using Partiko Android

@abitcoinskeptic

Gambling on epicdice itself is very stupid, you have a negative expected payout ratio because of the house edge. And i once spend like a week trying to beat the casino with all the strategies but none work because there is no skill involved with this type of gambling.The only thing you can do is prolong your gambling experience with a martingale strategy but in the end you end up losing so it only makes sense if you could collect some type of tokens for playing. That's basically the only workaround you have. (In theory a martingale strategy never fails but you would need to have unlimited amounts of money.)

The problem with all that delegation shit is that they can't give more then people would otherwise earn. Let's say for example your voting power is 1 steem per day with curation rewards already taken into account. A dapp can't really payout more then your voting power is worth. Most dapps give worse returns then selling your voting power with minnowbooster or smartmarket.

Besides that many people don't understand inflation. You only earn with your delegation if the return is higher than the annual inflation otherwise it makes no sense.

But in the end it doesn't work trying to educate people and it makes no money. Just keep it quite and take the money instead. Let them gamble, i'm market making epic tokens instead :p Casino's are fun! The now closed Moonsteem casino was also like this. You could earn big returns simply by not gambling but doing the math and investing in the casino instead.

I guess a lot of people don't undertand what risk/return and probability to succes means. That's basically how casinos work. Let's say you have 49% win chance and you can earn as much like you gamble. Then 51% of the time you end up losing and 49% of the time you win as much. This is exactly how epidice makes money. Just some basic math even little kids would understand.

I stopped using these dice games a while ago because they quickly got boring. Most of them are just trying to keep up their game. They need constant pressure and monitoring so they don't get out of line. 2 large ones have gone bust and they are all operating in grey and black areas.
Their tokens must be closely watched because of the way they promote these.
Fair enough to call them rewards when gambling. However when delegating it is quite different.
These casinos have a place on the lockchain and I like them EPIC is one of the better ones, but we shouldn't let down our guard.

Posted using Partiko Android

🎅🏿

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

🎅🏿

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

Good to see you guys are open-sourced. However, I can't see the license. It's not really open-source until it's properly licensed.

Also, this might be inappropriate :P

@emrebeyler please elaborate more on licensed. I would like to learn.

https://help.github.com/en/articles/licensing-a-repository

Public repositories on GitHub are often used to share open source software. For your repository to truly be open source, you'll need to license it so that others are free to use, change, and distribute the software.

Thanks for pointing that out!

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

The Steem Gamblers Association approves your move towards transparency and openness. Keep up the good work!

Thanks for the support!

It's look interesting. May I post on Indonesian?

Please do, we appreciate it.

I always support open source projects as well as decentralized projects.

Decentralized project really makes a good pair with opensource-ness!

Woot woot!!

Posted using Partiko Android

This post has been resteemed!
Good luck!

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

This post is supported by $33.0 @tipU upvote funded by @epictoken :)
@tipU voting service: instant, profitable upvotes + profit sharing tokens | For investors.

Congratulations @epicdice! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published more than 20 posts. Your next target is to reach 30 posts.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

Sneaky-Ninja-Throwing-Coin 125px.jpg
Defended (74.50%)
Summoned by @epictoken
Sneaky Ninja supports @youarehope and @tarc with a percentage of all bids.
Everything You Need To Know About Sneaky Ninja


woosh

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

Great post! I found it really interesting, what language did you code it in?

Posted using Partiko Android

Thanks for the post.

!bookkeeping epicdice

Please use one of the following keywords after !bookkeeping:

drugwars steemmonsters magicdice steemslotgames steembet moonsteem

Thank you for telling us about this game we all will surely go for it.

You received a 10.00% complementary upvote from @swiftcash 🤑
To stop similar upvotes from @swiftcash, reply STOP.

Congratulations @epicdice!
Your post was mentioned in the Steem Hit Parade in the following category:

  • Pending payout - Ranked 1 with $ 203,34

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

.

WARNING: IF YOU REPLY TO THIS ACCOUNT YOU WILL BE FLAGGED, YOUR REP HARMED AND ALL OF YOUR REWARDS REMOVED. DO NOT ENGAGE WITH THE TRASH. YOU HAVE BEEN WARNED

It's look interesting