• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 10:42
CET 16:42
KST 00:42
  • 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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies3ComeBackTV's documentary on Byun's Career !10Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win4Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2
StarCraft 2
General
What's the best tug of war? The Grack before Christmas Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies ComeBackTV's documentary on Byun's Career ! Micro Lags When Playing SC2?
Tourneys
OSC Season 13 World Championship $5,000+ WardiTV 2025 Championship $100 Prize Pool - Winter Warp Gate Masters Showdow Sparkling Tuna Cup - Weekly Open Tournament Winter Warp Gate Amateur Showdown #1
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 505 Rise From Ashes Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Recommended FPV games (post-KeSPA) BW General Discussion FlaSh on: Biggest Problem With SnOw's Playstyle soO on: FanTaSy's Potential Return to StarCraft
Tourneys
Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] LB QuarterFinals - Sunday 21:00 CET [BSL21] WB SEMIFINALS - Saturday 21:00 CET
Strategy
Simple Questions, Simple Answers Game Theory for Starcraft Current Meta Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Beyond All Reason Path of Exile General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
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 Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread How Does UI/UX Design Influence User Trust? Things Aren’t Peaceful in Palestine
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced Where to ask questions and add stream?
Blogs
National Diversity: A Challe…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2328 users

Provably Fair Twitter Giveaways

Blogs > R1CH
Post a Reply
Normal
R1CH
Profile Blog Joined May 2007
Netherlands10341 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 Elder29903 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
Netherlands10341 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
Netherlands10341 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
Netherlands10341 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
Netherlands10341 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
Next event in 1h 18m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SKillous 150
Livibee 138
mouzStarbuck 63
BRAT_OK 61
StarCraft: Brood War
Rain 4658
Sea 4600
Shuttle 735
EffOrt 695
ggaemo 379
Mini 203
firebathero 203
Snow 181
Barracks 125
Sharp 118
[ Show more ]
hero 95
Hyun 93
Sea.KH 77
JYJ 74
Terrorterran 36
Sexy 26
zelot 26
scan(afreeca) 15
JulyZerg 13
yabsab 13
SilentControl 12
Shine 11
Bale 9
HiyA 5
Dota 2
qojqva5050
XcaliburYe793
Fuzer 216
League of Legends
Reynor85
Counter-Strike
zeus1223
edward233
Heroes of the Storm
Khaldor204
Other Games
singsing2154
B2W.Neo655
Mlord392
crisheroes360
XaKoH 124
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Light_VIP 57
• HeavenSC 35
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Michael_bg 10
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2126
Upcoming Events
Big Brain Bouts
1h 18m
Elazer vs Nicoract
Reynor vs Scarlett
Replay Cast
9h 18m
Sparkling Tuna Cup
1d 18h
Krystianer vs TBD
TriGGeR vs SKillous
Percival vs TBD
ByuN vs Nicoract
OSC
2 days
Replay Cast
2 days
Wardi Open
2 days
OSC
3 days
Solar vs MaxPax
ByuN vs Krystianer
Spirit vs TBD
OSC
6 days
Liquipedia Results

Completed

KCM Race Survival 2025 Season 4
WardiTV 2025
META Madness #9

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL Season 21
Slon Tour Season 2
CSL Season 19: Qualifier 2
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025

Upcoming

CSL 2025 WINTER (S19)
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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 © 2025 TLnet. All Rights Reserved.