EpicDice is a decentralized dice game built on top of Steem blockchain which aims to provide a refined gambling experience while keeping simplicity intact.
https://epicdice.io/
How to pick the winners?
In the first week of EpicDice's opening, we received tremendous support and hit at least over 8000 transactions in the game, and over 100 resteems of the last post. However, only 93 of them are valids and here is how we going to pick the winners randomly with a simple script.
We aim to write a program that is as provably-fair as possible, just like our dice game. And here is briefly how it works:
- Extract out all resteemers of the post.
- Filter out resteemers with less than 200 followers.
- Each of the potential resteemer will add into array with indexed from 0 - n , subsequently convert the array to string value.
- Apply SHA256 Cryptographic to the string array for hash generation.
- First 5 character of hex value will convert into decimal value for first prize winner. Subsequent 5 character for second prize winner and so does for the 3rd prize.
- The decimal value will normalise from range 1 - 1000. This value will use to calculate remainder base on total number of resteemer. The remainder will be used as index to the initial list of resteemer to select winner of the contest.
In short, the result of this script will always be the same no matter how many time it runs. Below is the code snippet.
from steem import Steem
import random
import hashlib
import base64
import calendar
import time
from datetime import datetime, timezone
#create steem instance
s = Steem()
d = datetime.utcnow()
unixtime = calendar.timegm(d.utctimetuple())
def getDateTime():
utc_dt = datetime.now(timezone.utc) # UTC time
dt = utc_dt.astimezone() # local time
return str(dt)
user = 'epicdice'
postLink = 'epicdice-a-highly-rewarding-dice-game-on-steem'
reblogs = s.get_reblogged_by(user, postLink)
potentialWinnerList = []
counter = 0
for potentialWinner in reblogs:
if s.get_follow_count(potentialWinner)['follower_count'] >= 200 :
potentialWinnerList.append(potentialWinner)
counter = counter + 1
if not potentialWinnerList:
print("No winners :( The list is empty")
else:
hashValue = hashlib.sha256(str(potentialWinnerList).encode('utf-8')).hexdigest()
first = hashValue[0:4]
second = hashValue[5:9]
third = hashValue[10:14]
result1 = int(first, 16)
result2 = int(second, 16)
result3 = int(third, 16)
finalResult1 = result1 % (10000)/10
finalResult1 = int(round(finalResult1))
finalResult2 = result2 % (10000)/10
finalResult2 = int(round(finalResult2))
finalResult3 = result3 % (10000)/10
finalResult3 = int(round(finalResult3))
print("*********************************************************************************************************")
print("potentialWinnerList : " + str(potentialWinnerList))
print("hashValue : " + hashValue)
print("Total Resteem : " + str(counter))
print("First Prize Winner : " + potentialWinnerList[finalResult1 % counter])
print("Second Prize Winner : " + potentialWinnerList[finalResult2 % counter])
print("Third Prize Winner : " + potentialWinnerList[finalResult3 % counter])
print("Unix time : " + str(unixtime))
print("UTC Date : " + getDateTime())
print("program Ended *****")
Here is the winners!
Below are the result generated from the script above.
potentialWinnerList : ['abitcoinskeptic', 'afknchill', 'akshaykumar12257', 'alauddinsee', 'allyouneedtoknow', 'andrea97', 'aniestudio', 'ansoe', 'arkhan', 'austinbiswas', 'badchistes', 'bait002', 'bayeco06', 'beat-the-bookies', 'beco132', 'beggars', 'benedict08', 'bigpanda', 'boddhisattva', 'bonp', 'cgbartow', 'chetanpadliya', 'chisteland', 'crypticat', 'crypto-wisdom', 'cryptoknight12', 'dab.panda', 'deanliu', 'deusjudo', 'direwolf', 'eii', 'ervin-lemark', 'fastadapted', 'foodforcomfort', 'fr3eze', 'fredkese', 'freebirdkhushboo', 'gabbynhice', 'gasaeightyfive', 'glastar', 'gocuriousmind', 'guanipa75', 'guurry123', 'haji', 'hesperiah', 'honoru', 'iamnotageek', 'imransoory', 'ionlysaygroot', 'ivan-perez-anies', 'joancabz', 'kingfunny', 'landscapes.photo', 'laqsking', 'libert', 'littymumma', 'liuke96player', 'lordbutterfly', 'mehta', 'mermaidvampire', 'milaan', 'mister-meeseeks', 'mk992039', 'moneyminded', 'montgomeryburns', 'natha93', 'nico-dounavis', 'oivas', 'olusolaemmanuel', 'onefatindian', 'onlysayexcellent', 'otom', 'regenin', 'rezoanulvibes', 'riseofth', 'rjoshicool', 'ronel', 'sciack', 'sheikhsayem', 'shitsignals', 'shivohum2015', 'skylinebuds', 'steemcollator', 'sthitaprajna', 'stupid', 'summisimeon', 'sunit', 'sweetkathy', 'travoved', 'vedicsamurai', 'veganomics', 'xyzashu', 'zeeshanrafique']
hashValue : 394e024e81bae0c2a3e0c001f6d2ba6e9025c328b81c36b0628e75ff8fbbbbc4
Total Resteem : 93
First Prize Winner : akshaykumar12257
Second Prize Winner : beggars
Third Prize Winner : gocuriousmind
Unix time : 1552837625
UTC Date : 2019-03-17 23:47:39.619763+08:00
Congratulations to the winners, namely
- @akshaykumar12257, 50 STEEM
- @beggars, 30 STEEM
- @gocuriousmind, 20 STEEM
The prizes will be sent out shortly, we appreciate the support very much.
Thank you so much @epicdice for arranging resteem contest.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thanks for the support.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Amazing. I usually do not win competitions, first the Aggroed contest and now this. Thanks for continuing my lucky winning streak and running the contest @epicdice I love you.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Let's hope this won't be your last win, thanks for the love!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Good Start. Now This is how a gambling game becomes trustable.....be transparent, be fair, think your token distribution through before you release it and then don’t EVER change it no matter what. The house will STILL win a pile of money! Steemians will slowly gravitate to your game if your never about that two faced trickery. Oh yea....
And don’t pre mine a zillion coins for yourself....a reasonable amount of the total % is not only understandable, it’s WELL DESERVED but it gives players a bad taste when you go to far. Keep your token rare and sought after....you will kill it. Good luck, I’ll be watching.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Fairness is the first thing we go after starting this gambling business here on top of blockchain. We believe profitability will always follow when the fundamental stuff is executed flawlessly.
In fact, we are working on releasing the token via a smart contract system (Steem Engine), so the everything is immutable and works the way it should since day 1 of implementation. Plus, the token would be outright tradable, transferable, while the whole token system is auditable at all time.
Thanks for the support @broncnutz, stay tuned for more.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @epicdice! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
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
Do not miss the last post from @steemitboard:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit