• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 11:47
CET 17:47
KST 01:47
  • 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
Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11Team TLMC #5: Winners Announced!3
Community News
$5,000+ WardiTV 2025 Championship4[BSL21] RO32 Group Stage3Weekly Cups (Oct 26-Nov 2): Liquid, Clem, Solar win; LAN in Philly2Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win82025 RSL Offline Finals Dates + Ticket Sales!10
StarCraft 2
General
RotterdaM "Serral is the GOAT, and it's not close" Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win TL.net Map Contest #21: Voting RSL S3 Round of 16 [TLCH] Mission 7: Last Stand
Tourneys
$5,000+ WardiTV 2025 Championship Sea Duckling Open (Global, Bronze-Diamond) $3,500 WardiTV Korean Royale S4 WardiTV Mondays Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection Mutation # 495 Rest In Peace
Brood War
General
SnOw's ASL S20 Finals Review [BSL21] RO32 Group Stage BGH Auto Balance -> http://bghmmr.eu/ Practice Partners (Official) [ASL20] Ask the mapmakers — Drop your questions
Tourneys
BSL21 Open Qualifiers Week & CONFIRM PARTICIPATION [ASL20] Grand Finals Small VOD Thread 2.0 The Casual Games of the Week Thread
Strategy
Current Meta How to stay on top of macro? PvZ map balance Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Dawn of War IV Nintendo Switch Thread Stormgate/Frost Giant Megathread ZeroSpace Megathread 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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Dating: How's your luck? Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Why we need SC3
Hildegard
Career Paths and Skills for …
TrAiDoS
Reality "theory" prov…
perfectspheres
Our Last Hope in th…
KrillinFromwales
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1782 users

Provably Fair Twitter Giveaways

Blogs > R1CH
Post a Reply
1 2 Next All
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
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
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
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
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
Next event in 1h 13m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SpeCial 314
ForJumy 36
BRAT_OK 15
MindelVK 2
StarCraft: Brood War
Zeus 1332
Shuttle 694
Hyuk 293
Soulkey 88
Rock 38
Aegong 33
Free 13
Shine 13
Dota 2
qojqva4360
Dendi1173
420jenkins343
BananaSlamJamma257
Counter-Strike
oskar102
Other Games
singsing2054
FrodaN1000
DeMusliM416
ceh9399
Mlord362
Fuzer 269
crisheroes190
Hui .181
Liquid`VortiX162
XcaliburYe140
ArmadaUGS133
KnowMe86
QueenE52
Trikslyr33
nookyyy 27
Organizations
Counter-Strike
PGL291
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Adnapsc2 9
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV458
League of Legends
• Jankos2722
• TFBlade619
Other Games
• Shiphtur265
Upcoming Events
LAN Event
1h 13m
OSC
6h 13m
The PondCast
17h 13m
LAN Event
22h 13m
Replay Cast
1d 6h
OSC
1d 19h
LAN Event
1d 22h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
WardiTV Korean Royale
2 days
[ Show More ]
LAN Event
2 days
IPSL
3 days
dxtr13 vs OldBoy
Napoleon vs Doodle
Replay Cast
3 days
Sparkling Tuna Cup
3 days
WardiTV Korean Royale
3 days
LAN Event
3 days
IPSL
4 days
JDConan vs WIZARD
WolFix vs Cross
Replay Cast
4 days
Wardi Open
4 days
WardiTV Korean Royale
5 days
Replay Cast
6 days
Kung Fu Cup
6 days
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Liquipedia Results

Completed

BSL 21 Points
SC4ALL: StarCraft II
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025

Upcoming

BSL Season 21
SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
Stellar Fest
META Madness #9
LHT Stage 1
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
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.