Winners Announcement for Resteem Contest
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?
Let's select a winner who shared this post. We aim to write a program that is as provably-fair as possible, just like our 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 = 'epic-token-plan-revealed-or-bonus-mining-rate-for-early-birds'
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 : ['abrockman', 'ankarlie', 'atnazo', 'azadku', 'balte', 'barbadosso', 'bdupme', 'beat-the-bookies', 'beautifulday3', 'betterthanhome', 'bitandi', 'bittriex', 'bobby.madagascar', 'cadawg', 'camaund', 'ccnew', 'cflclosers', 'cgbartow', 'chadrona', 'chuuuckie', 'cloudblade', 'crypticat', 'cryptoknight12', 'cutnur', 'cwow2', 'daniel3050', 'deanliu', 'desh2', 'djlethalskillz', 'ekramhossain1616', 'elevator09', 'fantasycrypto', 'farhananipa', 'fr3eze', 'fredkese', 'futbolsport', 'glastar', 'gocuriousmind', 'guurry123', 'hitmeasap', 'ipkiss', 'johhnnyturbo20', 'lavanyalakshman', 'liuke96player', 'malay11', 'maquemali', 'mcoinz79', 'meetmysuperego', 'mehta', 'mermaidvampire', 'mihirbarot', 'mk992039', 'mohammadfaisal', 'moneyminded', 'mrnightmare89', 'nomadlifestyle', 'oguzhangazi', 'pml2020', 'positivebalances', 'purpleheart1', 'rahul.stan', 'ravisarikonda', 'rezoanulvibes', 'riseofth', 'robi', 'saleg25', 'sames', 'sisygoboom', 'steemcollator', 'steemitromney', 'stupid', 'suddenly12', 'summisimeon', 'sunit', 'supermeatboy', 'sureshnsnet', 'syedumair', 'theb0red1', 'thomasgutierrez', 'ugos', 'veganomics', 'vibesforlife', 'videosteemit', 'xyzashu']
hashValue : 32ef6da72783ea871d74e6e24caddf499b0d09e443dbc8101594f3cc93c61404
Total Resteem : 84
First Prize Winner : mohammadfaisal
Unix time : 1556209780
UTC Date : 2019-04-26 00:30:19.418597+08:00
Congratulations to 50 STEEM winner @mohammadfaisal, we appreciate the support from all players very much.
!bookkeeping epicdice
Please use one of the following keywords after !bookkeeping:
I will try this game ,and resteem done4 ,so amazing game ,i really love this game.
Congratulations!
To listen to the audio version of this article click on the play image.
Brought to you by @tts. If you find it useful please consider upvoting this reply.
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
Vote for @Steemitboard as a witness to get one more award and increased upvotes!