Skip to content

Instantly share code, notes, and snippets.

@skwp
Created January 29, 2019 02:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skwp/308b900ce576b9616d5295130e14dd77 to your computer and use it in GitHub Desktop.
Save skwp/308b900ce576b9616d5295130e14dd77 to your computer and use it in GitHub Desktop.
Bitcoin Hash Based Contest
# Takes a list of people and a set of block hashes and picks people from the list based on their
# position when the block hash is taken modulo the number of participants.
# This assumes there won't be two of the same answer. If there are, the code can be modified to pick the next person in the list, or something like that
contest_participants = %w(
@MSPcrypto
@vinod5473
@Crypto_celt
@HoldingsMidwest
@belair6909
@dannytaniwan
@MaximumSatoshis
@DaveFrantz3
@bipolarbearhugs
@freddyco
@DisruptionJoe
@MSPcrypto
@vinod5473
@Crypto_celt
@HoldingsMidwest
@belair6909
@dannytaniwan
@MaximumSatoshis
@DaveFrantz3
@bipolarbearhugs
@freddyco
@DisruptionJoe
@StarfuryFlames
@sambirkhead
@MSPcrypto
@theta_bsd
@rob_ferg94
@tomasj007
@Crypto38016603
@antifragi7
@vinod5473
@MarconiMoscoso
@Crypto_celt
@btckev
@Joonasfiksaa
@craig_simons
@placeh0dler
@repoocsov
@dannytaniwan
@MaximumSatoshis
@DaveFrantz3
@oneconfirmation
@bipolarbearhugs
@freddyco
@global_chain
@josiebellini
@misir_mahmudov
)
puts "#{contest_participants.size} participants"
# These are the first 5 blocks after 00:00 UTC Jan 28
block_hashes = %w(
000000000000000000198be46e95472673b3f6ef815be58d4537ca9302b6799d
0000000000000000001a5a85256277672f60e32a21f27294c25ee6fd02dd4148
0000000000000000001fd81a293babbc0cfe828bedf0ab31f0de03fd3cff0209
00000000000000000003f2609ee76df0d94ef387544127aaa66f15a227f374ca
0000000000000000002bc6c5d218da7023cea1b57b48dab3d0ce730f07123bbe
)
block_hashes.each do |hash|
winner = hash.to_i(16) % contest_participants.size
puts contest_participants[winner]
end
@skwp
Copy link
Author

skwp commented Jan 29, 2019

The first 12 entries in the list were retweets so they got into the list twice because I was awarding 2 entries per retweet. Following that is the list of 33 likes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment