• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 13:53
CET 19:53
KST 03:53
  • 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
Behind the Blue - Team Liquid History Book15Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8herO wins SC2 All-Star Invitational14
Community News
ACS replaced by "ASL Season Open" - Starts 21/0215LiuLi Cup: 2025 Grand Finals (Feb 10-16)20Weekly Cups (Feb 2-8): Classic, Solar, MaxPax win2Nexon's StarCraft game could be FPS, led by UMS maker9PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar)12
StarCraft 2
General
How do you think the 5.0.15 balance patch (Oct 2025) for StarCraft II has affected the game? Nexon's StarCraft game could be FPS, led by UMS maker Terran Scanner Sweep Behind the Blue - Team Liquid History Book Weekly Cups (Jan 12-18): herO, MaxPax, Solar win
Tourneys
LiuLi Cup: 2025 Grand Finals (Feb 10-16) RSL Revival: Season 4 Korea Qualifier (Feb 14) PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) Sparkling Tuna Cup - Weekly Open Tournament RSL Season 4 announced for March-April
Strategy
Custom Maps
Map Editor closed ? [A] Starcraft Sound Mod
External Content
The PondCast: SC2 News & Results Mutation # 512 Overclocked Mutation # 511 Temple of Rebirth Mutation # 510 Safety Violation
Brood War
General
ACS replaced by "ASL Season Open" - Starts 21/02 Gypsy to Korea Liquipedia.net NEEDS editors for Brood War Recent recommended BW games [ASL21] Potential Map Candidates
Tourneys
Escore Tournament StarCraft Season 1 [Megathread] Daily Proleagues Small VOD Thread 2.0 KCM Race Survival 2026 Season 1
Strategy
Fighting Spirit mining rates Zealot bombing is no longer popular? Simple Questions, Simple Answers Current Meta
Other Games
General Games
Path of Exile Diablo 2 thread Nintendo Switch Thread Battle Aces/David Kim RTS Megathread ZeroSpace Megathread
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 Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Ask and answer stupid questions here! European Politico-economics QA Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread
Fan Clubs
The herO Fan Club! The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
TL Community
The Automated Ban List
Blogs
ADHD And Gaming Addiction…
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1899 users

Provably Fair Twitter Giveaways

Blogs > R1CH
Post a Reply
1 2 Next All
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 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
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.
1 2 Next All
Please log in or register to reply.
Live Events Refresh
Big Brain Bouts
17:00
#106
Serral vs JumyLIVE!
RotterdaM1063
IndyStarCraft 306
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Grubby 3058
RotterdaM 1063
IndyStarCraft 306
ProTech126
UpATreeSC 97
BRAT_OK 84
JuggernautJason53
EmSc Tv 11
StarCraft: Brood War
Calm 2445
Jaedong 530
Mini 452
Hyuk 239
firebathero 231
ajuk12(nOOB) 36
JulyZerg 15
Dota 2
Gorgc7166
singsing2592
qojqva1961
420jenkins142
League of Legends
C9.Mang095
Counter-Strike
fl0m1640
Super Smash Bros
Mew2King67
Heroes of the Storm
Liquid`Hasu352
Khaldor178
Other Games
gofns22336
Beastyqt714
FrodaN621
crisheroes354
ArmadaUGS195
KnowMe114
mouzStarbuck108
Trikslyr93
MindelVK6
Organizations
Other Games
BasetradeTV20
StarCraft 2
EmSc Tv 11
EmSc2Tv 11
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• Kozan
• sooper7s
• Migwel
• AfreecaTV YouTube
• LaughNgamezSOOP
• intothetv
• IndyKCrew
StarCraft: Brood War
• FirePhoenix18
• Michael_bg 15
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV238
• lizZardDota249
League of Legends
• Nemesis5112
• imaqtpie1483
• TFBlade1407
• Shiphtur419
Upcoming Events
RSL Revival
8h 7m
RSL Revival
13h 7m
LiuLi Cup
16h 7m
uThermal 2v2 Circuit
17h 7m
RSL Revival
23h 7m
Replay Cast
1d 5h
Sparkling Tuna Cup
1d 15h
LiuLi Cup
1d 16h
Replay Cast
2 days
Replay Cast
2 days
[ Show More ]
LiuLi Cup
2 days
Wardi Open
2 days
Monday Night Weeklies
2 days
OSC
3 days
WardiTV Winter Champion…
3 days
Replay Cast
4 days
WardiTV Winter Champion…
4 days
Replay Cast
5 days
The PondCast
5 days
KCM Race Survival
5 days
WardiTV Winter Champion…
5 days
Replay Cast
6 days
Epic.LAN
6 days
Liquipedia Results

Completed

Proleague 2026-02-10
Rongyi Cup S3
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
Escore Tournament S1: W8
LiuLi Cup: 2025 Grand Finals
Nations Cup 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025

Upcoming

[S:21] ASL SEASON OPEN 1st Round
[S:21] ASL SEASON OPEN 1st Round Qualifier
[S:21] ASL SEASON OPEN 2nd Round
[S:21] ASL SEASON OPEN 2nd Round Qualifier
Acropolis #4
IPSL Spring 2026
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
RSL Revival: Season 4
WardiTV Winter 2026
CCT Season 3 Global Finals
FISSURE Playground #3
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 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.