scrobble.life
#epicdice

EpicDice is Open Source now

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.

Comments · 19

  • @bekirsolak(57)· 2604d

    !bookkeeping epicdice

  • @jekhy(7)· 2606d

    Thanks for the post.

  • @phonetix(58)· 2607d

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

    Posted using Partiko Android

  • @fairbet(55)· 2607d

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

  • @jyotigajjar(25)· 2608d

    It's look interesting

  • @arcange(79)· 2609d

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

    • Pending payout - Ranked 1 with $ 203,34
  • @uttamblogs(46)· 2609d

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

  • @ronel(61)· 2610d

    This post has been resteemed! Good luck!

  • @emrebeyler(76)· 2610d

    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

  • @lokiyngling(69)· 2610d

    I am @themarkymark

  • @coinboost(48)· 2610d

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

  • @bangmimi(62)· 2610d

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

  • @oppongk(69)· 2610d

    Thank you @epicdice for your vivid explanation of the nitty-gritty of this game, I really love the way you came out of your measures and opening up things clearly. That is really good to go with it we hope to enjoy best out it!

  • @sneaky-ninja(60)· 2610d

    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

  • @steemitboard(66)· 2610d

    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!
  • @abitcoinskeptic(75)· 2610d

    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.

  • @tipu(68)· 2610d

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

  • @swiftcash(64)· 2610d

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

  • @deanliu(83)· 2610d

    Woot woot!!

    Posted using Partiko Android