起源計劃 | 第二期 CPI 抽獎結果公示

根據活動規則,抽獎過程爲在投給冠軍(So Dapp)戰隊的票數中隨機抽取 60 箇中獎名額,每個 1000 FC,結果如下:

起源計劃 | 第二期 CPI 抽獎結果公示

抽獎程序:

import hashlib

import os

def sha3(x):

m = hashlib.sha3_256()

m.update(x.encode())

return m.hexdigest()

def pick(x):

global data

l = 0

r = len(data) – 1

while (l <= r):

mid = (l + r) >> 1

if (eval(data[mid][3]) >= luck):

  r = mid - 1

else:

  l = mid + 1

return r + 1

get transfer logs

fin = open(\’transfer.log\’, \’r\’)

lines = fin.readlines()

parse

0: epoch number

1: sender address

2: amount

3: accumulate amount

data = [x.strip().split(\’ \’) for x in lines]

filter transfer log with amount = 0

data = list(filter(lambda x : eval(x[2]) > 0, data))

calculate initial sha3 hash

hashes = [sha3(\’ \’.join(log)) for log in data]

now_hash = sha3(\’ \’.join(hashes))

roll

total_voted = eval(data[-1][-1])

award_cnt = 60

awarded = {}

for i in range(award_cnt):

now_hash = sha3(now_hash + \” conflux pioneer initiative {}-th price draw\”.format(i))

luck = int(now_hash, 16) % total_voted

luck_user = data[pick(luck)][1]

if luck_user in awarded:

awarded[luck_user] += 1

else:

awarded[luck_user] = 1

print(awarded)

END

了 解最新動態

(向上滑動查看內容)

起源計劃 | 第二期 CPI 抽獎結果公示

官方網站

confluxnetwork.org

起源計劃 | 第二期 CPI 抽獎結果公示

Bounty 網站

bounty.conflux-chain.org

起源計劃 | 第二期 CPI 抽獎結果公示

抖音關注 @ 烤仔

起源計劃 | 第二期 CPI 抽獎結果公示

微博關注 @Conflux 中文社區

weibo.com/confluxchain

起源計劃 | 第二期 CPI 抽獎結果公示

知乎關注 @Conflux 中文社區

www.zhihu.com/org/confluxzhong-wen-she-qu/activities

起源計劃 | 第二期 CPI 抽獎結果公示

百度貼吧關注 @Conflux 中文社區

tieba.baidu.com/f?kw=conflux%E4%B8%AD%E6%96%87%E7%A4%BE%E5%8C%BA

起源計劃 | 第二期 CPI 抽獎結果公示

Twitter 關注 @ConfluxChain

twitter.com/Conflux_Network

起源計劃 | 第二期 CPI 抽獎結果公示

Reddit

www.reddit.com/user/ConfluxChain

起源計劃 | 第二期 CPI 抽獎結果公示

Telegram

t.me/Conflux_English

起源計劃 | 第二期 CPI 抽獎結果公示

GitHub 開源交流

github.com/Conflux-Chain

起源計劃 | 第二期 CPI 抽獎結果公示

Medium

medium.com/@ConfluxNetwork

起源計劃 | 第二期 CPI 抽獎結果公示