• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 16:32
CEST 22:32
KST 05:32
  • 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
[ASL20] Ro24 Preview Pt1: Runway122v2 & SC: Evo Complete: Weekend Double Feature3Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18Serral wins EWC 202549
Community News
Maestros of The Game—$20k event w/ live finals in Paris2Weekly Cups (Aug 11-17): MaxPax triples again!10Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195Weekly Cups (Jul 28-Aug 3): herO doubles up6
StarCraft 2
General
RSL Revival patreon money discussion thread I made a 5.0.12/5.0.13 replay fix Geoff 'iNcontroL' Robinson has passed away #1: Maru - Greatest Players of All Time Is it ok to advertise SC EVO Mod streaming here?
Tourneys
Maestros of The Game—$20k event w/ live finals in Paris Master Swan Open (Global Bronze-Master 2) $5,100+ SEL Season 2 Championship (SC: Evo) Sparkling Tuna Cup - Weekly Open Tournament RSL: Revival, a new crowdfunded tournament series
Strategy
Custom Maps
External Content
Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below Mutation # 484 Magnetic Pull
Brood War
General
Flash Announces (and Retracts) Hiatus From ASL New season has just come in ladder BW General Discussion [ASL20] Ro24 Preview Pt1: Runway ASL 20 HYPE VIDEO!
Tourneys
[ASL20] Ro24 Group C Cosmonarchy Pro Showmatches [ASL20] Ro24 Group B [Megathread] Daily Proleagues
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
General RTS Discussion Thread Stormgate/Frost Giant Megathread Beyond All Reason Nintendo Switch Thread Total Annihilation Server - TAForever
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread The Games Industry And ATVI
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
The Biochemical Cost of Gami…
TrAiDoS
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1863 users

Provably Fair Twitter Giveaways

Blogs > R1CH
Post a Reply
Normal
R1CH
Profile Blog Joined May 2007
Netherlands10340 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
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
Netherlands10340 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
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
Netherlands10340 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
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
Netherlands10340 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
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
Netherlands10340 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
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 3h 28m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
UpATreeSC 155
Nathanias 85
ProTech59
StarCraft: Brood War
Britney 17221
ggaemo 76
NaDa 38
Aegong 37
Dota 2
LuMiX1
Counter-Strike
olofmeister2027
pashabiceps503
Stewie2K278
Super Smash Bros
hungrybox337
Heroes of the Storm
Liquid`Hasu462
Other Games
tarik_tv4035
Grubby2278
FrodaN1213
qojqva1209
ZombieGrub71
markeloff55
Trikslyr46
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 22 non-featured ]
StarCraft 2
• davetesta45
• LUISG 23
• Dystopia_ 3
• musti20045 3
• OhrlRock 1
• Kozan
• Migwel
• sooper7s
• AfreecaTV YouTube
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• Pr0nogo 35
• 80smullet 20
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21247
League of Legends
• TFBlade882
Counter-Strike
• Shiphtur182
Other Games
• imaqtpie1068
• WagamamaTV252
Upcoming Events
Online Event
3h 28m
The PondCast
13h 28m
WardiTV Summer Champion…
14h 28m
Zoun vs Bunny
herO vs Solar
Replay Cast
1d 3h
LiuLi Cup
1d 14h
BSL Team Wars
1d 22h
Team Hawk vs Team Dewalt
Korean StarCraft League
2 days
CranKy Ducklings
2 days
SC Evo League
2 days
WardiTV Summer Champion…
2 days
Classic vs Percival
Spirit vs NightMare
[ Show More ]
CSO Cup
2 days
[BSL 2025] Weekly
2 days
Sparkling Tuna Cup
3 days
SC Evo League
3 days
BSL Team Wars
3 days
Team Bonyth vs Team Sziky
Afreeca Starleague
4 days
Queen vs HyuN
EffOrt vs Calm
Wardi Open
4 days
Replay Cast
5 days
Afreeca Starleague
5 days
Rush vs TBD
Jaedong vs Mong
Afreeca Starleague
6 days
herO vs TBD
Royal vs Barracks
Liquipedia Results

Completed

Jiahua Invitational
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 1
SEL Season 2 Championship
WardiTV Summer 2025
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSLAN 3
CSL Season 18: Qualifier 2
CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall 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.