Initial commit

parents
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# Distribution / packaging
.Python
env/
venv/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# pyenv python configuration file
.python-version
.vscode/
# Intellij
.idea
# OSX
.DS_Store
#nash_draw
.ipynb_checkpoints
secret_list.csv
emails_to_filter_out
## Nash Referral giveaway draft 26/DEC/2019
[Read here the terms and conditions](https://nash.io/pdfs/Nash_Referral_Giveaway_T&C.pdf)
### Winners were selected according to the following procedure:
1 - A SHA256 hash was generated from each participant’s email address.
2 - The email hashes of all participants was collected into a list.If a participant had N valid tickets for the giveaway draw, N copies of their email hash was included in the list.
3 - This list was then be sorted lexicographically.
4 - Each of the thirty-four prizes was be assigned a code (a “salt”). For each prize, the salt was combined with the hash of the first Bitcoin block to be mined after 18:00 UTC on 26 December 2019. The combination of prize salt and blockhash yields a large integer that is used to determine the winner.
5 - For each prize, this large integer is divided modulo T, where T is the total number of valid tickets for the draw. The resulting number gives a position in the sorted list of participants’ email hashes, which corresponds to the winner of the prize.
### BTC block hash at 2019-12-26 18:03:40
`0000000000000000000f578c397736149098edce9b374eff6d90b6bc9634c05b`
### Prizes salts
| Prize | Salt |
| ------------------------------ | --------------- |
| \$35,000 in BTC + 15,000 NEX | #15_000NEX |
| \$20,000 in BTC + 10,000 NEX | #10_000NEX |
| \$10,000 in BTC + 5,000 NEX | #5_000NEX |
| \$5,000 in BTC + 1,000 NEX | #1_000NEX |
| 30 x (\$1,000 in BTC + 500NEX) | #500NEX\_n{1-30} |
### Winners:
| - | sha256 of email |
| ------------------- | ---------------------------------------------------------------- |
| Winner for prize 1 | 719524088f3475b76f8e5672c4f7ea31c55ff5b4d9545c4a432b3208a0532bdc |
| Winner for prize 2 | 17a868f21e30f7ad73695ea376e6042c851c622d77689252f7006299df69fe3e |
| Winner for prize 3 | ac52622eac82aecef1ed93a39a974596fa83130e0c578d615037489b978ef398 |
| Winner for prize 4 | 78f5c160aa1c672a8b146d354786111978318beebd90e2ed916edf20c098169d |
| Winner for prize 5 | d81f6eef2178512bcaef8464d0931c0da60696cfdb210237afe1c68403f7cc38 |
| Winner for prize 6 | 2f6e8549032db49bb64d5db037619515d4a97871c6425d4f88591990115062af |
| Winner for prize 7 | a8c82450b90521504f698b30d32b009ef0a8fe62cb69106fa9916e618baface8 |
| Winner for prize 8 | 382b1d552d4163e4ec28a1f9a20cd4d7bf838188ee4bbf26743192fd07ca152c |
| Winner for prize 9 | 1aae624672af5dd128fd89d7f52973a0e1e99554482be986872d91d77bfba17e |
| Winner for prize 10 | 35498091ef88bef9b2cb22810816efaced534d8f92d31c9452eeb023c8381984 |
| Winner for prize 11 | 623d8ff8dfb10e00272305134de7e612839a3e6a0df8bbdd163f9423a8be1e52 |
| Winner for prize 12 | 729814c04aec342bc3124fa98ce23320454ac728b1294abc1e59f664893aa238 |
| Winner for prize 13 | e44a484fdca242ce3d2e816644e3575ec3be8f46fece7043a6924a07adb3396e |
| Winner for prize 14 | eadc57eea46afe12e7192fea3311bf657572293687f2460f4fff11b0ea8ca726 |
| Winner for prize 15 | 84d47f457254a855eab7633fc0775220ca0eb6cf2bd5c37c845d9a49ca16a33e |
| Winner for prize 16 | d76d97c2c3c90198865436dc499ea0e5964ed873894c56be5dc37e904e1c7a22 |
| Winner for prize 17 | ad22013370081c30e96e4809955298dd62c379e97b9564b0d13274763dde5694 |
| Winner for prize 18 | b86744f1e2391fdb21d79ec497ffd61ccc97ee4767347fad7506b2722e953499 |
| Winner for prize 19 | ecb87982d2b8fc3ba247159f1097c2fe0fad911cd5e7226971c3060e2386b024 |
| Winner for prize 20 | b0c91c71d150d366433216bff8f3b84c381762aa32392ed0ecf4f3d07e4e3174 |
| Winner for prize 21 | 14f6b9ad38ea4932e83875f558890e18252a8c8a01b0b6242a4ef0cd6481390d |
| Winner for prize 22 | f87137ff5e7b637f3d0bef90fe013a5e423b46ce04962efe9c7470614becbbe5 |
| Winner for prize 23 | 6e6cf6b6f2219fcd17637127568a54c4cb4589291a45da0b9fb3e0ef99839c65 |
| Winner for prize 24 | 985871505f22e64a4f57813985178f8ababd69a4ec7cf230692dd230cce0c360 |
| Winner for prize 25 | cb961b198092be213ad5c7331210f4b27a3757bbdf8bbe9352d0c5ae799dcbe8 |
| Winner for prize 26 | e9fe469c5eea1d4cea1d5ef749b844d8f446293104ceeddadc0d58bc38f0ea60 |
| Winner for prize 27 | c1079434984e03a1046740ca157460373175803a2b4890e4e8f70e968c2432b9 |
| Winner for prize 28 | 2bceec3d65514b0a8a6e4071fd6c72e48e9777f823657de65f1036a5a555b7a4 |
| Winner for prize 29 | c0e2874abb1ab70206905bac482cdb5e1edc331a11286437d5ab7ef37622bc26 |
| Winner for prize 30 | 26506bd51c03980feb16052ed4bb095e2f278046a918eacb7b121b0c893192cf |
| Winner for prize 31 | edf8c6bdac47217ab149b4b0ff0c4a7b6b3c95508cc5f8f71bb7d33dcf1df1cc |
| Winner for prize 32 | 92990f87346b04bf440c5fe76c3f43e22a5882249e9ce967f4c1d2c33262d5b6 |
| Winner for prize 33 | 9d2bdccbbf0d03d8c201d73ef23c9e6fde1dee1e9daf5cf7476c508cd7cd167f |
| Winner for prize 34 | bade380a7477f38137bee8bbc929c194a878fd1a2a61b4c70075018aac655d02 |
\ No newline at end of file
#!/usr/bin/env python3
"""
Script used to issue the winners for Nash 1st referral giveaway
"""
import hashlib
SALT_MAP = {
1: '#15_000NEX',
2: '#10_000NEX',
3: '#5_000NEX',
4: '#1_000NEX',
5: '#500NEX_n1',
6: '#500NEX_n2',
7: '#500NEX_n3',
8: '#500NEX_n4',
9: '#500NEX_n5',
10: '#500NEX_n6',
11: '#500NEX_n7',
12: '#500NEX_n8',
13: '#500NEX_n9',
14: '#500NEX_n10',
15: '#500NEX_n11',
16: '#500NEX_n12',
17: '#500NEX_n13',
18: '#500NEX_n14',
19: '#500NEX_n15',
20: '#500NEX_n16',
21: '#500NEX_n17',
22: '#500NEX_n18',
23: '#500NEX_n19',
24: '#500NEX_n20',
25: '#500NEX_n21',
26: '#500NEX_n22',
27: '#500NEX_n23',
28: '#500NEX_n24',
29: '#500NEX_n25',
30: '#500NEX_n26',
31: '#500NEX_n27',
32: '#500NEX_n28',
33: '#500NEX_n29',
34: '#500NEX_n30'
}
BTCHASH = '0000000000000000000f578c397736149098edce9b374eff6d90b6bc9634c05b'
participants = open('participants_nash', 'r').read().splitlines()
total_tickets = len(participants)
winners = []
for prize in SALT_MAP:
prize_hash = hashlib.sha256((BTCHASH + SALT_MAP[prize]).encode('utf-8')).hexdigest()
choosen_number = int(prize_hash, 16) % total_tickets
winner = participants[choosen_number]
winners.append(winner)
print("| Winner for prize {} | {} |".format(prize, winner))
# This function will not run in computers without the secret_list.csv file
# only used internaly to print the winning emails
try:
users = open('secret_list.csv', 'r').read().splitlines()
for prize, winner in enumerate(winners):
for user in users:
_, email, _ = user.split(',', maxsplit=2)
if hashlib.sha256(email.encode('utf-8')).hexdigest() == winner:
print("Winner for prize {}: {}, {}".format(prize + 1, email , winner))
except:
pass
\ No newline at end of file
#!/usr/bin/env python3
"""
Script used to generate intries list
"""
import hashlib
def is_invalid_entry_primitive(email, domains_to_exclude, emails_to_exclude):
_, domain = email.split('@')
top_level_domain = '.'.join(domain.split('.')[::-1][0:2][::-1])
is_forbiden_mail = top_level_domain in domains_to_exclude
is_forbiden_user = email in emails_to_exclude
return is_forbiden_mail or is_forbiden_user
domains_to_exclude =['nash.io',
'neonexchange.org',
'keyrock.eu',
'nccgroup.trust',
'cure53.de',
'recurity-labs.com']
emails_to_exclude = open('emails_to_filter_out', 'r').read().splitlines()
is_invalid_entry = lambda email: is_invalid_entry_primitive(email, domains_to_exclude, emails_to_exclude)
participants = open('secret_list.csv', 'r').read().splitlines()
public_list = []
for person in participants:
_, email, _, tickets = person.split(',')
user_string = hashlib.sha256(email.encode('utf-8')).hexdigest()
if not is_invalid_entry(email):
public_list += int(tickets) * [user_string]
sorted_list = sorted(public_list, key = str.lower)
open('participants_nash', 'w').write("\n".join(sorted_list))
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment