• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:52
CEST 15:52
KST 22:52
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro24 Preview Pt2: News Flash8[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy13ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book20
Community News
Weekly Cups (March 23-29): herO takes triple6Aligulac acquired by REPLAYMAN.com/Stego Research6Weekly Cups (March 16-22): herO doubles, Cure surprises3Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool49Weekly Cups (March 9-15): herO, Clem, ByuN win4
StarCraft 2
General
Weekly Cups (March 23-29): herO takes triple Aligulac acquired by REPLAYMAN.com/Stego Research Team Liquid Map Contest #22 - Presented by Monster Energy What mix of new & old maps do you want in the next ladder pool? (SC2) herO wins SC2 All-Star Invitational
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament RSL Season 4 announced for March-April StarCraft Evolution League (SC Evo Biweekly) WardiTV Mondays World University TeamLeague (500$+) | Signups Open
Strategy
Custom Maps
[M] (2) Frigid Storage Publishing has been re-enabled! [Feb 24th 2026]
External Content
Mutation # 519 Inner Power The PondCast: SC2 News & Results Mutation # 518 Radiation Zone Mutation # 517 Distant Threat
Brood War
General
BW General Discussion Pros React To: SoulKey vs Ample Build Order Practice Maps [ASL21] Ro24 Preview Pt2: News Flash BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL21] Ro24 Group F [ASL21] Ro24 Group E 🌍 Weekly Foreign Showmatches [ASL21] Ro24 Group B
Strategy
Fighting Spirit mining rates What's the deal with APM & what's its true value Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game Nintendo Switch Thread General RTS Discussion Thread Darkest Dungeon
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine The Games Industry And ATVI European Politico-economics QA Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread General nutrition recommendations
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Funny Nicknames
LUCKY_NOOB
Money Laundering In Video Ga…
TrAiDoS
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1817 users

Provably Fair Twitter Giveaways

Blogs > R1CH
Post a Reply
Normal
R1CH
Profile Blog Joined May 2007
Netherlands10342 Posts
Last Edited: 2017-03-04 18:16:14
March 19 2016 15:21 GMT
#1

In light of Team Liquid's CS:GO giveaway, I wanted to devise a way to ensure a fair drawing. This blog post explains the method I've come up with which is based on the drawing method of reddit's "Millionaire Makers" giveaway. Please let me know if there's any improvements to be made or if I missed something!

Data Recording:
Using the Twitter API, you can only get the latest 100 retweets. I wrote a script that polls the API every 30 seconds, fetching the latest 100 retweets and recording the date and user id.

Drawing Method:
The bitcoin network will be used as a source of randomness and timestamping. The merkle root of the first bitcoin block mined after the contest closes will be used as a source of randomness. The block timestamp must have a timestamp after the contest closing date to be considered valid.

A string will be created consisting of the numerical user_id of every entrant (including duplicates where multiple entries are allowed). The user_ids will be placed in ascending order and separated by a single space with no newlines. The SHA256 hash of this string will form the entrants hash, and can be used by an entrant to verify they were included in the drawing. The merkle root (m) and entrants hash (e) will be hashed together using SHA256 to create the drawing hash, in the format SHA256(m||e).

The first 8 bytes of the drawing hash will be converted to a little endian unsigned 64 bit integer. This integer modulus the number of entries will be calculated to come up with the winning entry number. The entry number is an index into a list of entrants sorted first by ascending entry date, then by ascending user id.

The winning account will be checked manually to ensure it is following the giveaway account and otherwise complies with contest rules. If the winning entry is deemed ineligible, the drawing hash is passed through another iteration of SHA256 and the process repeated until a valid winner is found.

Prior to releasing the winner, wait until the next bitcoin block is mined to ensure the block used in the drawing is not orphaned and thus is available publicly for provable fairness.

Fairness
A hash of the drawing method as described here can be embedded into the bitcoin blockchain, acting as a secure timestamp to ensure the method does not change. As the transactions and nonce used to find a block in the bitcoin blockchain are unpredictable, it is impossible to know the winner beforehand until the block is mined.

Issues
Since it is difficult to obtain a full list of retweets from Twitter, it is hard for a 3rd party to verify the index picked matches the list of entrants. This can be mitigated by releasing a full list of entrants after the drawing, allowing each entrant to check their presence in the giveaway. By mixing a hash of the entrants list into the drawing hash, this ensures that the list of entrants released matches those that were used for the drawing.

As only the latest 100 retweets are available from the API, it is possible that some retweets may be missed during high activity periods such as when the tweet is first published. This can be improved by using a high polling rate (every few seconds) for the first few minutes after the tweet is published.


****
AdministratorTwitter: @R1CH_TL
TL+ Member
endy
Profile Blog Joined May 2009
Switzerland8970 Posts
March 19 2016 15:49 GMT
#2
awesome read, you must have had so much fun designing this drawing method
ॐ
Saechiis
Profile Blog Joined May 2010
Netherlands4989 Posts
Last Edited: 2016-03-19 16:44:03
March 19 2016 16:40 GMT
#3
Default language on these forums is English

+ Show Spoiler +
But seriously, yer a wizard Rich!
I think esports is pretty nice.
Thaniri
Profile Blog Joined March 2011
1264 Posts
March 19 2016 19:26 GMT
#4
What is the reason you're using such a complicated way to generate a random number? Acting as a secure timestamp to ensure the method does not change... Why would this matter?

Math.Random(); instead?

In any case, it's fantastic that you've put some thought in to how to check who is actually a new follower. Every 30s is more often that necessary probably.
RoomOfMush
Profile Joined March 2015
1296 Posts
March 19 2016 21:31 GMT
#5
On March 20 2016 04:26 Thaniri wrote:
What is the reason you're using such a complicated way to generate a random number? Acting as a secure timestamp to ensure the method does not change... Why would this matter?

Math.Random(); instead?

In any case, it's fantastic that you've put some thought in to how to check who is actually a new follower. Every 30s is more often that necessary probably.

He wants to make it transparent so that everybody can check if the result was truly random and not secretly handpicked. It still seems unnecessarily complicated though. There is probably a better solution. But sometimes the solution isnt as important as the process of solving the problem.
mca64Launcher_
Profile Joined June 2015
Poland629 Posts
March 20 2016 12:45 GMT
#6
what is this?
Ragnarork
Profile Blog Joined June 2011
France9034 Posts
March 20 2016 13:56 GMT
#7
Using the Twitter API, you can only get the latest 100 retweets


Oh, interesting. I wonder how many of these giveways actually go to one of the last 100 accounts that RT'd,
LiquipediaWanderer
boxerfred
Profile Blog Joined December 2012
Germany8360 Posts
March 20 2016 20:21 GMT
#8
I'm a software developer and I'm sitting here, like "lol wut a nerd"
739
Profile Blog Joined May 2009
Bearded Elder29904 Posts
March 21 2016 07:49 GMT
#9
#justr1chthings
WriterSalty oldboy that loves memes | One and only back-to-back Liquibet Winner
FFW_Rude
Profile Blog Joined November 2010
France10201 Posts
March 21 2016 09:55 GMT
#10
I miss HOt_Bid. He would have come here saying stuff like : "Did you consider using the Huffman coding, compression algortyhm with your arithmetic SQL shmug" or something like that :p
#1 KT Rolster fanboy. KT BEST KT ! Hail to KT playoffs Zergs ! Unofficial french translator for SlayerS_`Boxer` biography "Crazy as me".
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
March 21 2016 12:18 GMT
#11
Why not just take the number of participants as the seed to a pseudo random function? It's reproducible since the same seed will result in the same generated number and the outcome changes with every new participant, so you don't know the result at the start, but everyone can validate the result at the end.

Or take the unix timestamps of the last 5 participants, add them up and use those as seed?
Or the unix timestamp of the last minus the one of the first?

Ah, well, as long as you have fun, keep it up
amazingxkcd
Profile Blog Joined September 2010
GRAND OLD AMERICA16375 Posts
Last Edited: 2016-03-21 13:59:13
March 21 2016 13:55 GMT
#12
Using the Twitter API, you can only get the latest 100 retweets. I wrote a script that polls the API every 30 seconds, fetching the latest 100 retweets and recording the date and user id.


I've done something similar with the Twitter API, wrote an app that creates and generates crowd sourced news based on your location and I'd have to say that there's a lot of forced limitations within the API that I dont really like :/ . It's no wonder the company is going under the tank as a result.

IMO, for the polling, it might be better to just poll all the retweets when you do the raffle itself; you already have the ability to get the history so you can get the oldest 100 RTs, then use that latest RT's
id
as your new
since_id
for your next poll as your starting index
The world is burning and you rather be on this terrible website discussing video games and your shallow feelings
Lucasmus
Profile Joined September 2015
35 Posts
March 21 2016 18:21 GMT
#13
A flaw in the system could be users making (lots of) fake accounts tot improve their winning chance.
R1CH
Profile Blog Joined May 2007
Netherlands10342 Posts
March 21 2016 18:46 GMT
#14
We could add a check for the winning account to make sure it has tweets and followers and wasn't registered after the contest started. Dummy accounts on Twitter are quite obvious .
AdministratorTwitter: @R1CH_TL
TL+ Member
ClysmiC
Profile Blog Joined December 2010
United States2192 Posts
March 22 2016 03:41 GMT
#15
Decrementing the index on failure to following the rules could be abused. I could submit 1 legitimate entry, then have some script immediately submit 50 illegitimate entries. All of the illegitimate entries would lead to my legit entry winning if you follow the decrement scheme. This abuse would be pretty easily detected though... just a thought.
R1CH
Profile Blog Joined May 2007
Netherlands10342 Posts
March 22 2016 13:03 GMT
#16
Good point. I suppose in the case of an invalid entry, a completely new random winner should be chosen instead.
AdministratorTwitter: @R1CH_TL
TL+ Member
Froadac
Profile Blog Joined July 2009
United States6733 Posts
March 23 2016 06:12 GMT
#17
What language did you write this in? Just curious.
R1CH
Profile Blog Joined May 2007
Netherlands10342 Posts
March 23 2016 11:44 GMT
#18
I've done some proof of concept stuff in perl. I'm debating making it into a web service for people to use in giveaways.
AdministratorTwitter: @R1CH_TL
TL+ Member
Souma
Profile Blog Joined May 2010
2nd Worst City in CA8938 Posts
March 27 2016 03:55 GMT
#19
On March 20 2016 22:56 Ragnarork wrote:
Show nested quote +
Using the Twitter API, you can only get the latest 100 retweets


Oh, interesting. I wonder how many of these giveways actually go to one of the last 100 accounts that RT'd,

From my experience, Tweetdraw, which a lot of people use for these simple "Follow and RT" giveaways, isn't limited to the last 100 RTs. The last giveaway I ran which had thousands of retweets, the winner was someone who RT'd on the first day (the giveaway lasted for almost a week).
Writer
writer22816
Profile Blog Joined September 2008
United States5775 Posts
March 27 2016 23:46 GMT
#20
On March 21 2016 18:55 FFW_Rude wrote:
I miss HOt_Bid. He would have come here saying stuff like : "Did you consider using the Huffman coding, compression algortyhm with your arithmetic SQL shmug" or something like that :p


Haha I know. Or something like "r1ch have u tried modding ur bitcoin miner with an asic and several 7950s"
8/4/12 never forget, never forgive.
R1CH
Profile Blog Joined May 2007
Netherlands10342 Posts
March 28 2016 18:29 GMT
#21
On March 27 2016 12:55 Souma wrote:
Show nested quote +
On March 20 2016 22:56 Ragnarork wrote:
Using the Twitter API, you can only get the latest 100 retweets


Oh, interesting. I wonder how many of these giveways actually go to one of the last 100 accounts that RT'd,

From my experience, Tweetdraw, which a lot of people use for these simple "Follow and RT" giveaways, isn't limited to the last 100 RTs. The last giveaway I ran which had thousands of retweets, the winner was someone who RT'd on the first day (the giveaway lasted for almost a week).


I think it works by getting a copy of your timeline instead. So as long as you don't go over 3k timeline entries since the competition tweet went out, this is another method of getting all RTs. If the account is popular though it could easily have more than 3k other timeline entries before the drawing.

https://dev.twitter.com/rest/reference/get/statuses/user_timeline
AdministratorTwitter: @R1CH_TL
TL+ Member
opisska
Profile Blog Joined February 2011
Poland8852 Posts
Last Edited: 2016-03-29 11:53:13
March 29 2016 11:53 GMT
#22
On March 22 2016 03:46 R1CH wrote:
We could add a check for the winning account to make sure it has tweets and followers and wasn't registered after the contest started. Dummy accounts on Twitter are quite obvious .


I have no tweets and no followers, because I use twitter only to read stuff. Does that make me ineligible for your giveaways? If that's the case, it should be clearly stated in the rules.

Even more importantly, If I didn't have a twitter account at all and just sign up because of the giveaway (which I actually did for some HSC stuff like a couple of months ago), why is that a problem?
"Jeez, that's far from ideal." - Serral, the king of mild trashtalk
TL+ Member
Normal
Please log in or register to reply.
Live Events Refresh
Kung Fu Cup
11:00
2026 Week 3
RotterdaM804
TKL 262
SteadfastSC178
IndyStarCraft 171
Rex133
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 804
TKL 262
SteadfastSC 178
IndyStarCraft 171
Rex 133
Hui .127
ProTech124
StarCraft: Brood War
Britney 63993
Calm 6620
Bisu 2814
Leta 1349
EffOrt 628
Stork 487
Soma 415
firebathero 322
Mini 317
ggaemo 252
[ Show more ]
actioN 229
Rush 177
PianO 176
Soulkey 173
Dewaltoss 140
Last 111
hero 96
Mind 88
Sharp 52
Hyun 51
Barracks 36
sorry 35
ToSsGirL 34
JYJ 27
Movie 26
Shine 22
Hm[arnc] 22
yabsab 17
scan(afreeca) 17
Noble 13
soO 12
GoRush 11
Sexy 10
Sacsri 8
Rock 8
Terrorterran 4
Dota 2
Lowko361
Counter-Strike
byalli622
zeus420
edward50
Other Games
singsing2144
olofmeister1316
hiko490
B2W.Neo434
crisheroes291
QueenE175
XaKoH 160
oskar42
DeMusliM17
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• StrangeGG 53
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 6
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV715
League of Legends
• Nemesis2917
• Jankos1969
• TFBlade854
Upcoming Events
Replay Cast
10h 8m
The PondCast
20h 8m
OSC
1d 10h
RSL Revival
1d 20h
TriGGeR vs Cure
ByuN vs Rogue
Replay Cast
2 days
RSL Revival
2 days
Maru vs MaxPax
BSL
3 days
RSL Revival
3 days
uThermal 2v2 Circuit
4 days
BSL
4 days
[ Show More ]
Replay Cast
5 days
Sparkling Tuna Cup
5 days
Liquipedia Results

Completed

CSL Season 20: Qualifier 1
WardiTV Winter 2026
NationLESS Cup

Ongoing

BSL Season 22
CSL Elite League 2026
ASL Season 21
CSL Season 20: Qualifier 2
RSL Revival: Season 4
Nations Cup 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

Escore Tournament S2: W1
CSL 2026 SPRING (S20)
Acropolis #4
IPSL Spring 2026
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
StarCraft2 Community Team League 2026 Spring
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.