├── blockchain ├── requirements.txt ├── app │ ├── __init__.py │ ├── templates │ │ ├── base.html │ │ └── index.html │ └── views.py ├── block_data │ └── block_2.json ├── rewrite.py ├── merkle.py ├── rewrite_data │ ├── [15025510841163558396579001245737269395311360475855163739880122218522, 1255599181276384280583862572561718270445146402237492801822382134568].txt │ └── [9918161816170064845467122710826772901278662230061595381515813689739, 12108136553740546721779993929916482825396745683250111126990696946019].txt ├── chameleon.py ├── node_server_cp.py └── node_server.py ├── result ├── ui1.png ├── ui2.png ├── ui3.png ├── ui4.png ├── ui5.png ├── merkle.key ├── merkle.png ├── node_three.png ├── server8001.png ├── merkle-merkle.key └── merkle-merkle.png ├── paper └── full version.pdf ├── paper_figure.py ├── main.py ├── sharing.py ├── README.md ├── scheme.py ├── ABET.txt └── dpss.txt /blockchain/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask~=1.1 2 | requests~=2.22 3 | -------------------------------------------------------------------------------- /blockchain/app/__init__.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | 3 | app = Flask(__name__) 4 | 5 | from app import views -------------------------------------------------------------------------------- /result/ui1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/ui1.png -------------------------------------------------------------------------------- /result/ui2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/ui2.png -------------------------------------------------------------------------------- /result/ui3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/ui3.png -------------------------------------------------------------------------------- /result/ui4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/ui4.png -------------------------------------------------------------------------------- /result/ui5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/ui5.png -------------------------------------------------------------------------------- /result/merkle.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/merkle.key -------------------------------------------------------------------------------- /result/merkle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/merkle.png -------------------------------------------------------------------------------- /result/node_three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/node_three.png -------------------------------------------------------------------------------- /result/server8001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/server8001.png -------------------------------------------------------------------------------- /paper/full version.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/paper/full version.pdf -------------------------------------------------------------------------------- /result/merkle-merkle.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/merkle-merkle.key -------------------------------------------------------------------------------- /result/merkle-merkle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting/HEAD/result/merkle-merkle.png -------------------------------------------------------------------------------- /blockchain/app/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ title }} 4 | 5 | 6 |
Home
7 |

{{ title }}

8 |
9 | {% with messages = get_flashed_messages() %} 10 | {% if messages %} 11 | 16 | {% endif %} 17 | {% endwith %} 18 | {% block content %}{% endblock %} 19 | 20 | 21 | -------------------------------------------------------------------------------- /paper_figure.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | from scipy.optimize import curve_fit 4 | 5 | def func(x, a, b,c): 6 | # return a*np.sqrt(x)*(b*np.square(x)+c) 7 | return a*np.square(x) + b*x + c 8 | 9 | x = [2,3,4,5,6,7,8,9,10] 10 | x = np.array(x) 11 | num = [0.019,0.036,0.062,0.123, 0.210, 0.292, 0.386, 0.482, 0.681] 12 | y = np.array(num) 13 | 14 | popt, pcov = curve_fit(func, x, y) 15 | 16 | print(popt) 17 | a = popt[0] 18 | b = popt[1] 19 | c = popt[2] 20 | yvals = func(x,a,b,c) 21 | print('popt:', popt) 22 | print('a:', a) 23 | print('b:', b) 24 | print('c:', c) 25 | print('pcov:', pcov) 26 | print('yvals:', yvals) 27 | def data(num): 28 | return 0.009076839737007063*num*num - 0.02887207684345916*num + 0.040509521211436667 29 | print(data(2), data(10), data(20), data(30), data(40), data(50)) 30 | print(a,b,c) 31 | -------------------------------------------------------------------------------- /blockchain/block_data/block_2.json: -------------------------------------------------------------------------------- 1 | { 2 | "index": 2, 3 | "transactions": [ 4 | [{ 5 | "author": "node 8005", 6 | "content": "800580058005", 7 | "tx_hash": "[9918161816170064845467122710826772901278662230061595381515813689739, 12108136553740546721779993929916482825396745683250111126990696946019]", 8 | "timestamp": 1626188467.8488488}], 9 | [{ 10 | "author": "node 8006", 11 | "content": "800680068006", 12 | "tx_hash": "[15025510841163558396579001245737269395311360475855163739880122218522, 1255599181276384280583862572561718270445146402237492801822382134568]", 13 | "timestamp": 1626188499.136965}] 14 | ], 15 | "previous_hash": "00fd54c3ce29ca7432c001c83319fcb1dd25657d0593e074bbd71486470ba6c7", 16 | "hash": "005fd7400115f924cd33c6ad697a2337d528d85e5d74f5133c78582f427fdd74"} -------------------------------------------------------------------------------- /blockchain/rewrite.py: -------------------------------------------------------------------------------- 1 | import charm.core.crypto.cryptobase 2 | import hashlib 3 | from charm.toolbox.pairinggroup import * 4 | from charm.toolbox.secretutil import SecretUtil 5 | from charm.toolbox.ABEnc import * 6 | from chameleon import CHAMELEON 7 | import argparse 8 | import random 9 | import time 10 | from hashlib import sha256 11 | 12 | 13 | def main(): 14 | 15 | curve = 'MNT224' 16 | groupObj = PairingGroup(curve) 17 | chameleon = CHAMELEON(groupObj) 18 | 19 | (mpk, msk) = chameleon.setup() 20 | 21 | 22 | policy = '(123 or 444) and (231 or 384)' 23 | sk = chameleon.keygen(mpk, msk, policy) 24 | 25 | # message = groupObj.random(ZR) 26 | i = 1 27 | message = groupObj.init(ZR, int(1)) 28 | attri_list = {'123', '444', '231', '384'} 29 | hash_text = chameleon.hash(mpk, msk, message, attri_list) 30 | print(hash_text['message']) 31 | print(hash_text['b']) 32 | print(type(hash_text['b'])) 33 | print(hashlib.sha256(str(hash_text['b']).encode()).hexdigest()) 34 | 35 | 36 | p_prime, b, random_r = hash_text['p_prime'], hash_text['b'], hash_text['random_r'] 37 | C, c, epk, sigma = hash_text['C'], hash_text['c'], hash_text['epk'], hash_text['sigma'] 38 | keypair_pk = hash_text['keypair_pk'] 39 | verify_text = chameleon.verify(mpk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk) 40 | 41 | adapt_text = chameleon.adapt(mpk, msk, sk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk) 42 | print(adapt_text['message_prime']) 43 | print(adapt_text['b']) 44 | 45 | if __name__ == "__main__": 46 | debug = True 47 | main() -------------------------------------------------------------------------------- /blockchain/merkle.py: -------------------------------------------------------------------------------- 1 | import string 2 | import hashlib 3 | from merklelib import MerkleTree, beautify, export 4 | from hashlib import sha256 5 | import charm.core.crypto.cryptobase 6 | from charm.toolbox.pairinggroup import * 7 | from charm.toolbox.secretutil import SecretUtil 8 | from charm.toolbox.ABEnc import * 9 | from chameleon import CHAMELEON 10 | import argparse 11 | import random 12 | 13 | curve = 'MNT224' 14 | groupObj = PairingGroup(curve) 15 | chameleon = CHAMELEON(groupObj) 16 | (mpk, msk) = chameleon.setup() 17 | policy = '(123 or 444) and (231 or 384)' 18 | sk = chameleon.keygen(mpk, msk, policy) 19 | 20 | def hashfunc(value): 21 | # return hashlib.sha256(str(value).encode()).hexdigest() 22 | # res = chameleon.generate_chameleon_hash(mpk, value) 23 | # b = res['b'] 24 | # return chameleon.generate_chameleon_hash(mpk, value)['b'] 25 | message = groupObj.init(ZR, int(value)) 26 | attri_list = {'123', '444', '231', '384'} 27 | hash_text = chameleon.hash(mpk, msk, message, attri_list) 28 | p_prime, b, random_r = hash_text['p_prime'], hash_text['b'], hash_text['random_r'] 29 | C, c, epk, sigma = hash_text['C'], hash_text['c'], hash_text['epk'], hash_text['sigma'] 30 | keypair_pk = hash_text['keypair_pk'] 31 | verify_text = chameleon.verify(mpk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk) 32 | # m′, p′, b, r′, C′, c′, epk′, σ′ 33 | # return {'message_prime':message_prime, 'p_prime':p_prime, 'b':b, 'random_r_prime':random_r_prime, 'C_prime':C_prime, 'c_prime':c_prime, 'epk_prime': epk_prime, 'sigma_prime': sigma_prime, 'res_prime':res_prime} 34 | adapt_text = chameleon.adapt(mpk, msk, sk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk) 35 | return b, verify_text, adapt_text['message_prime'], adapt_text['p_prime'], adapt_text['b'], adapt_text['random_r_prime'], adapt_text['C_prime'], adapt_text['c_prime'], adapt_text['epk_prime'], adapt_text['sigma_prime'], adapt_text['res_prime'] 36 | 37 | def defaulthash(value): 38 | return hashlib.sha256(value).hexdigest() 39 | 40 | print(groupObj.init(ZR, int(100))) 41 | 42 | 43 | # a list of all ASCII letters 44 | # data = list(string.ascii_letters) 45 | # data = ['1', '2'] 46 | 47 | # build a Merkle tree for that list 48 | # tree = MerkleTree(data, hashfunc) 49 | # print(tree) 50 | # beautify(tree) 51 | # print(ttt) 52 | # export(tree, filename='transactions') 53 | # st = str('2793603d2dbc9ecb01075e8ee79c9705840bfde2d7e04ddfc952aea2ae46e79c') + str('6ee8afcc0c19ab6c4193a332f862a85931093e425e417a598e9586c118fbcd47') 54 | # a = 1 55 | # test = b'\x00' + '1'.encode() 56 | # test = '1'.encode() 57 | # print(test) 58 | # test = 1 59 | # print(hashlib.sha256(str(test).encode()).hexdigest()) 60 | -------------------------------------------------------------------------------- /blockchain/app/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | {% extends "base.html" %} 3 | 4 | {% block content %} 5 |
6 | 7 |
8 |
9 | 10 |
11 | 12 | 13 |
14 |
15 | 16 |
17 | 18 | 19 | 20 | 21 |
22 | 23 | {% for post in posts %} 24 |
25 |
26 |
27 |
{{post.author[0]}}
28 |
{{post.author}}
29 |
Posted at {{readable_time(post.timestamp)}}
30 |
31 |
32 |
33 |

{{post.content}}

34 |
35 |
36 |
37 | {% endfor %} 38 | 39 | 101 |
102 | {% endblock %} 103 | -------------------------------------------------------------------------------- /blockchain/app/views.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import json 3 | from hashlib import sha256 4 | 5 | 6 | import requests 7 | from flask import render_template, redirect, request 8 | 9 | from app import app 10 | from merkle import hashfunc 11 | 12 | # The node with which our application interacts, there can be multiple 13 | # such nodes as well. 14 | CONNECTED_NODE_ADDRESS = "http://127.0.0.1:8001" 15 | 16 | posts = [] 17 | 18 | 19 | def fetch_posts(): 20 | """ 21 | Function to fetch the chain from a blockchain node, parse the 22 | data and store it locally. 23 | """ 24 | get_chain_address = "{}/chain".format(CONNECTED_NODE_ADDRESS) 25 | response = requests.get(get_chain_address) 26 | if response.status_code == 200: 27 | content = [] 28 | chain = json.loads(response.content) 29 | for block in chain["chain"]: 30 | for tx in block["transactions"]: 31 | tx["index"] = block["index"] 32 | tx["hash"] = block["previous_hash"] 33 | content.append(tx) 34 | 35 | global posts 36 | posts = sorted(content, key=lambda k: k['timestamp'], 37 | reverse=True) 38 | 39 | 40 | @app.route('/') 41 | def index(): 42 | # fetch_posts() 43 | return render_template('index.html', 44 | title='Decentralized nodes', 45 | posts=posts, 46 | node_address=CONNECTED_NODE_ADDRESS, 47 | readable_time=timestamp_to_string) 48 | 49 | 50 | @app.route('/submit', methods=['POST']) 51 | def submit_textarea(): 52 | """ 53 | Endpoint to create a new transaction via our application. 54 | """ 55 | post_content = request.form["content"] 56 | author = request.form["author"] 57 | 58 | # tx_hash = sha256(str(post_content).encode()).hexdigest() 59 | res = hashfunc(int(post_content)) 60 | # b, verify_text, adapt_text['message_prime'], adapt_text['p_prime'], adapt_text['b'], adapt_text['random_r_prime'], adapt_text['C_prime'], adapt_text['c_prime'], adapt_text['epk_prime'], adapt_text['sigma_prime'], adapt_text['res_prime'] 61 | chameleon_hashvalue = str(res[0]) 62 | oldhash_verify, message_prime, p_prime, b_prime, random_r_prime, C_prime, c_prime, epk_prime, sigma_prime, newhash_verify = str(res[1]), str(res[2]), str(res[3]), str(res[4]), str(res[5]), str(res[6]), str(res[7]), str(res[8]), str(res[9]), str(res[10]) 63 | # message = str(hashfunc(int(post_content))[1]) 64 | # tx_hash = sha256(to_modify_content.encode()).hexdigest() 65 | tx_hash = str(res[0]) 66 | # print(hashlib.sha256(str(hash_text['b']).encode()).hexdigest()) 67 | output = {'tx_hash': tx_hash, 'old content': post_content, 'chameleon_hashvalue': chameleon_hashvalue, 'oldhash_verify': oldhash_verify, 'message_prime': message_prime, 'p_prime': p_prime, 'newchameleon_hashvalue': b_prime,'random_r_prime': random_r_prime, 'C_prime': C_prime, 'c_prime': c_prime, 'epk_prime': epk_prime, 'sigma_prime': sigma_prime,'newhash_verify': newhash_verify} 68 | with open('./rewrite_data/' + str(tx_hash) + '.txt', 'w') as file: 69 | file.write(json.dumps(output)) 70 | 71 | post_object = { 72 | 'author': author, 73 | 'content': post_content, 74 | # 'chameleon_hashvalue': chameleon_hashvalue, 75 | 'tx_hash': chameleon_hashvalue 76 | } 77 | 78 | 79 | # Submit a transaction 80 | new_tx_address = "{}/new_transaction".format(CONNECTED_NODE_ADDRESS) 81 | 82 | requests.post(new_tx_address, 83 | json=post_object, 84 | headers={'Content-type': 'application/json'}) 85 | 86 | return redirect('/') 87 | 88 | 89 | def timestamp_to_string(epoch_time): 90 | return datetime.datetime.fromtimestamp(epoch_time).strftime('%H:%M') 91 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import charm.core.crypto.cryptobase 2 | from charm.toolbox.pairinggroup import * 3 | from charm.toolbox.secretutil import SecretUtil 4 | from charm.toolbox.ABEnc import * 5 | from scheme import SCHEME 6 | from sharing import SHARING 7 | import argparse 8 | import random 9 | import time 10 | from hashlib import sha256 11 | 12 | 13 | 14 | 15 | def main(): 16 | 17 | # post_content = str(123) 18 | # print(sha256(post_content.encode()).hexdigest()) 19 | 20 | curve = 'MNT224' 21 | groupObj = PairingGroup(curve) 22 | scheme = SCHEME(groupObj) 23 | 24 | (mpk, msk) = scheme.setup() 25 | 26 | parser = argparse.ArgumentParser() 27 | parser.add_argument("modules") 28 | args = parser.parse_args() 29 | 30 | if args.modules == 'ABET': 31 | policy = '(123 or 444) and (231 or 384)' 32 | sk = scheme.keygen(mpk, msk, policy) 33 | 34 | message = groupObj.random(ZR) 35 | attri_list = {'123', '444', '231', '384'} 36 | hash_text = scheme.hash(mpk, msk, message, attri_list) 37 | 38 | 39 | p_prime, b, random_r = hash_text['p_prime'], hash_text['b'], hash_text['random_r'] 40 | C, c, epk, sigma = hash_text['C'], hash_text['c'], hash_text['epk'], hash_text['sigma'] 41 | keypair_pk = hash_text['keypair_pk'] 42 | print("\n\n\n================================Verify()======================================") 43 | verify_text = scheme.verify(mpk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk) 44 | 45 | adapt_text = scheme.adapt(mpk, msk, sk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk) 46 | 47 | elif args.modules == 'DPSS': 48 | # print(time.time()) 49 | share = SHARING(groupObj) 50 | alpha = msk['alpha'] 51 | S = groupObj.init(ZR, int(alpha)) 52 | print("\n\n=============================== Secret (i.e., msk['alpha']) ======================================") 53 | print("\n\nSecret:\n", S) 54 | 55 | threshold = 2 56 | n = 2 * threshold + 1 57 | shares_A = share.get_GroupA_shares(S, threshold) 58 | print("\n\n=============================== Distribute shares to Committee A ======================================") 59 | print("\n\nThe shares to Committee A:\n", shares_A) 60 | 61 | # A1 = [B1, B2, B3, B4, B5], A2 = [B1, B2, B3, B4, B5]....... 62 | reshare_A = [] 63 | for i in shares_A: 64 | # share.reshare_GroupA_shares(i) contains 5 numbers/points 65 | reshare_A.append(share.reshare_GroupA_shares(i)) 66 | print("\n\n=============================== Re-calculate shares in Committee A ======================================") 67 | print("==================== Distribute new shares from Committee A to Committee B ==============================") 68 | print("\n\nThe shares from Committee A to Committee B:\n", reshare_A) 69 | 70 | 71 | # shares_B is a size_A * size_B list, shares_B[i] has 5 numbers/points 72 | shares_B = share.get_GroupB_shares(reshare_A) 73 | print("\n\n=============================== Committee B members receive share slices from Committee A ======================================") 74 | print("===========================================Committee B members recover new shares ==============================================") 75 | print("\n\nThe new shares in Committee B:\n", shares_B) 76 | 77 | # return coefficient [0, a1, a2,.....an] 78 | new_polynomial = share.generate_new_polynomial() 79 | 80 | B = [None] * (n) 81 | for i in range(n): 82 | # recover_secret() reutn {'constant': xx, 'x^1':xx, 'x^2':xx,......'x^n':xx} 83 | B[i] = share.update_polynomial(share.recover_secret(shares_B[i]), new_polynomial) 84 | 85 | updated_S = share.update(B) 86 | # print(time.time()) 87 | print("\n\n=============================== Recovered Secret in Committee B ======================================") 88 | print("recovered_Secret:\n", share.recover_secret(updated_S)) 89 | 90 | else: 91 | print("Invalid argument.") 92 | 93 | if __name__ == "__main__": 94 | debug = True 95 | main() 96 | -------------------------------------------------------------------------------- /sharing.py: -------------------------------------------------------------------------------- 1 | import charm.core.crypto.cryptobase 2 | from charm.toolbox.pairinggroup import * 3 | from charm.toolbox.secretutil import SecretUtil 4 | from charm.toolbox.ABEnc import * 5 | from fractions import Fraction 6 | import random 7 | import numpy as np 8 | 9 | class SHARING(ABEnc): 10 | def __init__(self, groupObj, verbose = False): 11 | ABEnc.__init__(self) 12 | global util, group 13 | group = groupObj 14 | util = SecretUtil(group, verbose) 15 | self.size_A = 5 16 | self.size_B = 5 17 | self.threshold = 2 18 | 19 | def compute_polynomial(self, share, x): 20 | # return constant + a1 * x + a2 * (x**2) 21 | res = 0 22 | for i in range(len(share)): 23 | res += share[i] * x**(i) 24 | return res 25 | 26 | def compute_polynomial_xy(self, S, coefficient, x): 27 | # x is set to a particular "value" 28 | res = [None] * (self.threshold+1) 29 | constant = S 30 | for i in range(self.threshold): 31 | constant += coefficient[3*i] * x**(i+1) 32 | res[0] = constant 33 | for i in range(1, self.threshold+1): 34 | res[i] = coefficient[3*(i-1)+1] + coefficient[3*(i-1)+2] * x**(i) 35 | return res 36 | 37 | 38 | def get_GroupA_shares(self, S, threshold): 39 | self.threshold = threshold 40 | self.size_A, self.size_B = 2 * threshold + 1, 2 * threshold + 1 41 | coefficient = [] 42 | for i in range(3*self.threshold): 43 | coefficient.append(group.init(ZR, int(random.randrange(1000)))) 44 | shares = [] 45 | for i in range(self.size_A): 46 | shares.append(self.compute_polynomial_xy(S, coefficient, i+1)) 47 | return shares 48 | 49 | def reshare_GroupA_shares(self, share): 50 | reshare_A = [] 51 | for i in range(self.size_B): 52 | reshare_A.append(self.compute_polynomial(share, i+1)) 53 | return reshare_A 54 | 55 | def get_GroupB_shares(self, reshare_A): 56 | shares_B = [] 57 | for i in range(self.size_B): 58 | share_Bi = [] 59 | for j in range(self.size_A): 60 | share_Bi.append(reshare_A[j][i]) 61 | shares_B.append(share_Bi) 62 | return shares_B 63 | 64 | def generate_new_polynomial(self): 65 | res = [None] * (self.threshold+1) 66 | res[0] = 0 67 | for i in range(1, self.threshold+1): 68 | res[i] = group.init(ZR, int(random.randrange(1000))) 69 | return res 70 | 71 | 72 | def recover_secret(self, shares): 73 | points_index, points_value = [], [] 74 | for i in range(self.threshold+1): 75 | points_index.append(self.size_A-i) 76 | points_value.append(shares[self.size_A-1-i]) 77 | l = [] 78 | for i in range(self.threshold+1): 79 | l.append(self.compute_l(points_index, i)) 80 | recovered_polynomial = [] 81 | for i in range(self.threshold+1): 82 | tmp = 0 83 | for j in range(len(l)): 84 | tmp += int(Fraction(int(l[j]['numerator'][i]) * int(points_value[j]), int(l[j]['denominator']))) 85 | recovered_polynomial.append(int(tmp)) 86 | return recovered_polynomial 87 | 88 | 89 | def compute_l(self, points_index, i): 90 | x_i = points_index[i] 91 | new_point_index = [] 92 | for i in points_index: 93 | if i != x_i: 94 | new_point_index.append(i) 95 | denominator = 1 96 | _numerator = np.poly1d([1]) 97 | for i in new_point_index: 98 | denominator *= x_i - i 99 | _numerator *= np.poly1d([1, -i]) 100 | numerator = list(np.poly1d(_numerator)) 101 | return {'numerator': numerator[::-1], 'denominator':denominator} 102 | 103 | def update_polynomial(self, shares_Bi, new_polynomial): 104 | updated_polynomial = [] 105 | for i in range(len(shares_Bi)): 106 | updated_polynomial.append(shares_Bi[i] + new_polynomial[i]) 107 | res = [] 108 | for i in range(self.size_B): 109 | res.append(self.compute_polynomial(updated_polynomial, i+1)) 110 | # (2* threshold + 1) numbers 111 | return res 112 | 113 | def update(self, B): 114 | res = [] 115 | for i in range(self.size_A): 116 | tmp = [] 117 | for j in range(self.size_A): 118 | tmp.append(B[j][i]) 119 | res.append(self.recover_secret(tmp)[0]) 120 | # (2* threshold + 1) numbers 121 | return res 122 | 123 | 124 | -------------------------------------------------------------------------------- /blockchain/rewrite_data/[15025510841163558396579001245737269395311360475855163739880122218522, 1255599181276384280583862572561718270445146402237492801822382134568].txt: -------------------------------------------------------------------------------- 1 | {"tx_hash": "[15025510841163558396579001245737269395311360475855163739880122218522, 1255599181276384280583862572561718270445146402237492801822382134568]", "old content": "800680068006", "chameleon_hashvalue": "[15025510841163558396579001245737269395311360475855163739880122218522, 1255599181276384280583862572561718270445146402237492801822382134568]", "oldhash_verify": "True", "message_prime": "14720872044323331829862253884545381421385525135863466743349982709824", "p_prime": "[3513292386691837316115142696391613797059379105439266787324628481232, 764596885828075240502387240118155007787957740480021419794342073458]", "newchameleon_hashvalue": "[15025510841163558396579001245737269395311360475855163739880122218522, 1255599181276384280583862572561718270445146402237492801822382134568]", "random_r_prime": "734886303321207182189989387220259551162119833932139938955388746661", "C_prime": "{'attri_list': {'231', '444', '123', '384'}, 'ct': 3914813208679818756634593242723099709972443875787551185074296317044, 'CT1': {'231': [[4158948494269154951188910141616482810408158316755412016040455675429, 6788928275916282756662966006470978852447681501030373822201531185628, 2777812729044457563436948704747859257459509749206000996032421995321], [756290701094362879381614132137367546965716521572796999401778023245, 2521041613986022030360574863549331450865217273754629718769150689658, 4597528164924286658169920480039737196212457807576687424085631448438]], '444': [[1646902849151116523817118478564520348976318917618196969148091753262, 8165218411036204104342348763446400246982694676351226753362618836762, 4056045896100988569726242447827569377251305838694948061036139011735], [8541768845742341384799327691876220565161816853530697230566346336740, 14698214690885804512642059349544459791388601534819440090475909852436, 8786407520921182698398630309677295441621885206315684235234506509354]], '123': [[4271258258397868478610746159821663272366008960322614702230607911889, 3605353596235661284165433901279300585126314472164149299473301477002, 12717857187455485770712008034411480233608217863176008155151412637984], [7733210215501405535882526831355499657439118240824693988513323679760, 9213955686054548764450101159884811919853922858845552297002304152474, 12770904067123654624584337857824175552121594172484820171141520582268]], '384': [[3141378692912988349494620582990110821012068117249277719924944243086, 10151486041573900907930539330967931167541717923437772874195837500139, 8440398890956302973443413780278475195559521519655243070339873798886], [12345697816852736940867154891378716585837736332538045843238273319642, 11409442785945474518930595210480228890145978768282002234230856508187, 628639323558052845630909493262772711788292030797417575049119158552]]}, 'CT2': {'231': [12770499360205533174767310593217511026910153511561971091989865569363, 13250016222505164932378469009478335064811361688734071083713282093166], '444': [7832936691463138683217935921859449731378492567340161103933372095772, 14740118525323804561309076730076443202134359770908474092806684157470], '123': [6834213370912289072160514758872785927424982754737970176448136675547, 9790135174776458630830172533009032764546412833603499593847242746154], '384': [2540724894421670741009500573790583057326866998169623385973578242321, 9970871691014421176198840087951044657936704977368646854283175187318]}, 'ct_0': {'h_s': [[11697249124418616178002940168978292826949255367528778424533043175958, 10341163220373871260478637229174699133498961721937107842950281689284, 7049205588544777856930016555549700266273944456985349122598758813734], [4865230542938811525866357166609530414063194177609933197066483913010, 12488391795369859049090227783718218291812595326310624789030296810148, 12177013705488425515833753064657199858397538272494715802412151416152]], 'h_s_alpha': [[9197465801139103800925351958732520640312487759834897924669381476936, 13685611190781029737855788039180726030115561093078286240689229147226, 14375736009022253083986185275335451606538747766483917767680211639934], [1964240953204420063415560008660614041936998672268117220433503081121, 3631013738008130480929404831380006119465942990776484902124064573162, 13390935145527112908241819768328660865409937432012302906622331354785]], 'h_beta_s_alpha': [[7184211719287484221137126413014199107766672580473021125691830870395, 7286306317211713479384392545188643849446574935713238197336411827649, 12685019881682427518681258324061254086591961241928608094472440251503], [10571566951194381830805278156461011966140065371428744892165669700447, 12897620286459332355988265578537333319424113576077128046664506385652, 4336523566376705834568929382034492224247400432884766423537717908186]]}, 'ct_1': [[14819591649495815955607508694701090570566441143013437465272292227657, 9332583128565137918209276786417087122664076402177673429404336154015, 12470251141300444950367375767920642785117114974790334005961450332332], [14548772292061997187413081843025741499779171987500387870304977886801, 3646707606182134852805426527612041216566281868169941319413445965565, 3217372557543899178054114316992021933257676716289591275210105346320]]}", "c_prime": "[4960288657104375926742099516424913116336520253121598587073831829855, 6679721707717134383238318360244022561872700915530877081455239137130]", "epk_prime": "[1335631217458172017261567160592648140422383595999103156219900836224, 12910647328600341185911319668641499128463338350480701574732107553009]", "sigma_prime": "10413526722347256636998416923022401301751269917258664670595400348478", "newhash_verify": "True"} -------------------------------------------------------------------------------- /blockchain/rewrite_data/[9918161816170064845467122710826772901278662230061595381515813689739, 12108136553740546721779993929916482825396745683250111126990696946019].txt: -------------------------------------------------------------------------------- 1 | { 2 | "tx_hash": "[9918161816170064845467122710826772901278662230061595381515813689739, 12108136553740546721779993929916482825396745683250111126990696946019]", 3 | "old content": "800580058005", 4 | "chameleon_hashvalue": "[9918161816170064845467122710826772901278662230061595381515813689739, 12108136553740546721779993929916482825396745683250111126990696946019]", 5 | "oldhash_verify": "True", 6 | "message_prime": "1486118873378442412242365621264141390816714490447791453132566421618", 7 | "p_prime": "[13123232977794592581053931236452986286990513565782613859989899451991, 14434536983088212132373613482840445611803768497388075278249459735671]", 8 | "newchameleon_hashvalue": "[9918161816170064845467122710826772901278662230061595381515813689739, 12108136553740546721779993929916482825396745683250111126990696946019]", 9 | "random_r_prime": "7272223150795457040614993296513816179470898862548458811119889110914", 10 | "C_prime": "{'attri_list': {'123', '231', '444', '384'}, 'ct': 8365198993478893386525840128429028661391030988264601283571678051312, 'CT1': {'123': [[10667027330902162038502099366419451690960341441391381138736306718679, 10013329316240486142212238751114719693850908281589835762576604182271, 13172464003337235559377431301827106511174972245605141519666362246721], [14628222773654593859740096862063568699226622897904561721342947264683, 9860661738113356979634933552469793926295766555075215850404077370082, 3192643051663755504993961763458249544682350628280648411683463335490]], '231': [[10020836112012841869117355307190897984312227153489936608612210289424, 4077903799301830150469031436858468315557286898299010178697412728756, 10220555614168315917881730013597417846025728611667107813822365008796], [9496002792217330142120585091537933859525634907048761551617982453761, 5012628805271324551176753739171652769286222732621355210782281641816, 1424799146678783552766279719021689097461291644013789557919247676772]], '444': [[1537172175250456734359451934230828369729705758748833299524621815249, 12202789824252947948266881257941118244088883289206640386006963572663, 1291092894306454594923713083858096174905766739606636851676038034348], [10280031398642615468251384978367629583683873911479237532247733563077, 5450398065566539278556718453073048928032156199054552848099616502189, 1425180393206458975662479501712472356668824008998520572747489146941]], '384': [[11756333696100932732806136464076197518386918816456280229156610082115, 11671378356745422871827481460003062390911818115577252148339131301861, 1479509626485843486415886867148628004596257652418643384837505772151], [11277691476268250893300718964446166956079687751786916083591043976758, 1707645947361252292312597995361815981511414542854738694808554217378, 8379876808674342965618503022786438148970700689811977006080120982489]]}, 'CT2': {'123': [5399061966582380303616962767438500911135462440986226459392151691352, 9362208952528087325203227205151366018360741995968390684928020502365], '231': [12156294573268981507208958571874329629349434226241084372396674711285, 12688179227929639745795632593710910261822261910713748363265946106121], '444': [14495874165324144283390613750516377350707321912561281050528284883203, 14960244983380350105029316176686771575587446969454277521944004933149], '384': [12565195133300317770605987623049711239533676725395501203074614567188, 6363483377821358577912742011823976984425401547715333865053984709044]}, 'ct_0': {'h_s': [[11667432548251460106670016130248029948300684746929245605987649544343, 6247947229736753241565427463119273949172459879196444388281814741664, 10568573732690692468031887937079549726424383811724546591555401817017], [14134557285607404356598979799926479460682706950721821088964635263275, 7525524902217997579344065370658199567620630018446435672742440333442, 5803601797346013836769421166163858423826755744818242992345626348259]], 'h_s_alpha': [[10004262943909455209558634272734570950242138113547540651675564967099, 6638729375878031995813795459342901728730153761676438459988130081659, 7645097098649236233519984668306540387830799272593752235238467396313], [14105239360178562812422545757393369932011764534322468747773081994960, 694066978463284623297342900667045713357297787252279516527364452689, 2658147745975377920109725952585050993181567929253326601831651145762]], 'h_beta_s_alpha': [[7648014584223245808633240278720129107203099092273320997606173329473, 6486518823608667025403392885083274051032372725178530397144793473758, 9215581960258125739467359224016657543056904998205148023292275348803], [496249155906176822741248546251089170909023838400648645756075018944, 9259634842420051799494542963677568677759112735976133138756693563853, 11086307400517062164632676368530733238096920834153907661799176134372]]}, 'ct_1': [[62876622264932067389580735403276253157084163310534808933134576410, 13183080776318369219017814515838219820983857238462547918149517911680, 14448250699253964076478684763061753903622306747395696663116486768084], [3987018853814509589137193223255906365958399371570796400005114655273, 14684207550408534776870664673608241385548216171618065865759813148153, 14246800279742081193922790203015395077424125991546982702396067956818]]}", 11 | "c_prime": "[13984413842800934228578848970633622491184675901141575851188300549638, 12833663512657308472113166910629728899358929091643882317716552141441]", 12 | "epk_prime": "[11572827336355955247048011483888866114137504610031428243625786085495, 10188642853227338349352128349026567893427875396072623101645708706663]", 13 | "sigma_prime": "7938357995946369164499088145812919240868444479387798902860657931273", 14 | "newhash_verify": "True" 15 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting 2 | 3 | A construction of practical ABET scheme, in addition to a Proof-of-Work blockchain implemented. 4 | The ABET scheme can be used to secure blockchain rewriting, such that trapdoor holder may maliciously rewrite the blockchain without being identified. 5 | 6 | A video for demo can be found at [this](https://www.youtube.com/watch?v=RyF2fbrhK0Q&t=179s)(with subtitles) and [this](https://www.youtube.com/watch?v=W4_ugZwe7bE&t=54s)(without subtitles). 7 | 8 | The full version of our paper can be found in the *paper/* folder. 9 | 10 | ## Prerequisites 11 | 12 | The schemes have been tested with Python 3.6.7 on Mac OS X. First, verify that you have installed the following dependencies: 13 | 14 | - [GMP 5.x](https://gmplib.org) 15 | - [PBC library](https://crypto.stanford.edu/pbc/download.html) 16 | - Charm 0.43, this can be installed from [this](https://github.com/JHUISI/charm/releases) page 17 | - [OpenSSL](https://www.openssl.org/source) 18 | 19 | ## Overview 20 | 21 | The instantiation includes the following primitives: an attribute-based encryption *KP-ABE*, 22 | a hierarch identity-based encryption *HIBE*, a *chameleon hash* with ephemeral trapdoor, a *digital signature* scheme (e.g., Schnorr), a *DPSS* protocol and a running Proof-of-Work *blockchain*. 23 | 24 | Some basic details of the implementation are: 25 | ``` 26 | scheme.py: full code of setup(), keygen(), hash(), verify(), adapt() algorithms 27 | sharing.py: code of DPSS protocol 28 | blockchain/: code of blockchain with nodes 29 | ``` 30 | 31 | ## Instructions to run 32 | 33 | Clone the project, 34 | 35 | ```sh 36 | $ git clone https://github.com/lbwtorino/Fine-Grained-Blockchain-Rewriting-in-Permissionless-Setting.git 37 | ``` 38 | 39 | Once installed all the dependencies, to run and test ABET scheme, 40 | ```sh 41 | $ python main.py ABET 42 | ``` 43 | The ABET logic is from `scheme.py`, including `Setup()`, `KeyGen()`, `Hash()`,`Verify()` 44 | and `Adapt()` functions. 45 | We provide an output file (the output data objects are referred to `Section 5.2` of our paper) in `ABET.txt`. 46 | 47 | 48 | You can also seperately run and test DPSS protocol, make sure your python installed `fractions` package, 49 | ```sh 50 | $ python main.py DPSS 51 | ``` 52 | The DPSS logic is from `sharing.py`. In the test case, we provide the data shared between 53 | old committees and new committees (both size includes 5 committee members). 54 | We provide an execution output example in `./DPSS.txt`, where 55 | - `Secret` is *Secret* (in our scenria, *Secret* is `msk['alpha']`), `The shares to Committee A` indicates the Committee A (old committee)'s shares (in this demo, it contains 5 shares and each of them is distributed to every member in Committee A), 56 | - `The shares from Committee A to Committee B:` denotes the re-shares that should be distributed from Committee A to new Committee B (as size of Committee B is 5, every Committee A re-calculate its shares into 5 slices, each slice is distributed to each Committee B member), 57 | - `The new shares in Committee B:` refers to the shares that Committee B re-calculate after receiving shares from Committee A (obviously, each Committee B member will receive 5 slices from 5 Committee A members. Then, for each Committee B member, he use Shamir's recovery algorithm to calculate a value. 58 | This value is the new share for himself), 59 | - `recovered_Secret` means the recovered *secret* from new Committee B. 60 | As shown, `recovered_Secret` is equal to `Secret`. 61 | 62 | 63 | ## Deploy a blockchain and nodes 64 | 65 | Install the dependencies: install [merklelib](https://github.com/vpaliy/merklelib) if your python environment doesn't have before 66 | 67 | ```sh 68 | $ cd blockchain/ 69 | $ pip install -r requirements.txt 70 | ``` 71 | 72 | Start a blockchain, the port number is set to 8001, 73 | 74 | ```sh 75 | $ export FLASK_APP=node_server.py 76 | $ flask run --port 8001 77 | ``` 78 | 79 | 80 | 81 | 82 | As shown below, one instance of our blockchain is now up and running at port 8001. 83 | ![Image1](./result/server8001.png) 84 | 85 | 86 | 87 | To play around multiple custom nodes, run the blockchain on a different terminal session, 88 | here's a sample scenario that you might wanna try. 89 | 90 | 93 | 94 | ```sh 95 | $ flask run --port 8005 96 | $ flask run --port 8006 97 | $ flask run --port 8007 98 | ...... 99 | ``` 100 | As shown below, now we are deploying three nodes on blockchain. 101 | 102 | ![Image2](./result/node_three.png) 103 | 104 | ## Interact with blockchain 105 | 106 | Every node interacts with blockchain by sending transaction via http://localhost:{port_number}. 107 | In your browser, type http://localhost:{port_number} (e.g., http://localhost:8005/). 108 | The UI of each node is shown below: 109 | 110 | ![Image3](./result/ui1.png). 111 | 112 | To send a transaction to blockchain, type the data and your id and by clicking `Post` button. 113 | 114 | ![Image4](./result/ui2.png). 115 | 116 | To mine the transaction, in your browser, type http://localhost:8001/mine. 117 | 118 | ![Image5](./result/ui3.png). 119 | 120 | In our construction, each transaction contains the following properties (a json format): 121 | - "author": transaction creator, 122 | - "content": post_content, 123 | - "tx_hash": the hashed value (traditional blockchain generates this field by generic SHA256 hash function while we propose a chameleon hash function that allows to change the content but keep the chameleon hash value unchanged to achieve rewrite blockchain), 124 | - "timestamp": time 125 | 126 | **[Objective]: Please note that in the upper-layer real-worl blockchain (Merkle tree structure) only saves the `tx_hash` not `content` itself (as shown below). This is actually the objective of our paper. In traditional blockchain `tx_hash` (i.e., `H(content)`), `H()` refers to SHA256.** 127 | 128 | ![Image111](./result/merkle.png). 129 | 130 | 131 | **In our paper, `H()` denotes the chameleon hash function we proposed, which allows *m* and *m'* (different message) to have identical hash value. Thus, malicious/curious/authorized roles are able to rewrite the blockchain (i.e., the `content` can be changed from *m* to *m'* but `tx_hash` is unchanged)** 132 | 133 | ![Image222](./result/merkle-merkle.png). 134 | 135 | 136 | The chain data (transaction details) are saved in `./block_data`. As shown below, 137 | we give an example with two mined transactions. 138 | **Please pay attention to the and `tx_hash`, we may introduce how to rewrite blockchain in the next section.** 139 | 140 | ![Image6](./result/ui4.png). 141 | 142 | 143 | ## Rewrite blockchain 144 | In traditional blockchain constructions `tx_hash` (i.e., `H(content)`), 145 | `H()` represents SHA-256, where *m* and *m'* have different hash value (collision-resistance property). 146 | In contrast, in our paper `H()` is a new chameleon hash we proposed 147 | that allows *m* and *m'* are able to have the same hash value by performing specific strategy (refers to `Section 5.2` **Adapt()** method). 148 | 149 | By doing so, malicious/curious/authorized roles 150 | are able to rewrite the blockchain, as low-layer storage *m* can be replaced by *m'* 151 | but `tx_hash` (stored at upper-layer blockchain's Merkle tree) is unchanged. 152 | 153 | ![Image333](./result/merkle-merkle.png). 154 | 155 | 156 | We demonstrate how to rewrite each transaction in `./rewrite_data`. Each file contains the 157 | required data for each transaction hash. In previous section, 158 | the two transaction hash are 159 | 160 | `[9918161816170064845467122710826772901278662230061595381515813689739, 12108136553740546721779993929916482825396745683250111126990696946019]` 161 | 162 | and `[15025510841163558396579001245737269395311360475855163739880122218522, 1255599181276384280583862572561718270445146402237492801822382134568]`. 163 | 164 | **Please note that the chameleon hash values take the format of 2-element array(shown above)** 165 | 166 | 167 | The example for such two transaction in `./rewrite_data`. Taking 1st transaction as an example (please 168 | also refer to `Section 5.2` of our paper), where 169 | 170 | ![Image6](./result/ui5.png). 171 | 172 | - `old content` is the posted content by node 8005, 173 | - `chameleon_hashvalue` 174 | equals to `tx_hash` computed by our proposed chameleon hash function, 175 | - (`message_prime`, `p_prime`, `newchameleon_hashvalue`, `random_r_prime`, `C_prime`, 176 | `c_prime`, `epk_prime`, `sigma_prime`) are the required data to rewrite blockchain. 177 | **(You may find details in `Adapt()` of `Section 5.2` of our paper).** 178 | - `newhash_verify` is the `Verify()` result. 179 | 180 | Please find the process of cryptography correctness in our paper. 181 | Generally speaking, you can find that 182 | 183 | - message *m* is from `800580058005` to *m'* `1486118873378442412242365621264141390816714490447791453132566421618`, 184 | but `chameleon_hashvalue` and `newchameleon_hashvalue` are same (actually, 185 | they are equal to `tx_hash`) 186 | 187 | - `newhash_verify` is `True`. This value is obtained by executing `Verify()` method, indicating the replacement (rewrite) is corret. 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /blockchain/chameleon.py: -------------------------------------------------------------------------------- 1 | import charm.core.crypto.cryptobase 2 | from charm.toolbox.pairinggroup import * 3 | from charm.toolbox.secretutil import SecretUtil 4 | from charm.toolbox.ABEnc import * 5 | import time 6 | 7 | class CHAMELEON(ABEnc): 8 | def __init__(self, groupObj, verbose = False): 9 | ABEnc.__init__(self) 10 | global util, group 11 | group = groupObj 12 | util = SecretUtil(group, verbose) 13 | self.k = 10 14 | self.index_i = 5 15 | self.index_j = 5 16 | 17 | def setup(self): 18 | # g, u, v, w, h 19 | # G2 --> H, G1 --> G 20 | h = group.random(G2) 21 | g, u, v, w = group.random(G1), group.random(G1), group.random(G1), group.random(G1) 22 | # alpha, beta, theta, e(g, g)^alpha 23 | alpha = group.random(ZR) 24 | beta = group.random(ZR) 25 | theta = group.random(ZR) 26 | egg = pair(g,h)**alpha 27 | # z_1,z_2......z_k, {g_1, g_2,....g_k}, and {h_1, h_2,....h_k} 28 | # {g1^alpha, g2^alpha,...gk^alpha}, and {h1^alpha, h2^alpha,...hk^alpha} 29 | # z = [] 30 | vector_g, vector_h, vector_g_alpha, vector_h_alpha = [], [], [], [] 31 | for i in range(self.k): 32 | tmp = group.random(ZR) 33 | vector_g.append(g**tmp) 34 | vector_h.append(h**tmp) 35 | vector_g_alpha.append(vector_g[i]**alpha) 36 | vector_h_alpha.append(vector_h[i]**alpha) 37 | # g^beta, h^1/alpha, h^beta/alpha, egg^theta/alpha 38 | g_beta = g**beta 39 | h_1_alpha = h**(1/alpha) 40 | h_beta_alpha = h**(beta/alpha) 41 | egg_theta_alpha = egg**(theta/alpha) 42 | # mpk 43 | mpk = {'g':g, 'u':u, 'v':v, 'w':w, 'h':h, 'egg':egg, 'vector_g_alpha': vector_g_alpha, 'vector_h_alpha': vector_h_alpha, 'g_beta': g_beta, 'h_1_alpha': h_1_alpha, 'h_beta_alpha': h_beta_alpha, 'egg_theta_alpha': egg_theta_alpha} 44 | # msk 45 | msk = {'alpha':alpha, 'beta':beta, 'theta': theta} 46 | return (mpk, msk) 47 | 48 | 49 | 50 | def keygen(self, mpk, msk, policy_str): 51 | # print(time.time()) 52 | # the secret alpha will be shared according to the policy 53 | policy = util.createPolicy(policy_str) 54 | # retrieve the attributes that occur in a policy tree in order (left to right) 55 | # print(time.time()) 56 | a_list = util.getAttributeList(policy) 57 | # compute vector lambda 58 | # print(time.time()) 59 | shares = util.calculateSharesDict(msk['alpha'], policy) 60 | # compute K{}, [t_1,t_2,....t_n], [r_1,r_2, .....r_n] 61 | SK1, SK2, SK3 = {}, {}, {} 62 | t = [] 63 | r = [] 64 | for i in a_list: 65 | t_i = group.random(ZR) 66 | r_i = group.random(ZR) 67 | # remove index, only return attribute name 68 | inti = int(util.strip_index(i)) #NOTICE THE CONVERSION FROM STRING TO INT 69 | # compute K_(Tau,0) 70 | SK1[i] = mpk['g']**shares[i] * mpk['w']**t_i 71 | # compute K_(Tau,1) 72 | rho_i = group.init(ZR, inti) 73 | SK2[i] = (mpk['u']**rho_i * mpk['v'])**(-t_i) 74 | # compute K_(Tau,2) 75 | SK3[i] = mpk['h']**t_i 76 | t.append(t_i) 77 | r.append(r_i) 78 | # print(time.time()) 79 | # sk_0 80 | sk_0 = {} 81 | sum_t, sum_r = sum(t), sum(r) 82 | ttt = 0 83 | for i in t: 84 | ttt += i 85 | sum_t = group.init(ZR, sum_t) 86 | sum_r = group.init(ZR, sum_r) 87 | g_t_alpha = mpk['g']**(sum_t/msk['alpha']) 88 | g_r = mpk['g']**sum_r 89 | sk_0['g_t_alpha'] = g_t_alpha 90 | sk_0['g_r'] = g_r 91 | # sk_1 92 | I = [] 93 | vector_i = 1 94 | for i in range(self.index_i): 95 | tmp = group.random(ZR) 96 | vector_i *= mpk['vector_g_alpha'][self.k-1-i]**tmp 97 | I.append(tmp) 98 | vector_i *= mpk['g'] 99 | sk_1 = mpk['g']**msk['theta'] * vector_i**sum_t * mpk['g']**(msk['beta']*sum_r) 100 | # print(time.time()) 101 | return {'Policy':policy_str, 'SK1':SK1, 'SK2':SK2, 'SK3':SK3, 'sk_0': sk_0, 'sk_1': sk_1} 102 | 103 | def helper_gen_ciphertext(self, mpk, msk, R, attri_list): 104 | s = group.random(ZR) 105 | wS = mpk['w']**(-s) 106 | h, alpha, beta = mpk['h'], msk['alpha'], msk['beta'] 107 | # compute C{} 108 | CT1, CT2 = {}, {} 109 | r = [] 110 | for i in attri_list: 111 | tmp = group.random(ZR) 112 | # compute C_(Tau,0) 113 | CT1[i] = h**tmp 114 | # compute C_(Tau,1) 115 | A_T = group.init(ZR, int(i)) 116 | CT2[i] = (mpk['u']**A_T * mpk['v'])**tmp * wS 117 | # ct 118 | input_for_hash = str(mpk['egg']**s) + str(pair(mpk['g'],h)**(msk['theta'] * s / alpha)) 119 | hashed_value = group.hash(input_for_hash, ZR) 120 | _ct = int(R) ^ int(hashed_value) 121 | ct = group.init(ZR, int(_ct)) 122 | # ct_0 123 | ct_0 ={} 124 | ct_0['h_s'] = h**s 125 | ct_0['h_s_alpha'] = h**(s/alpha) 126 | ct_0['h_beta_s_alpha'] = h**(beta*s/alpha) 127 | # ct_1 128 | I = [] 129 | vector_j = 1 130 | for j in range(self.index_j): 131 | tmp = group.random(ZR) 132 | vector_j *= mpk['vector_h_alpha'][self.k-1-j]**tmp 133 | I.append(tmp) 134 | vector_j *= h 135 | ct_1 = vector_j**s 136 | # compute C{} 137 | return {'attri_list':attri_list, 'ct':ct, 'CT1':CT1, 'CT2':CT2, 'ct_0':ct_0, 'ct_1':ct_1} 138 | 139 | def generate_chameleon_hash(self, mpk, _message): 140 | # step 1 141 | print('test:', _message) 142 | message = group.init(ZR, int(_message)) 143 | g = mpk['g'] 144 | random_r = group.random(ZR) 145 | R = group.random(ZR) 146 | # print('native R', R) 147 | e = group.hash(str(R), ZR) 148 | p_prime = g**e 149 | b = g**message * p_prime**random_r 150 | res = {} 151 | res['_message'] = _message 152 | res['b'] = b 153 | return res 154 | 155 | def hash(self, mpk, msk, message, attri_list): 156 | # step 1 157 | g = mpk['g'] 158 | random_r = group.random(ZR) 159 | R = group.random(ZR) 160 | # print('native R', R) 161 | e = group.hash(str(R), ZR) 162 | p_prime = g**e 163 | b = g**message * p_prime**random_r 164 | 165 | # step 2 166 | C = self.helper_gen_ciphertext(mpk, msk, R, attri_list) 167 | 168 | # step 3 169 | keypair_sk = group.random(ZR) 170 | keypair_pk = g**keypair_sk 171 | esk = group.random(ZR) 172 | epk = g**esk 173 | c = g**(keypair_sk + R) 174 | sigma = esk + keypair_sk * group.hash((str(epk)+str(c)), ZR) 175 | 176 | return {'message':message, 'p_prime':p_prime, 'b':b, 'random_r':random_r, 'C':C, 'c':c, 'epk':epk, 'sigma': sigma, 'keypair_pk':keypair_pk} 177 | 178 | def verify(self, mpk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk): 179 | g = mpk['g'] 180 | g_message_p_prime_r = g**message * p_prime**random_r 181 | epk_pk = epk * keypair_pk**group.hash(str(epk)+str(c), ZR) 182 | # print(b, g_message_p_prime_r) 183 | # print(g**sigma, epk_pk) 184 | return (b == g_message_p_prime_r) and (g**sigma == epk_pk) 185 | 186 | 187 | # def decrypt(self, mpk, sk, ct, message): 188 | def adapt(self, mpk, msk, sk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk): 189 | # step 1 190 | res = self.verify(mpk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk) 191 | # print(res) 192 | 193 | # step 2 194 | policy = util.createPolicy(sk['Policy']) # Convert a Boolean formula represented as a string into a policy represented like a tree 195 | # compute w_i 196 | w = util.getCoefficients(policy) # Given a policy, returns a coefficient for every attribute 197 | pruned_list = util.prune(policy, C['attri_list']) # determine whether a given set of attributes satisfies the policy 198 | # print(pruned_list) 199 | if (pruned_list == False): 200 | return group.init(GT,1) 201 | # compute B 202 | B = 1 203 | for j in range(0, len(pruned_list)): 204 | # compute Tau, which is the index of attribute Gamma(i) in attri_list 205 | Tau = pruned_list[j].getAttribute( ) #without the underscore 206 | # compute i, I={i: rho(i) in attri_list} 207 | i = pruned_list[j].getAttributeAndIndex( ) #with the underscore 208 | # compute B 209 | B *= (pair(sk['SK1'][i], C['ct_0']['h_s']) * pair(sk['SK2'][i], C['CT1'][i]) * pair(C['CT2'][i], sk['SK3'][i])) ** w[i] 210 | # A 211 | numerator = pair(sk['sk_1'], C['ct_0']['h_s_alpha']) 212 | denominator = pair(sk['sk_0']['g_t_alpha'], C['ct_1']) * pair(sk['sk_0']['g_r'], C['ct_0']['h_beta_s_alpha']) 213 | A = numerator / denominator 214 | # decrypt R 215 | input_for_hash = str(B) + str(A) 216 | hashed_value = group.hash(input_for_hash, ZR) 217 | _R = int(C['ct']) ^ int(hashed_value) 218 | R = group.init(ZR, int(_R)) 219 | # print('decrypted R', R) 220 | 221 | # step 3 222 | e = group.hash(str(R), ZR) 223 | message_prime = group.random(ZR) 224 | random_r_prime = random_r + (message - message_prime) / e 225 | 226 | # step 4 227 | C_prime = self.helper_gen_ciphertext(mpk, msk, R, C['attri_list']) 228 | 229 | # step 5 230 | keypair_sk_prime = group.random(ZR) 231 | keypair_pk_prime = mpk['g']**keypair_sk_prime 232 | esk_prime = group.random(ZR) 233 | epk_prime = mpk['g']**esk_prime 234 | c_prime = mpk['g']**(keypair_sk_prime + R) 235 | sigma_prime = esk_prime + keypair_sk_prime * group.hash((str(epk_prime)+str(c_prime)), ZR) 236 | 237 | res_prime = self.verify(mpk, message_prime, p_prime, b, random_r_prime, C_prime, c_prime, epk_prime, sigma_prime, keypair_pk_prime) 238 | print(res_prime) 239 | # step 6 240 | return {'message_prime':message_prime, 'p_prime':p_prime, 'b':b, 'random_r_prime':random_r_prime, 'C_prime':C_prime, 'c_prime':c_prime, 'epk_prime': epk_prime, 'sigma_prime': sigma_prime, 'res_prime':res_prime} 241 | -------------------------------------------------------------------------------- /scheme.py: -------------------------------------------------------------------------------- 1 | import charm.core.crypto.cryptobase 2 | from charm.toolbox.pairinggroup import * 3 | from charm.toolbox.secretutil import SecretUtil 4 | from charm.toolbox.ABEnc import * 5 | import time 6 | 7 | class SCHEME(ABEnc): 8 | def __init__(self, groupObj, verbose = False): 9 | ABEnc.__init__(self) 10 | global util, group 11 | group = groupObj 12 | util = SecretUtil(group, verbose) 13 | self.k = 10 14 | self.index_i = 5 15 | self.index_j = 5 16 | 17 | def setup(self): 18 | print("================================Setup()======================================") 19 | # g, u, v, w, h 20 | # G2 --> H, G1 --> G 21 | h = group.random(G2) 22 | g, u, v, w = group.random(G1), group.random(G1), group.random(G1), group.random(G1) 23 | # alpha, beta, theta, e(g, g)^alpha 24 | alpha = group.random(ZR) 25 | beta = group.random(ZR) 26 | theta = group.random(ZR) 27 | egg = pair(g,h)**alpha 28 | # z_1,z_2......z_k, {g_1, g_2,....g_k}, and {h_1, h_2,....h_k} 29 | # {g1^alpha, g2^alpha,...gk^alpha}, and {h1^alpha, h2^alpha,...hk^alpha} 30 | # z = [] 31 | vector_g, vector_h, vector_g_alpha, vector_h_alpha = [], [], [], [] 32 | for i in range(self.k): 33 | tmp = group.random(ZR) 34 | vector_g.append(g**tmp) 35 | vector_h.append(h**tmp) 36 | vector_g_alpha.append(vector_g[i]**alpha) 37 | vector_h_alpha.append(vector_h[i]**alpha) 38 | # g^beta, h^1/alpha, h^beta/alpha, egg^theta/alpha 39 | g_beta = g**beta 40 | h_1_alpha = h**(1/alpha) 41 | h_beta_alpha = h**(beta/alpha) 42 | egg_theta_alpha = egg**(theta/alpha) 43 | # mpk 44 | mpk = {'g':g, 'u':u, 'v':v, 'w':w, 'h':h, 'egg':egg, 'vector_g_alpha': vector_g_alpha, 'vector_h_alpha': vector_h_alpha, 'g_beta': g_beta, 'h_1_alpha': h_1_alpha, 'h_beta_alpha': h_beta_alpha, 'egg_theta_alpha': egg_theta_alpha} 45 | # msk 46 | msk = {'alpha':alpha, 'beta':beta, 'theta': theta} 47 | print("\nmpk:\n", mpk) 48 | print("\n\nmsk:\n", msk) 49 | return (mpk, msk) 50 | 51 | 52 | 53 | def keygen(self, mpk, msk, policy_str): 54 | print("\n\n\n================================KeyGen()======================================") 55 | # the secret alpha will be shared according to the policy 56 | policy = util.createPolicy(policy_str) 57 | # retrieve the attributes that occur in a policy tree in order (left to right) 58 | # print(time.time()) 59 | a_list = util.getAttributeList(policy) 60 | # compute vector lambda 61 | # print(time.time()) 62 | shares = util.calculateSharesDict(msk['alpha'], policy) 63 | # compute K{}, [t_1,t_2,....t_n], [r_1,r_2, .....r_n] 64 | SK1, SK2, SK3 = {}, {}, {} 65 | t = [] 66 | r = [] 67 | for i in a_list: 68 | t_i = group.random(ZR) 69 | r_i = group.random(ZR) 70 | # remove index, only return attribute name 71 | inti = int(util.strip_index(i)) #NOTICE THE CONVERSION FROM STRING TO INT 72 | # compute K_(Tau,0) 73 | SK1[i] = mpk['g']**shares[i] * mpk['w']**t_i 74 | # compute K_(Tau,1) 75 | rho_i = group.init(ZR, inti) 76 | SK2[i] = (mpk['u']**rho_i * mpk['v'])**(-t_i) 77 | # compute K_(Tau,2) 78 | SK3[i] = mpk['h']**t_i 79 | t.append(t_i) 80 | r.append(r_i) 81 | # print(time.time()) 82 | # sk_0 83 | sk_0 = {} 84 | sum_t, sum_r = sum(t), sum(r) 85 | ttt = 0 86 | for i in t: 87 | ttt += i 88 | sum_t = group.init(ZR, sum_t) 89 | sum_r = group.init(ZR, sum_r) 90 | g_t_alpha = mpk['g']**(sum_t/msk['alpha']) 91 | g_r = mpk['g']**sum_r 92 | sk_0['g_t_alpha'] = g_t_alpha 93 | sk_0['g_r'] = g_r 94 | # sk_1 95 | I = [] 96 | vector_i = 1 97 | for i in range(self.index_i): 98 | tmp = group.random(ZR) 99 | vector_i *= mpk['vector_g_alpha'][self.k-1-i]**tmp 100 | I.append(tmp) 101 | vector_i *= mpk['g'] 102 | sk_1 = mpk['g']**msk['theta'] * vector_i**sum_t * mpk['g']**(msk['beta']*sum_r) 103 | print("\n sk:\n", {'Policy':policy_str, 'SK1':SK1, 'SK2':SK2, 'SK3':SK3, 'sk_0': sk_0, 'sk_1': sk_1}) 104 | return {'Policy':policy_str, 'SK1':SK1, 'SK2':SK2, 'SK3':SK3, 'sk_0': sk_0, 'sk_1': sk_1} 105 | 106 | def helper_gen_ciphertext(self, mpk, msk, R, attri_list): 107 | s = group.random(ZR) 108 | wS = mpk['w']**(-s) 109 | h, alpha, beta = mpk['h'], msk['alpha'], msk['beta'] 110 | # compute C{} 111 | CT1, CT2 = {}, {} 112 | r = [] 113 | for i in attri_list: 114 | tmp = group.random(ZR) 115 | # compute C_(Tau,0) 116 | CT1[i] = h**tmp 117 | # compute C_(Tau,1) 118 | A_T = group.init(ZR, int(i)) 119 | CT2[i] = (mpk['u']**A_T * mpk['v'])**tmp * wS 120 | # ct 121 | input_for_hash = str(mpk['egg']**s) + str(pair(mpk['g'],h)**(msk['theta'] * s / alpha)) 122 | hashed_value = group.hash(input_for_hash, ZR) 123 | _ct = int(R) ^ int(hashed_value) 124 | ct = group.init(ZR, int(_ct)) 125 | # ct_0 126 | ct_0 ={} 127 | ct_0['h_s'] = h**s 128 | ct_0['h_s_alpha'] = h**(s/alpha) 129 | ct_0['h_beta_s_alpha'] = h**(beta*s/alpha) 130 | # ct_1 131 | I = [] 132 | vector_j = 1 133 | for j in range(self.index_j): 134 | tmp = group.random(ZR) 135 | vector_j *= mpk['vector_h_alpha'][self.k-1-j]**tmp 136 | I.append(tmp) 137 | vector_j *= h 138 | ct_1 = vector_j**s 139 | # compute C{} 140 | return {'attri_list':attri_list, 'ct':ct, 'CT1':CT1, 'CT2':CT2, 'ct_0':ct_0, 'ct_1':ct_1} 141 | 142 | def hash(self, mpk, msk, message, attri_list): 143 | print("\n\n\n================================Hash()======================================") 144 | # step 1 145 | g = mpk['g'] 146 | random_r = group.random(ZR) 147 | R = group.random(ZR) 148 | e = group.hash(str(R), ZR) 149 | p_prime = g**e 150 | b = g**message * p_prime**random_r 151 | 152 | # step 2 153 | C = self.helper_gen_ciphertext(mpk, msk, R, attri_list) 154 | 155 | # step 3 156 | keypair_sk = group.random(ZR) 157 | keypair_pk = g**keypair_sk 158 | esk = group.random(ZR) 159 | epk = g**esk 160 | c = g**(keypair_sk + R) 161 | sigma = esk + keypair_sk * group.hash((str(epk)+str(c)), ZR) 162 | # (m, p′, b, r, C, c, epk, σ). 163 | print("\n output:\n", {'message':message, 'p_prime':p_prime, 'b':b, 'random_r':random_r, 'C':C, 'c':c, 'epk':epk, 'sigma': sigma, 'keypair_pk':keypair_pk}) 164 | return {'message':message, 'p_prime':p_prime, 'b':b, 'random_r':random_r, 'C':C, 'c':c, 'epk':epk, 'sigma': sigma, 'keypair_pk':keypair_pk} 165 | 166 | def verify(self, mpk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk): 167 | g = mpk['g'] 168 | g_message_p_prime_r = g**message * p_prime**random_r 169 | epk_pk = epk * keypair_pk**group.hash(str(epk)+str(c), ZR) 170 | print("\nVerify() result:\n", (b == g_message_p_prime_r) and (g**sigma == epk_pk)) 171 | return (b == g_message_p_prime_r) and (g**sigma == epk_pk) 172 | 173 | # def decrypt(self, mpk, sk, ct, message): 174 | def adapt(self, mpk, msk, sk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk): 175 | print("\n\n\n================================Adapt()======================================") 176 | # step 1 177 | res = self.verify(mpk, message, p_prime, b, random_r, C, c, epk, sigma, keypair_pk) 178 | 179 | # step 2 180 | policy = util.createPolicy(sk['Policy']) # Convert a Boolean formula represented as a string into a policy represented like a tree 181 | # compute w_i 182 | w = util.getCoefficients(policy) # Given a policy, returns a coefficient for every attribute 183 | pruned_list = util.prune(policy, C['attri_list']) # determine whether a given set of attributes satisfies the policy 184 | if (pruned_list == False): 185 | return group.init(GT,1) 186 | # compute B 187 | B = 1 188 | for j in range(0, len(pruned_list)): 189 | # compute Tau, which is the index of attribute Gamma(i) in attri_list 190 | Tau = pruned_list[j].getAttribute( ) #without the underscore 191 | # compute i, I={i: rho(i) in attri_list} 192 | i = pruned_list[j].getAttributeAndIndex( ) #with the underscore 193 | # compute B 194 | B *= (pair(sk['SK1'][i], C['ct_0']['h_s']) * pair(sk['SK2'][i], C['CT1'][i]) * pair(C['CT2'][i], sk['SK3'][i])) ** w[i] 195 | # A 196 | numerator = pair(sk['sk_1'], C['ct_0']['h_s_alpha']) 197 | denominator = pair(sk['sk_0']['g_t_alpha'], C['ct_1']) * pair(sk['sk_0']['g_r'], C['ct_0']['h_beta_s_alpha']) 198 | A = numerator / denominator 199 | # decrypt R 200 | input_for_hash = str(B) + str(A) 201 | hashed_value = group.hash(input_for_hash, ZR) 202 | _R = int(C['ct']) ^ int(hashed_value) 203 | R = group.init(ZR, int(_R)) 204 | 205 | # step 3 206 | e = group.hash(str(R), ZR) 207 | message_prime = group.random(ZR) 208 | random_r_prime = random_r + (message - message_prime) / e 209 | 210 | # step 4 211 | C_prime = self.helper_gen_ciphertext(mpk, msk, R, C['attri_list']) 212 | 213 | # step 5 214 | keypair_sk_prime = group.random(ZR) 215 | keypair_pk_prime = mpk['g']**keypair_sk_prime 216 | esk_prime = group.random(ZR) 217 | epk_prime = mpk['g']**esk_prime 218 | c_prime = mpk['g']**(keypair_sk_prime + R) 219 | sigma_prime = esk_prime + keypair_sk_prime * group.hash((str(epk_prime)+str(c_prime)), ZR) 220 | 221 | res_prime = self.verify(mpk, message_prime, p_prime, b, random_r_prime, C_prime, c_prime, epk_prime, sigma_prime, keypair_pk_prime) 222 | # print(res_prime) 223 | # step 6 224 | # (m′, p′, b, r′, C′, c′, epk′, σ′). 225 | print("\n\n\nAdapt() output:\n", {'message_prime':message_prime, 'p_prime':p_prime, 'b':b, 'random_r_prime':random_r_prime, 'C_prime':C_prime, 'c_prime':c_prime, 'epk_prime': epk_prime, 'sigma_prime': sigma_prime}) 226 | return {'message_prime':message_prime, 'p_prime':p_prime, 'b':b, 'random_r_prime':random_r_prime, 'C_prime':C_prime, 'c_prime':c_prime, 'epk_prime': epk_prime, 'sigma_prime': sigma_prime} 227 | -------------------------------------------------------------------------------- /blockchain/node_server_cp.py: -------------------------------------------------------------------------------- 1 | from hashlib import sha256 2 | import json 3 | import time 4 | 5 | from flask import Flask, request 6 | import requests 7 | 8 | 9 | class Block: 10 | def __init__(self, index, transactions, timestamp, previous_hash, tx_index, nonce=0): 11 | self.index = index 12 | self.transactions = transactions 13 | self.timestamp = timestamp 14 | self.previous_hash = previous_hash 15 | self.nonce = nonce 16 | self.tx_index = tx_index 17 | 18 | def compute_hash(self): 19 | """ 20 | A function that return the hash of the block contents. 21 | """ 22 | block_string = json.dumps(self.__dict__, sort_keys=True) 23 | return sha256(block_string.encode()).hexdigest() 24 | 25 | 26 | class Blockchain: 27 | # difficulty of our PoW algorithm 28 | difficulty = 2 29 | 30 | def __init__(self): 31 | self.unconfirmed_transactions = [] 32 | self.chain = [] 33 | 34 | def create_genesis_block(self): 35 | """ 36 | A function to generate genesis block and appends it to 37 | the chain. The block has index 0, previous_hash as 0, and 38 | a valid hash. 39 | """ 40 | genesis_block = Block(0, [], 0, "0") 41 | genesis_block.hash = genesis_block.compute_hash() 42 | self.chain.append(genesis_block) 43 | 44 | @property 45 | def last_block(self): 46 | return self.chain[-1] 47 | 48 | def add_block(self, block, proof): 49 | """ 50 | A function that adds the block to the chain after verification. 51 | Verification includes: 52 | * Checking if the proof is valid. 53 | * The previous_hash referred in the block and the hash of latest block 54 | in the chain match. 55 | """ 56 | previous_hash = self.last_block.hash 57 | 58 | if previous_hash != block.previous_hash: 59 | return False 60 | 61 | if not Blockchain.is_valid_proof(block, proof): 62 | return False 63 | 64 | block.hash = proof 65 | self.chain.append(block) 66 | test = {'index':block.index, 'transactions':block.transactions, 'timestamp':block.timestamp, 'previous_hash':block.previous_hash, 'nonce': block.nonce, 'hash':block.hash} 67 | # test_json = json.dumps(test) 68 | file_name = './block_data/block_' + str(block.index) + '.json' 69 | with open(file_name, 'w') as outfile: 70 | json.dump(test, outfile) 71 | return True 72 | 73 | new_block = Block(index=last_block.index + 1, 74 | transactions=self.unconfirmed_transactions, 75 | timestamp=time.time(), 76 | previous_hash=last_block.hash) 77 | 78 | @staticmethod 79 | def proof_of_work(block): 80 | """ 81 | Function that tries different values of nonce to get a hash 82 | that satisfies our difficulty criteria. 83 | """ 84 | block.nonce = 0 85 | 86 | computed_hash = block.compute_hash() 87 | while not computed_hash.startswith('0' * Blockchain.difficulty): 88 | block.nonce += 1 89 | computed_hash = block.compute_hash() 90 | 91 | return computed_hash 92 | 93 | def add_new_transaction(self, transaction): 94 | self.unconfirmed_transactions.append(transaction) 95 | 96 | @classmethod 97 | def is_valid_proof(cls, block, block_hash): 98 | """ 99 | Check if block_hash is valid hash of block and satisfies 100 | the difficulty criteria. 101 | """ 102 | return (block_hash.startswith('0' * Blockchain.difficulty) and 103 | block_hash == block.compute_hash()) 104 | 105 | @classmethod 106 | def check_chain_validity(cls, chain): 107 | result = True 108 | previous_hash = "0" 109 | 110 | for block in chain: 111 | block_hash = block.hash 112 | # remove the hash field to recompute the hash again 113 | # using `compute_hash` method. 114 | delattr(block, "hash") 115 | 116 | if not cls.is_valid_proof(block, block_hash) or \ 117 | previous_hash != block.previous_hash: 118 | result = False 119 | break 120 | 121 | block.hash, previous_hash = block_hash, block_hash 122 | 123 | return result 124 | 125 | def mine(self): 126 | """ 127 | This function serves as an interface to add the pending 128 | transactions to the blockchain by adding them to the block 129 | and figuring out Proof Of Work. 130 | """ 131 | if not self.unconfirmed_transactions: 132 | return False 133 | 134 | last_block = self.last_block 135 | 136 | new_block = Block(index=last_block.index + 1, 137 | transactions=self.unconfirmed_transactions, 138 | timestamp=time.time(), 139 | previous_hash=last_block.hash) 140 | 141 | 142 | proof = self.proof_of_work(new_block) 143 | self.add_block(new_block, proof) 144 | 145 | self.unconfirmed_transactions = [] 146 | 147 | return True 148 | 149 | 150 | app = Flask(__name__) 151 | 152 | # the node's copy of blockchain 153 | blockchain = Blockchain() 154 | blockchain.create_genesis_block() 155 | 156 | # the address to other participating members of the network 157 | peers = set() 158 | 159 | 160 | # endpoint to submit a new transaction. This will be used by 161 | # our application to add new data (posts) to the blockchain 162 | @app.route('/new_transaction', methods=['POST']) 163 | def new_transaction(): 164 | tx_data = request.get_json() 165 | required_fields = ["author", "content", "tx_hash"] 166 | 167 | for field in required_fields: 168 | if not tx_data.get(field): 169 | return "Invalid transaction data", 404 170 | 171 | tx_data["timestamp"] = time.time() 172 | 173 | blockchain.add_new_transaction(tx_data) 174 | 175 | return "Success", 201 176 | 177 | 178 | # endpoint to return the node's copy of the chain. 179 | # Our application will be using this endpoint to query 180 | # all the posts to display. 181 | @app.route('/chain', methods=['GET']) 182 | def get_chain(): 183 | chain_data = [] 184 | for block in blockchain.chain: 185 | chain_data.append(block.__dict__) 186 | return json.dumps({"length": len(chain_data), 187 | "chain": chain_data, 188 | "peers": list(peers)}) 189 | 190 | 191 | # endpoint to request the node to mine the unconfirmed 192 | # transactions (if any). We'll be using it to initiate 193 | # a command to mine from our application itself. 194 | @app.route('/mine', methods=['GET']) 195 | def mine_unconfirmed_transactions(): 196 | result = blockchain.mine() 197 | if not result: 198 | return "No transactions to mine" 199 | else: 200 | # Making sure we have the longest chain before announcing to the network 201 | chain_length = len(blockchain.chain) 202 | consensus() 203 | if chain_length == len(blockchain.chain): 204 | # announce the recently mined block to the network 205 | announce_new_block(blockchain.last_block) 206 | return "Block #{} is mined.".format(blockchain.last_block.index) 207 | 208 | 209 | # endpoint to add new peers to the network. 210 | @app.route('/register_node', methods=['POST']) 211 | def register_new_peers(): 212 | node_address = request.get_json()["node_address"] 213 | if not node_address: 214 | return "Invalid data", 400 215 | 216 | # Add the node to the peer list 217 | peers.add(node_address) 218 | 219 | # Return the consensus blockchain to the newly registered node 220 | # so that he can sync 221 | return get_chain() 222 | 223 | 224 | @app.route('/register_with', methods=['POST']) 225 | def register_with_existing_node(): 226 | """ 227 | Internally calls the `register_node` endpoint to 228 | register current node with the node specified in the 229 | request, and sync the blockchain as well as peer data. 230 | """ 231 | node_address = request.get_json()["node_address"] 232 | if not node_address: 233 | return "Invalid data", 400 234 | 235 | data = {"node_address": request.host_url} 236 | headers = {'Content-Type': "application/json"} 237 | 238 | # Make a request to register with remote node and obtain information 239 | response = requests.post(node_address + "/register_node", 240 | data=json.dumps(data), headers=headers) 241 | 242 | if response.status_code == 200: 243 | global blockchain 244 | global peers 245 | # update chain and the peers 246 | chain_dump = response.json()['chain'] 247 | blockchain = create_chain_from_dump(chain_dump) 248 | peers.update(response.json()['peers']) 249 | return "Registration successful", 200 250 | else: 251 | # if something goes wrong, pass it on to the API response 252 | return response.content, response.status_code 253 | 254 | 255 | def create_chain_from_dump(chain_dump): 256 | generated_blockchain = Blockchain() 257 | generated_blockchain.create_genesis_block() 258 | for idx, block_data in enumerate(chain_dump): 259 | if idx == 0: 260 | continue # skip genesis block 261 | block = Block(block_data["index"], 262 | block_data["transactions"], 263 | block_data["timestamp"], 264 | block_data["previous_hash"], 265 | block_data["nonce"]) 266 | proof = block_data['hash'] 267 | added = generated_blockchain.add_block(block, proof) 268 | if not added: 269 | raise Exception("The chain dump is tampered!!") 270 | return generated_blockchain 271 | 272 | 273 | # endpoint to add a block mined by someone else to 274 | # the node's chain. The block is first verified by the node 275 | # and then added to the chain. 276 | @app.route('/add_block', methods=['POST']) 277 | def verify_and_add_block(): 278 | block_data = request.get_json() 279 | block = Block(block_data["index"], 280 | block_data["transactions"], 281 | block_data["timestamp"], 282 | block_data["previous_hash"], 283 | block_data["nonce"]) 284 | 285 | proof = block_data['hash'] 286 | added = blockchain.add_block(block, proof) 287 | 288 | if not added: 289 | return "The block was discarded by the node", 400 290 | 291 | return "Block added to the chain", 201 292 | 293 | 294 | # endpoint to query unconfirmed transactions 295 | @app.route('/pending_tx') 296 | def get_pending_tx(): 297 | return json.dumps(blockchain.unconfirmed_transactions) 298 | 299 | 300 | def consensus(): 301 | """ 302 | Our naive consnsus algorithm. If a longer valid chain is 303 | found, our chain is replaced with it. 304 | """ 305 | global blockchain 306 | 307 | longest_chain = None 308 | current_len = len(blockchain.chain) 309 | 310 | for node in peers: 311 | response = requests.get('{}chain'.format(node)) 312 | length = response.json()['length'] 313 | chain = response.json()['chain'] 314 | if length > current_len and blockchain.check_chain_validity(chain): 315 | current_len = length 316 | longest_chain = chain 317 | 318 | if longest_chain: 319 | blockchain = longest_chain 320 | return True 321 | 322 | return False 323 | 324 | 325 | def announce_new_block(block): 326 | """ 327 | A function to announce to the network once a block has been mined. 328 | Other blocks can simply verify the proof of work and add it to their 329 | respective chains. 330 | """ 331 | for peer in peers: 332 | url = "{}add_block".format(peer) 333 | headers = {'Content-Type': "application/json"} 334 | requests.post(url, 335 | data=json.dumps(block.__dict__, sort_keys=True), 336 | headers=headers) 337 | 338 | # Uncomment this line if you want to specify the port number in the code 339 | #app.run(debug=True, port=8000) -------------------------------------------------------------------------------- /blockchain/node_server.py: -------------------------------------------------------------------------------- 1 | from hashlib import sha256 2 | import json 3 | import time 4 | 5 | from flask import Flask, request 6 | import requests 7 | from merklelib import MerkleTree, beautify, export 8 | from merkle import hashfunc, defaulthash 9 | 10 | class Block: 11 | # def __init__(self, index, transactions, timestamp, previous_hash, nonce=0): 12 | def __init__(self, index, transactions, previous_hash): 13 | self.index = index 14 | self.transactions = transactions 15 | # self.timestamp = timestamp 16 | self.previous_hash = previous_hash 17 | # self.nonce = nonce 18 | # self.tx_index = tx_index 19 | 20 | def compute_hash(self): 21 | """ 22 | A function that return the hash of the block contents. 23 | """ 24 | block_string = json.dumps(self.__dict__, sort_keys=True) 25 | return sha256(block_string.encode()).hexdigest() 26 | 27 | 28 | class Blockchain: 29 | # difficulty of our PoW algorithm 30 | difficulty = 2 31 | size = 1 32 | 33 | def __init__(self): 34 | self.unconfirmed_transactions = [] 35 | self.chain = [] 36 | 37 | def create_genesis_block(self): 38 | """ 39 | A function to generate genesis block and appends it to 40 | the chain. The block has index 0, previous_hash as 0, and 41 | a valid hash. 42 | """ 43 | # genesis_block = Block(0, [], 0, "0") 44 | genesis_block = Block(0, [], "0") 45 | genesis_block.hash = genesis_block.compute_hash() 46 | self.chain.append(genesis_block) 47 | 48 | @property 49 | def last_block(self): 50 | return self.chain[-1] 51 | 52 | def add_block(self, block, proof): 53 | """ 54 | A function that adds the block to the chain after verification. 55 | Verification includes: 56 | * Checking if the proof is valid. 57 | * The previous_hash referred in the block and the hash of latest block 58 | in the chain match. 59 | """ 60 | previous_hash = self.last_block.hash 61 | 62 | if previous_hash != block.previous_hash: 63 | return False 64 | 65 | if not Blockchain.is_valid_proof(block, proof): 66 | return False 67 | 68 | block.hash = proof 69 | self.chain.append(block) 70 | _transaction = [] 71 | transaction = [] 72 | _transaction.append(list(block.transactions)) 73 | transaction.append(_transaction) 74 | # write_content = {'index':block.index, 'transactions':self.unconfirmed_transactions, 'timestamp':block.timestamp, 'previous_hash':block.previous_hash, 'nonce': block.nonce, 'hash':block.hash} 75 | write_content = {'index':block.index, 'transactions':block.transactions, 'previous_hash':block.previous_hash, 'hash':block.hash} 76 | # test_json = json.dumps(test) 77 | file_name = './block_data/block_' + str(block.index) + '.json' 78 | with open(file_name, 'w') as outfile: 79 | json.dump(write_content, outfile) 80 | data = [] 81 | # data.append(self.unconfirmed_transactions[0]['content']) 82 | # data.append(hashfunc(self.unconfirmed_transactions[0]['content'])) 83 | data.append(block.transactions[0]['tx_hash']) 84 | tree = MerkleTree(data, defaulthash) 85 | path = './block_data/merkle_' + str(block.index) 86 | # export(tree, filename=path) 87 | return True 88 | 89 | 90 | @staticmethod 91 | def proof_of_work(block): 92 | """ 93 | Function that tries different values of nonce to get a hash 94 | that satisfies our difficulty criteria. 95 | """ 96 | block.nonce = 0 97 | 98 | computed_hash = block.compute_hash() 99 | while not computed_hash.startswith('0' * Blockchain.difficulty): 100 | block.nonce += 1 101 | computed_hash = block.compute_hash() 102 | 103 | return computed_hash 104 | 105 | def add_new_transaction(self, transaction): 106 | self.unconfirmed_transactions.append(transaction) 107 | 108 | @classmethod 109 | def is_valid_proof(cls, block, block_hash): 110 | """ 111 | Check if block_hash is valid hash of block and satisfies 112 | the difficulty criteria. 113 | """ 114 | return (block_hash.startswith('0' * Blockchain.difficulty) and 115 | block_hash == block.compute_hash()) 116 | 117 | @classmethod 118 | def check_chain_validity(cls, chain): 119 | result = True 120 | previous_hash = "0" 121 | 122 | for block in chain: 123 | block_hash = block.hash 124 | # remove the hash field to recompute the hash again 125 | # using `compute_hash` method. 126 | delattr(block, "hash") 127 | 128 | if not cls.is_valid_proof(block, block_hash) or \ 129 | previous_hash != block.previous_hash: 130 | result = False 131 | break 132 | 133 | block.hash, previous_hash = block_hash, block_hash 134 | 135 | return result 136 | 137 | # def hashfunc(self, value): 138 | # return hashlib.sha256(str(value).encode()).hexdigest() 139 | 140 | def mine(self): 141 | """ 142 | This function serves as an interface to add the pending 143 | transactions to the blockchain by adding them to the block 144 | and figuring out Proof Of Work. 145 | """ 146 | 147 | if not self.unconfirmed_transactions: 148 | return False 149 | last_block = self.last_block 150 | # print("last_block: ", last_block.index) 151 | # print("last_block transaction: ", last_block.transactions) 152 | new_mined = False 153 | 154 | for i in range(len(self.unconfirmed_transactions)): 155 | if len(last_block.transactions) < 100 and not new_mined: 156 | last_block.transactions.append(self.unconfirmed_transactions[i]) 157 | test = {'index':last_block.index, 'transactions':last_block.transactions, 'previous_hash':last_block.previous_hash, 'hash':last_block.hash} 158 | file_name = './block_data/block_' + str(last_block.index) + '.json' 159 | with open(file_name, 'w') as outfile: 160 | json.dump(test, outfile) 161 | data = [] 162 | for j in last_block.transactions: 163 | data.append(j['tx_hash']) 164 | tree = MerkleTree(data, defaulthash) 165 | path = './block_data/merkle_' + str(last_block.index) 166 | else: 167 | new_mined = True 168 | print('i:',i, 'unconfirme:', self.unconfirmed_transactions[i:]) 169 | new_block = Block(index=last_block.index + 1, 170 | transactions=self.unconfirmed_transactions[i:], 171 | # timestamp=time.time(), 172 | previous_hash=last_block.hash) 173 | proof = self.proof_of_work(new_block) 174 | self.add_block(new_block, proof) 175 | Blockchain.size += 1 176 | break 177 | print("current:", len(last_block.transactions)) 178 | 179 | 180 | # if Blockchain.size <= 2: 181 | # last_block.transactions.append(self.unconfirmed_transactions) 182 | # Blockchain.size += 1 183 | # # test = {'index':last_block.index, 'transactions':last_block.transactions, 'timestamp':last_block.timestamp, 'previous_hash':last_block.previous_hash, 'nonce': last_block.nonce, 'hash':last_block.hash} 184 | # test = {'index':last_block.index, 'transactions':last_block.transactions, 'previous_hash':last_block.previous_hash, 'hash':last_block.hash} 185 | # # test = {'index':last_block.transactions} 186 | # file_name = './block_data/block_' + str(last_block.index) + '.json' 187 | # with open(file_name, 'w') as outfile: 188 | # json.dump(test, outfile) 189 | # data = [] 190 | # for i in last_block.transactions: 191 | # # data.append(i[0]['content']) 192 | # # data.append(hashfunc(i[0]['content'])) 193 | # data.append(i[0]['tx_hash']) 194 | # tree = MerkleTree(data, defaulthash) 195 | # path = './block_data/merkle_' + str(last_block.index) 196 | # # export(tree, filename=path) 197 | # else: 198 | # Blockchain.size = 1 199 | # new_block = Block(index=last_block.index + 1, 200 | # transactions=[self.unconfirmed_transactions], 201 | # # timestamp=time.time(), 202 | # previous_hash=last_block.hash) 203 | 204 | 205 | # proof = self.proof_of_work(new_block) 206 | # self.add_block(new_block, proof) 207 | # Blockchain.size += 1 208 | 209 | self.unconfirmed_transactions = [] 210 | 211 | return True 212 | 213 | 214 | app = Flask(__name__) 215 | 216 | # the node's copy of blockchain 217 | blockchain = Blockchain() 218 | blockchain.create_genesis_block() 219 | 220 | # the address to other participating members of the network 221 | peers = set() 222 | 223 | 224 | # endpoint to submit a new transaction. This will be used by 225 | # our application to add new data (posts) to the blockchain 226 | @app.route('/new_transaction', methods=['POST']) 227 | def new_transaction(): 228 | tx_data = request.get_json() 229 | required_fields = ["author", "content", "tx_hash"] 230 | 231 | for field in required_fields: 232 | if not tx_data.get(field): 233 | return "Invalid transaction data", 404 234 | 235 | tx_data["timestamp"] = time.time() 236 | 237 | blockchain.add_new_transaction(tx_data) 238 | 239 | return "Success", 201 240 | 241 | 242 | # endpoint to return the node's copy of the chain. 243 | # Our application will be using this endpoint to query 244 | # all the posts to display. 245 | @app.route('/chain', methods=['GET']) 246 | def get_chain(): 247 | chain_data = [] 248 | for block in blockchain.chain: 249 | chain_data.append(block.__dict__) 250 | return json.dumps({"length": len(chain_data), 251 | "chain": chain_data, 252 | "peers": list(peers)}) 253 | 254 | 255 | # endpoint to request the node to mine the unconfirmed 256 | # transactions (if any). We'll be using it to initiate 257 | # a command to mine from our application itself. 258 | @app.route('/mine', methods=['GET']) 259 | def mine_unconfirmed_transactions(): 260 | result = blockchain.mine() 261 | if not result: 262 | return "No transactions to mine" 263 | else: 264 | # Making sure we have the longest chain before announcing to the network 265 | chain_length = len(blockchain.chain) 266 | consensus() 267 | if chain_length == len(blockchain.chain): 268 | # announce the recently mined block to the network 269 | announce_new_block(blockchain.last_block) 270 | return "Block #{} is mined.".format(blockchain.last_block.index) 271 | # return "Block #{} is mined.".format(blockchain.last_block.index) 272 | 273 | 274 | # endpoint to add new peers to the network. 275 | @app.route('/register_node', methods=['POST']) 276 | def register_new_peers(): 277 | node_address = request.get_json()["node_address"] 278 | if not node_address: 279 | return "Invalid data", 400 280 | 281 | # Add the node to the peer list 282 | peers.add(node_address) 283 | 284 | # Return the consensus blockchain to the newly registered node 285 | # so that he can sync 286 | return get_chain() 287 | 288 | 289 | @app.route('/register_with', methods=['POST']) 290 | def register_with_existing_node(): 291 | """ 292 | Internally calls the `register_node` endpoint to 293 | register current node with the node specified in the 294 | request, and sync the blockchain as well as peer data. 295 | """ 296 | node_address = request.get_json()["node_address"] 297 | if not node_address: 298 | return "Invalid data", 400 299 | 300 | data = {"node_address": request.host_url} 301 | headers = {'Content-Type': "application/json"} 302 | 303 | # Make a request to register with remote node and obtain information 304 | response = requests.post(node_address + "/register_node", 305 | data=json.dumps(data), headers=headers) 306 | 307 | if response.status_code == 200: 308 | global blockchain 309 | global peers 310 | # update chain and the peers 311 | chain_dump = response.json()['chain'] 312 | blockchain = create_chain_from_dump(chain_dump) 313 | peers.update(response.json()['peers']) 314 | return "Registration successful", 200 315 | else: 316 | # if something goes wrong, pass it on to the API response 317 | return response.content, response.status_code 318 | 319 | 320 | def create_chain_from_dump(chain_dump): 321 | generated_blockchain = Blockchain() 322 | generated_blockchain.create_genesis_block() 323 | for idx, block_data in enumerate(chain_dump): 324 | if idx == 0: 325 | continue # skip genesis block 326 | block = Block(block_data["index"], 327 | block_data["transactions"], 328 | # block_data["timestamp"], 329 | block_data["previous_hash"] 330 | # block_data["nonce"] 331 | ) 332 | proof = block_data['hash'] 333 | added = generated_blockchain.add_block(block, proof) 334 | if not added: 335 | raise Exception("The chain dump is tampered!!") 336 | return generated_blockchain 337 | 338 | 339 | # endpoint to add a block mined by someone else to 340 | # the node's chain. The block is first verified by the node 341 | # and then added to the chain. 342 | @app.route('/add_block', methods=['POST']) 343 | def verify_and_add_block(): 344 | block_data = request.get_json() 345 | block = Block(block_data["index"], 346 | block_data["transactions"], 347 | # block_data["timestamp"], 348 | block_data["previous_hash"] 349 | # block_data["nonce"] 350 | ) 351 | 352 | proof = block_data['hash'] 353 | added = blockchain.add_block(block, proof) 354 | 355 | if not added: 356 | return "The block was discarded by the node", 400 357 | 358 | return "Block added to the chain", 201 359 | 360 | 361 | # endpoint to query unconfirmed transactions 362 | @app.route('/pending_tx') 363 | def get_pending_tx(): 364 | return json.dumps(blockchain.unconfirmed_transactions) 365 | 366 | 367 | def consensus(): 368 | """ 369 | Our naive consnsus algorithm. If a longer valid chain is 370 | found, our chain is replaced with it. 371 | """ 372 | global blockchain 373 | 374 | longest_chain = None 375 | current_len = len(blockchain.chain) 376 | 377 | for node in peers: 378 | response = requests.get('{}chain'.format(node)) 379 | length = response.json()['length'] 380 | chain = response.json()['chain'] 381 | if length > current_len and blockchain.check_chain_validity(chain): 382 | current_len = length 383 | longest_chain = chain 384 | 385 | if longest_chain: 386 | blockchain = longest_chain 387 | return True 388 | 389 | return False 390 | 391 | 392 | def announce_new_block(block): 393 | """ 394 | A function to announce to the network once a block has been mined. 395 | Other blocks can simply verify the proof of work and add it to their 396 | respective chains. 397 | """ 398 | for peer in peers: 399 | url = "{}add_block".format(peer) 400 | headers = {'Content-Type': "application/json"} 401 | requests.post(url, 402 | data=json.dumps(block.__dict__, sort_keys=True), 403 | headers=headers) 404 | 405 | # Uncomment this line if you want to specify the port number in the code 406 | #app.run(debug=True, port=8000) 407 | -------------------------------------------------------------------------------- /ABET.txt: -------------------------------------------------------------------------------- 1 | ================================Setup()====================================== 2 | 3 | mpk: {'g': [9574085000809365781946159896820769440635435583895761701230655190015, 9669351153826886179906793154459393388820897823577650327863867013978], 'u': [9791702200447946067762561635306472232072504123743833332278145501433, 8960140575243503372008496699996157316747841214675659866114612438386], 'v': [2190905255982319112939233794016041272157382013267550991947038007056, 6939009777710788478706319248335291802523511196534887081739604394352], 'w': [8611654201097234539092836142742660558745887343747240991607739372105, 8931535199495588982476776010618876864872970623777279180534028922634], 'h': [[12931663371183394587815120071580376206523689509321227244767375441660, 13612268509023522212411285269788400237220032314461907858016297845686, 9125993285867382328758720298115448441758706438294281240431981628547], [8076662673247803599066963945194455375173791603037930132411517009616, 14689329217185194665296243966319056699218549679258933411088702795545, 2063071362146652092941855066762605721767104018142677572284815227291]], 'egg': [[9372156915448280177161257249263267925957908341097109147380509137291, 10887773277538100167275020268384706172488647386814463335875811834106, 1577092404232694288579210635096469321717686075464264800281575232599], [4898467574937034946090811646176931028960044516904026726327299472456, 2828605606477699340407922235283231767598792499136905901824150877566, 9754447470958557760237664589038205015730861849252899704123746673480]], 'vector_g_alpha': [[3164180516368759455420099292603617816969464101390025014373528809354, 5178659280710688601512702326045292688787515633662026687712460296322], [7845060014900900284443828919109175536503753938046497510399736194712, 7760595617230737819467273467076624551667629321354817661871466100030], [8914775115169163658430468222099712973720023254417296277677395815685, 14561916880412473681339900300999710875890617454084858494841071614720], [14170352108218127999291982931383918597925879668823438477019450834961, 717869889494823342547490884369377025872915971312037334123024893615], [12957928015703127234399899213329699507479568608666050780193465276976, 3894053384095715140365187612464076337672133698312746260729209678911], [8025885844776849992765239380316410572455538020497293153393984050633, 6712641813615938538426135130107472962142181672629634165434721889696], [12067569535412143524172563743581713842220645775528007935471041686629, 1722503530608062607213592445226663709773935507916951105633067926719], [13508884899128565671088397418273871116789923081073369226124732551277, 12780442079496976379374669903005930058078440289001397480043822077804], [6438801013817002718936387946089661854242544298793954460524141412170, 9436375642511087945604966811235292141281388899360072670204879693390], [11426417996287558682982437727092331157223937651317469858717048150015, 14513410950791504275851502324011694448837588329995939690191257015684]], 'vector_h_alpha': [[[4234878173523240769959157159470584124761613328315412284873042529247, 12669459583452334409354762158526455543559315108320650621769226421698, 12326962051974049583033196072354160824796718470130010128064103430738], [2319551083970258716678202987909620385357947225593318499399253514516, 10045179804472011061286917907296986678518709991956717967537693538988, 12279146024912970908871915870958033063989576704577131353788460845471]], [[9370303319850941112084594145499445019565405642574470444011558638382, 1508940789078204563958880388737464463019029634736190889259863958048, 6818505541822728013386091190849905615922784907398605363940345908591], [10288565266530892868623680760795221380186366127398431483078657932384, 7854939974348140632989032051794869493223803840740238858746565924841, 6259810860174113973242166773510606516230086487864442693819837597980]], [[14899968276695924287679285007888269794827705900936684673837786523474, 3581594185870404112189331018466006772641049231088142746435744478737, 5696033212030118878197683631143075728663480078203783040634311505962], [4614111167819749989995492300609870044348400889114226688214738648728, 10345614516118529600106278200781423449673998407600015767619331344926, 13888103536067717814179975825840885334667081187982714547651642373339]], [[7072632492057123661472429390661478853598937463721642697409457965556, 2032691762499612191788317605393125206124167501601825520685959807110, 6828038004166554712548552975051026321223547776299720578027320581420], [6834012946853991273483101654013896123028679420880999049469291639226, 13847945127832536148917106418469649189718901562505475657497283095300, 4597897207135066146508873387812517043853683867364279309319765526031]], [[6946985646475741735452851683338861391733635153228778526399307054848, 4917518664388578141693232861850633848533265025857114393947228142839, 1319003635310463561072711865155914557473916616605651299471736084204], [9729509261439790405294847307369294807861292914972083442026961578968, 2679387207917115417713919715315396670769806345554657110338586671806, 1780736734056867917365668418826006285299329839136570824619075426089]], [[11162496772056968040909110514232954622331067508410688946181760720886, 10860163180230933185684577857898597089896788495090297088535914545381, 4108470921336527062674637231739379011826349360050231714557868046996], [11873954443427258431500821145214806229636497587335234382691101354534, 3168505691859584159476153388391357853910256303390703216395361833838, 8137573311908400984712480957225586739243738065393580171636858655789]], [[376743882750741346016403158997182796944637942662324111272731634155, 8984540080558816886859392778317948639015971071869942893602609294543, 10145102221470827819344908855541940374815888190779171437086479255704], [11835490813320477609378020590072847365531287054817055325367606649059, 13803108510056311959578880346849286599763374790251672121576919358545, 14975636085540556854017557967120377135174984982285195995113349483588]], [[1914074798932950225901082865547587852615341399994813560460423160837, 8791486230299976357017824980492350220693921985984190298491739632495, 236607812718432076063400972711031493394401128832900264490907255071], [10931444604770219163819729882589294726506776547535751584487368727192, 10877384887770493563958978278847943297214324751702585199910504878639, 8578810637251091048613654800154538108265573652733738666243276903294]], [[7021564862190899295349640265269551524277486744321014763966987388242, 8510615173506211158959874423874634217587595102920269174119171626093, 12626069389563389294801540148307246170136705705838949417840561378469], [6193763990780269683935464600331409821819253973072404127947992261655, 1539651321389675894335369995279955424929970983956005886346157735789, 2756990025864874600359462332960188808447223505785319450111523876564]], [[14293862856883929472510390349341197026906118893447627655275557209942, 14267807710050747280996562306477985289106951001060300969564712553425, 1387684143808742097061606392233763364189644276358255205527071852581], [10345610258895600679865975980424180281014821634787892247100992694438, 8200240544006351880254625839450015584691316252361691575066733729989, 4655669065967007871312873948090344528396492442188884714527867590730]]], 'g_beta': [8765195771512362645641518224673801586529833568716705309026848713964, 11962748117421643584143675283276544610790149955085616083859672022028], 'h_1_alpha': [[7602121556848522485540783583633495133189746702769420864517280879583, 2491109830463092119173060353519835004988378645610905933412154139449, 5809826684120797990922149133317165460497109004885575906864985952836], [1791889139674549986565616936101614679876489161758980690050294853397, 757053921584912086650325650624223134113122006482486145716882207302, 9786464345311479864600828149420510579823104574493150552496480660385]], 'h_beta_alpha': [[8401410476657291420071384456929475019014895663393284590493672311450, 1062810123569696392329266760525951264643759464446392421462402259073, 7288570815624843204897893429781130667702789246816364988656593264047], [4413438767887710651697563388630235167779655889853021046969763821358, 14562443094423493522869932810180586910021087062426316951095168292280, 12270174594550385163877255125024694004607609016933397414750580726221]], 'egg_theta_alpha': [[11393792052549740008006695489878588439015577290725432451941600067338, 7176659970709247642146656865308372655783773842530691809125941336175, 4233237508989361778687721716556953124839899623391749370702682443530], [8349367907660359438753044701254033636765311500498292247900089855081, 6249293559635391278410999351855555950156304830128707932515118164096, 14554921458052567766329088346226401776586186482507874996283306859827]]} 4 | 5 | 6 | 7 | msk: {'alpha': 1080372165522211373947941906335628963056100668989916270526253707844, 'beta': 10274059106191894939106698606109391728135991400170592131973570712877, 'theta': 11379878434208147985974331270032451313461672091354609806568915356315} 8 | 9 | 10 | 11 | ================================KeyGen()====================================== 12 | 13 | sk: {'Policy': '(123 or 444) and (231 or 384)', 'SK1': {'123': [14837732035861793095349236356863740897181103499285963586889968969931, 6932047160506533234389726659261304630624660435834594761291773784436], '444': [7591812271135006026224566802620499966536604209820391853923274546251, 993538680855711969126574125105967907508335894722627946817477156122], '231': [1050160136878636576476991985712159740419183649306714243437056334015, 2738231171471130112785949553176989091588037756404315510950599274789], '384': [12350921534635602043779990883177329580731435419186574967612490324873, 5482390117013810123885044844127995163710407412321787565134290198050]}, 'SK2': {'123': [77329488045895221416709786910579114262917679218170469195706387853, 5825142410676745946198664415844499208426670135592747442558961892261], '444': [3016339135508977749058599591147768122980183705565727366478197917231, 6333809814020426104021053463483270918318602756665427515132759802651], '231': [13665260274014658363009254037392230687951086395359348726136770490323, 1386777665023573802111322274162327226823744017216508385706063133154], '384': [14426923883781179186213678728403019945613219048504597387463521854839, 2509949129328139166040880935857767265151920300896003015061607379267]}, 'SK3': {'123': [[13108014898582350990133167184285964682824126320050625750362422963444, 11096805427789920513530369004870762318666214080293933025952562417639, 8305326833654679511663420398331484187310332701007905903842781766352], [196526558948736113574910727902559645922791468559382012146289875212, 3597029787131769146887713516423600947221227075704071399442184413700, 13458405632557091220369050455803910061177757067717738082953199125485]], '444': [[9136795610956367886647793537455423060025988301584496826875917370385, 11782115265409514186821560837048334150796620681205015824963225778080, 5300949191625255931419773910193411560681750502822339051669496049639], [3906442372456593892570560370250923389657869517735147134553538981251, 209915605637025379195075544692905869911130746742195213022969472238, 12448490163289171003274923839140522949056530976972363275838363206748]], '231': [[10514665047394234007019490659795310249661568032982931705900145837739, 6440296499797064899754521430584737546527296879354785378205138907906, 6004304545716269001364559072132256230049574200414036428814054464455], [9580603581913920907014902376459062244252761082490126031683043883852, 12818254608600589520660397592725875675155561474047960588343433193659, 12837927158139488991753554354047839776625089437396803778454669315092]], '384': [[11711844725212467361414266764907785144133699603205099500421002492060, 273725438387060433965978835824245133745718469933325073947655658118, 11411402751141805449137798004504038186863412799094266471752098520512], [8099122681674890804392369859461571711006797350586341321265311665557, 11888470492982620448324234725483036226128069645512174903912492812531, 387625626860679141550722409594119535277619892927835755178892008216]]}, 'sk_0': {'g_t_alpha': O, 'g_r': O}, 'sk_1': [6438710866388796944795068344462867538416990418474720209188048333620, 2110969598335776589411524132569098525015270114850847059389585720062]} 14 | 15 | 16 | 17 | ================================Hash()====================================== 18 | 19 | output: {'message': 6805673949075626185421602535099601715050784713588591696510567101240, 'p_prime': [4016805164981125068946983477594872582377776805835619351266967024020, 13687500623850436961630194391660759560160941052291973657770200789929], 'b': [8701529721490067351658219779097808259357297740809588758138803129510, 11358626777451952607213860747687089503317893129216378769468520523374], 'random_r': 7211009184299591787092291928160436594737244033810249463965500943158, 'C': {'attri_list': {'231', '444', '384', '123'}, 'ct': 7609044757336206815551777263172016978611171679956221690400251098492, 'CT1': {'231': [[19828228215153468423327697326432580721974128419998632406600518508, 13931197662281493018239799138802259345795762999000498939073230362061, 5792286389908390018564214578373687199738201718073094034187680323163], [1555008960480921720082763148078947471843460092035459074624458265807, 14200780197348094234145419763096134495721710360200513977887239111101, 5853110275553621266908023747662826984002755890297924600638370849585]], '444': [[3154221687397767188808546477235367536467080863687976202983361479747, 7025316397587432247771623434266757731164074047101201788000484380553, 7274200942178496135173604299598369521563145141906417211816008488145], [9164854464224626525866813788769334533866671075375040259577554519282, 11009770804672785993877258653974822189914217261139689450382042664364, 14754766076864445735721266058106757046016525261920406807869117500760]], '384': [[7773310905343714895258948946321523579437179572171163516505601619401, 11385565344408945919739582822169097223942921781579091239930337731130, 13523660105690521587812566066437136687490578536669179898192179237377], [3341719800082090529479809394759250096558074741295840022231728832062, 9445102885402590979779519639133734827603699000770246307444473547466, 305768800658623624457759650368704338659516790372933585725106102805]], '123': [[1486631146175853146254477926018972311234825977191329861982887469367, 12047711709131401839438827324587735562541539628681855172180803871464, 4668066228767707757137772487189345025829560982764850938701223715687], [9616824441508074920058867149573965886303630411962983782871430294838, 3611687979882118648568125250869010831512579817489246176820124532629, 6097966743012958931324063744998499003115078929799447999683033667711]]}, 'CT2': {'231': [13403390075929666585442696856249277928371052940372398804348803863049, 225387304607825219260368783667997873741663028499339822268283302532], '444': [14922900374696653112254608832066023184816514075935789145088811556658, 871597583073579140827874870956094698430960734483023800602854574200], '384': [14574901370441978707636262892701493859926698189432794024114640733435, 12081785981096263960455758097131520114927336451063359978273855499301], '123': [10777006465728449973932607891171699879536643666012838582995644403097, 2503016796455409018563877265146794781544074701773152086721897458164]}, 'ct_0': {'h_s': [[7516955524405491284702744555819540168370101546903895313705601685176, 10148259937559208213156751473392315480762106899690659619677338226180, 7732240666660133767301260380785916255029062128205720744180924403832], [6626016807923965241162795480815680866354166828368674267340408820865, 11102357787343687907242296926142136330481586058774410315526271041887, 14521847740632248405830499216440524573541817553251214130741172863525]], 'h_s_alpha': [[9319218175902507279531551601668634152236400172246376538080992363743, 10258349716463647454531652251080410490393705929497609072303297402020, 2027308454708081021219338954724486325884688732265441058184785174424], [4104400907146440441232557351515173475241676222354459973704517672980, 5469288005894706254348934650978710542222536365980729585279359038432, 3891722546078245136229932379028115498556979288630027854957075821666]], 'h_beta_s_alpha': [[11594268898199419072178843342536268330816212450269680841817820159249, 10069549948350897394227169894072382584875527169250124158997162214914, 1804884776031478945213011359091187963931088447192063754896329984606], [7827085098585481515240192705399940772388009512366776696804906785773, 2736457237339381632480157835291565703570267807484977468519103685375, 10881054758508350370257204641059683476071089786576367702971099255218]]}, 'ct_1': [[11643466289424190867193180690925285023841383443153630497389075103383, 9303082682482828493617921696305723116219921825556461915340793452658, 8877100151713329248983929355802789013819209745957446786687103746130], [13093865347498155486752367769746684163269836966999580723104861562660, 4326569829115213442044393604642446865356376685500692965313799139502, 6114286653178898869862033878017192973117975900385736200852386576284]]}, 'c': [14961659165778756019088292933848312521070386823036676885837715543514, 10837237915956969983703240671897082380231599229835063223927031528146], 'epk': [14628721824168854001338304959519380048126626970436639807908576245696, 1982873793825444713647379889842687789708288370965735208493600824790], 'sigma': 6163095375728392297544686875556187860768769746807094527223418400379, 'keypair_pk': [13300286545297515709142707894240968910310677319418241011908593642325, 11938679837446739925662686856941147564717018363859621828797068540346]} 20 | 21 | 22 | 23 | ================================Verify()====================================== 24 | 25 | Verify() result: True 26 | 27 | 28 | 29 | ================================Adapt()====================================== 30 | 31 | Verify() result: True 32 | 33 | Verify() result: True 34 | 35 | 36 | 37 | Adapt() output: {'message_prime': 7068505169358058781461283781140296779169378011067410523841374515596, 'p_prime': [4016805164981125068946983477594872582377776805835619351266967024020, 13687500623850436961630194391660759560160941052291973657770200789929], 'b': [8701529721490067351658219779097808259357297740809588758138803129510, 11358626777451952607213860747687089503317893129216378769468520523374], 'random_r_prime': 617351090876805897121150766363267473260492386346825004838360399093, 'C_prime': {'attri_list': {'231', '444', '384', '123'}, 'ct': 12521232684784459028761666422385073170554421371364587346298495500204, 'CT1': {'231': [[10381165509765192178262100285835834124121739656975675108612817524418, 5069271969791225152459870506532082820803072736199010775811129572273, 14719036358194524899852968870126611040778568865736799123395114975347], [2734711661715806804502769036568145225214219942102570226686724222640, 12430337117972860326857899101943843619403619036074461497408561527099, 9546415290034625618028039362185890173059861740948365186704683779335]], '444': [[13143762852330763798768998455221270841957057305111729917316159924025, 13377880175283688981688314152323401192291601903398590613370670363069, 3325631706194170409181226761442732746186540794206124371179548595331], [7672879756297012903181545799500159074664191876736119104513788988400, 8963153301555478926029884083747217522653787081995768729659873692169, 12419883377668310525015774590564155428724401243317366529364985886290]], '384': [[13710496532990937225577098780941929444177567183486145131203592811829, 348874133866141353469994009596231261444260942542792460728514657801, 11613577244033361154034066594949930743053571763077105356357863592058], [634967775651144960770869254077452922146922196822594380390710497136, 12181407758217973399566240035465271641493272641756516341581026147815, 10176851076539247056607469397074143946477452941301999333237637675549]], '123': [[13136965356307422540638295715251212598971154096677465274449589812645, 145359699276078696352519444046109031440994944995479722721146336042, 12050811142327812052236240726925354997667254019584920158968882763058], [12819634985243964645181434246088777674697759470443950483026924716184, 11536808736894102686809494966524300022505096732772706227670935225782, 8586464647951721337300379810950936991143060414220738784435394114822]]}, 'CT2': {'231': [33173600439758945092749882390326167698025972072042786005811173516, 2459202237042254297111686224822881553991866881431304509248654625939], '444': [7237459473865840258719071394739498299071689026670057517933826212806, 5651802781564748715734607593123476599929217340018424058198193551334], '384': [14120739416966393215581254245529875876142187298046073843688545838204, 14524969349925233830739059301517790068268684019826921715601897288311], '123': [1077691407246966027884883967594795306984912995801814570470653773032, 3839207853669599008558885309561740666633980557511088897855158551270]}, 'ct_0': {'h_s': [[1640725265721908417703927516502807797185397595294199906404728202710, 9388432563355073600545818320320221340740171594631632863962582920121, 12591795856678764381812922039258994220516613765141525667822787790261], [8300631050605766833730497200083406294596917379522044802233463514576, 17784374339971753045316735750585301538336542414746478632149989752, 34896713130818668839120758284287755623410449991256141037891703348]], 'h_s_alpha': [[11433549072226359163397018745820015588488165374684557039715917405472, 1844524843122468002745221813766548309357361663070711279682899478877, 5182934434337086263313495065935637411330690675958446901376443949178], [10911632108777130431243226035865741646517091643320310142110729671937, 12917504175327302684730152838611016349064796885252710713004739358493, 11752669589205558114306245193923081825733557214594064386430775655006]], 'h_beta_s_alpha': [[2313772344493316466982765524476884898538216881108153243326142255298, 9830178106145056388948754617205098117453793323755518666384620759691, 827352336025957276839806403962288222620811767382591114821973389850], [11705896992188170434003715150517593802385959906124808720026823484458, 6540499389640794768225184754322504343781719040504480771539728552377, 8140435101454694731227438462706355266657717935142361933689611509273]]}, 'ct_1': [[2876762078570333770009563709871693463878359868333307011453831759022, 11462255557165211229387532316901819497063668283101354506262532884128, 4318117392108829428059172136069967477593950012468629763883186981558], [7036300372980555257423888335773021246824675361871926175935748797967, 8082644729858881234788336443444759475898561707842372954677738052979, 5778948373441054139929739551713166486218142347597240978614015562167]]}, 'c_prime': [9976148075053731708363559301109725941685441121398414575919840443382, 1216430472465614956967616592498002121414765144604370970321288308056], 'epk_prime': [2849560004090289201349757562392580442478328900313765897804183596627, 11086480073620122455242392433717070848660798116435300955044002907304], 'sigma_prime': 5366062682937170974014485541368791858965756395882945132203450449758} 38 | -------------------------------------------------------------------------------- /dpss.txt: -------------------------------------------------------------------------------- 1 | ================================Setup()====================================== 2 | 3 | mpk: 4 | {'g': [3442030226469580208713180658963456159969233482918815237407402370809, 1454944210446247229434701306223578458864185139427209992776426968022], 'u': [7217272745071123306523535240608311959164273847498093983227881573297, 12259357256675622579277232663805407481968330141697690714007256648885], 'v': [775368369463619512329667905833867542613103934710926002836323222495, 13019703837049211050678493308229442565825522404165497991522530364744], 'w': [14335958324482706512199083513716796653206481737115701894472869551194, 4126162945933976642551401684509758078150468312579479696055973866990], 'h': [[3850829940579121679121027639925060149021391164219396073831524016204, 4077772403173059287186028548111996061808566579720660994767566779320, 12530673428749306029797489116527269125420692932245041986202983953138], [2951229682773684828752633641924538786395717707492641583053732620967, 3615732252908400754806015865366621569005753513825775803544114128085, 12028600861525501372892026003951349774326667724254603292326063889079]], 'egg': [[10941100863379596478045097438307914835113009756256088653475743174378, 10151242530085998734040635813831657636426953573899655031385809301237, 508315228757826474428783359067449538793126039348616748621506534394], [6237400474047368660893025312410383698493362784534027340903165783021, 1208440320759259532765361141731340073008298365192639984728747294727, 10738702808069566658502512365478331680724959176384520930141169734759]], 'vector_g_alpha': [[7135345070533177554778302981411855295690327155646704049194217626378, 7638664492196386129172367653328463742315314710715674366141190962753], [5967641006756636373985326207218336607104041470564231736586541900932, 7308037072188617073634086826238473567688406028445585384800201084317], [29044679371115309616063106793465390728478133233748513168301198742, 7533578788313428511882769693111959841209549170388507570898389174346], [1707844954310022858066608304281168001818778480390256969762993816482, 11252293724444564102242032032689727027470815213807343500470300467316], [4079642367239549202751432087585914937187301734165706021430148356216, 10316597880617191603645146642902255863543361563102450992863344356604], [11936109389501241056021781447096908379780652561152616119776098355539, 6597738386603600623217487266795991365457951275175234505107563639122], [8689322461394296318426638260913554637886282664891400600266664393377, 718009528532016399817276344918590657555212788831167865761161380512], [14073450104121425568152684786413734266560840923179367302432706081030, 13159011156735768868401280695318246318585728369976256087820716526461], [11537989869477339954038838365193423276141499472177244148534784454974, 1687304997228754405048833138048493847614388517978707609842366502480], [2505367007384919176389066315077189270767538491199277084443719835166, 14918757556031952570339947936799172628798915536520118888295939812072]], 'vector_h_alpha': [[[9208673044152326562073389557480945623373982809268315501651244118127, 11286903076088637022975579535038635283378940028460834950315150810275, 12447983678838147319720213878631672399062955331640978127200039002997], [2442469775978817919859673842100684441299538376968419005670779904199, 14601798372828104933093648470208472897828832403177784199280170642796, 6404896168161358941764876367375243976327540567947565563693102309510]], [[12381376255609693197338854087941191224131464307380753571954546394208, 14328201284397826692260317022103438803428256056825258143093208188567, 13942596503906493703983262989783002109360535132406006358799088557583], [8439493170273757181745823016028132787050837458005519092498904537404, 6452108854458384042713299117744980524965662715739375885809449660843, 9660293092762660403772430066425181910234803397291270498245592730521]], [[10384886193059650186751045520640553941045146222837436422664127234109, 2689132445749388351099016441231656805221612874201369969489381826511, 4310421903396344231669896860303959243382749056027013024252293910413], [2706513469674948433939223081084575974353805078858802058509941686513, 10809099400680391852017958262713999412129539466489530304301030912188, 2454067552099996511859677956263797274136413549489104378516852060759]], [[103570514871413195932050503501393472643432546784820807805390954690, 8342497721278420053428318339708666031795644797711932441179590416239, 9422923359443966085673849130606393402931647517818005677130821692416], [10545984685159203102877326282590771903312579680378489613507070953974, 210108921739918943412193226580122494961411435019253986612492814333, 8346307438416624705403231655449208298815997162539229643373776925853]], [[7397555988923800387048172885782143695573989303778199685691094518981, 10074973284634980239863440957966117688735475404523802674898621109265, 6463629347984365680522680429247801958727044363557426004538755794907], [11441323861363870668375264196303030797436766656107729831052108262244, 1953264777225534192773509123955719919135665493865644542004452281090, 329722008237664699855882924129823179995653603974227615783520810991]], [[9631311300645436479851399227054498948033516961878794910966233965505, 7552117445973449791991011868119876673690968581811755724082654118506, 1335286203568023656176629317957427400114792428405055082467578043892], [4533250871165434094276168570398301048941677154548891155686894051956, 10844436280775531738641518275828159841362246770474158357428156440844, 7555613249262995702824516158767730579690864812537697868787764213704]], [[57112285125393677203779030459763658896004471185226767871723337152, 828590570722580019989832385545899037280145394090082087125895708706, 3272936494489260387546310016433674034586771889509591896318291894851], [12338341709274336529021193812791477113036431832854072349983491506400, 2610259111699008530305649276951506834287440254619511852076019885033, 3150196083751265415069697545712152242623646215793689293840863422670]], [[7207982115843713201434635245753332428139244790547729547223983881442, 3235704351788607218375388784823130082448660853636513417274382220938, 7763738493213654401931012918749100374422299995808249175384886839469], [10231956157439196869153500845045985361885649880093188445229423045263, 7789656222507273906111623385476218571128444015490644379117915488183, 2153461555241343280908902081451616378946989208137895163688746260145]], [[10707862865805178843589930610054345761812170711490608953646385898977, 5604619593653687623047417461098622773763124766885720854999520969584, 986149315086747459226327531978212727700648938048790557467515100075], [7527146067800038818871113961652973361974705035391172808145869405360, 10686640662247166198686021381176068292691169602087693931745887345722, 12883651633361791630934208996749031463557873638424271497155252190724]], [[7305213835760623023282064565453000435265634812682533333135508186797, 161014424945164567465311046920709256690926420066970742975546600167, 11799803774326097254747428960212726818016418060124872201585397161976], [10958124218536390156041788567298045157310517807379795317376761995367, 12056163841869504284713238789224431150106082539676045934422603103366, 14023163478809312754805016646637823158414283944356490472988464554920]]], 'g_beta': [10891212859451317910003387140112540170184110918587284421881610382811, 10882084161996950276080877986887875744901899733630281452878381706966], 'h_1_alpha': [[5205217287050825765113670471526719663432317372933969697655173365957, 14046713097585830002463685693995599945141190034019964091685632408940, 9911766123659824136124968065946099297712759752928704467744465452382], [13129889394390991570326216684767833388408536232606438322304852814865, 13297337465187284262805574209104809400728565654318606131839832797721, 12143062807594458860732002962220472916233047954812883588340891347706]], 'h_beta_alpha': [[906529435253781480831326479669185627701668547565244110954731226468, 11214331546511663829484446734747422548296888634781489647862946012449, 11139712301941219456559684724443621959868851037581353892794849410241], [11453734093801211041613390893956352196025270927731398312904030973630, 8383861630506142997273427411535337554374457053346287672582173500892, 1355395355847441660766586996039422663167977779521915546344206186407]], 'egg_theta_alpha': [[11270558664148115035567147726308590857225674791779327089570060253087, 12965768118486365317972082884277832164681863813036356619853300084191, 1086325210472645046165962640879410682241025910248645533531566406521], [1328103171045408390994687557634839009665901804337381888979747788136, 13069450323809621551202032840388924827210603878736309834122926431777, 14452289077088888138808722812792818736420227003448549739879207119355]]} 5 | 6 | 7 | msk: 8 | {'alpha': 1480956705440494323972481582265960084393606735865235848513622358902, 'beta': 3904238648691637203773483947472804676565943249727502563661966308373, 'theta': 9344667127778346024419346872176657404901200635651028902311890645326} 9 | 10 | 11 | =============================== Secret (i.e., msk['alpha']) ====================================== 12 | 13 | 14 | Secret: 15 | 1480956705440494323972481582265960084393606735865235848513622358902 16 | 17 | 18 | =============================== Distribute shares to Committee A ====================================== 19 | 20 | 21 | The shares to Committee A: 22 | [[1480956705440494323972481582265960084393606735865235848513622364129, 1379, 639, 963, 1887, 568, 1563, 1175, 1777, 732, 588], [1480956705440494323972481582265960084393606735865235848513623809676, 2281, 1689, 4323, 16542, 6396, 45600, 67469, 203992, 153521, 536640], [1480956705440494323972481582265960084393606735865235848513688884319, 3183, 3439, 13443, 80047, 46064, 510435, 1142267, 5203857, 5885650, 30941740], [1480956705440494323972481582265960084393606735865235848514699280642, 4085, 5889, 31203, 251022, 192892, 2863968, 8553101, 51971032, 78381489, 549453888], [1480956705440494323972481582265960084393606735865235848523164976277, 4987, 9039, 60483, 611535, 587880, 10922739, 40781903, 309766609, 583984808, 5117187564], [1480956705440494323972481582265960084393606735865235848570904384744, 5889, 12889, 104163, 1267102, 1462268, 32613408, 146127245, 1331936472, 3013231537, 31684276288], [1480956705440494323972481582265960084393606735865235848775629990851, 6791, 17439, 165123, 2346687, 3160096, 82237515, 429890099, 4571488177, 12065728926, 148017030540], [1480956705440494323972481582265960084393606735865235849494443213774, 7693, 22689, 246243, 4002702, 6160764, 183239520, 1094713997, 13304333272, 40131101105, 562640715840], [1480956705440494323972481582265960084393606735865235851661984253737, 8595, 28639, 350403, 6411007, 11101592, 371478123, 2496710471, 34136050737, 115838726644, 1827075026188], [1480956705440494323972481582265960084393606735865235857461512608452, 9497, 35289, 480483, 9770910, 18800380, 699000864, 5220000653, 79300000984, 299000000433, 5240000000064], [1480956705440494323972481582265960084393606735865235871553527325959, 10399, 42639, 639363, 14305167, 30277968, 1238322003, 10172303915, 169986593617, 705026360042, 13591210490988], [1480956705440494323972481582265960084393606735865235903185688424026, 11301, 50689, 829923, 20259982, 46780796, 2087203680, 18704204429, 340975485912, 1542774325681, 32444698853440], [1480956705440494323972481582265960084393606735865235969632787785629, 12203, 59439, 1055043, 27905007, 69803464, 3373940355, 32754726527, 646874462737, 3170745312960, 72237849728940], [1480956705440494323972481582265960084393606735865236101569354768032, 13105, 68889, 1317603, 37533342, 101111292, 5263146528, 55025849741, 1170300722392, 6177652988849, 151569439207488], [1480956705440494323972481582265960084393606735865236351163184272427, 14007, 79039, 1620483, 49461535, 142762880, 7962047739, 89188594403, 2032372266609, 11494564453558, 302164804687564], [1480956705440494323972481582265960084393606735865236803898658644774, 14909, 89889, 1966563, 64029582, 197132668, 11727274848, 140123308685, 3405909066712, 20547123544497, 576144092954688], [1480956705440494323972481582265960084393606735865237595397215049201, 15811, 101439, 2358723, 81600927, 266933496, 16872161595, 214196787959, 5531775651697, 35457775073036, 1056380803835340], [1480956705440494323972481582265960084393606735865238934801702405884, 16713, 113689, 2799843, 102562462, 355239164, 23774545440, 319578857357, 8738828737752, 59309427820465, 1870924826751040], [1480956705440494323972481582265960084393606735865241136634692148527, 17615, 126639, 3292803, 127324527, 465506992, 32885071683, 466601048411, 13467965492497, 96483621636354, 3212678719087788], [1480956705440494323972481582265960084393606735865244663431070465202, 18517, 140289, 3840483, 156320910, 601600380, 44736000864, 668160000653, 20300800000984, 153088000000433, 5365760000000064], [1480956705440494323972481582265960084393606735865250181885461873189, 19419, 154639, 4445763, 190008847, 767811368, 59950519443, 940168219055, 29993527474257, 237489733928152, 8740257632577388]] 23 | 24 | 25 | =============================== Re-calculate shares in Committee A ====================================== 26 | ==================== Distribute new shares from Committee A to Committee B ============================== 27 | 28 | 29 | The shares from Committee A to Committee B: 30 | [[1480956705440494323972481582265960084393606735865235848513622375400, 1480956705440494323972481582265960084393606735865235848513624107755, 1480956705440494323972481582265960084393606735865235848513687187706, 1480956705440494323972481582265960084393606735865235848514574069021, 1480956705440494323972481582265960084393606735865235848521607696124, 1480956705440494323972481582265960084393606735865235848559946976455, 1480956705440494323972481582265960084393606735865235848720666698990, 1480956705440494323972481582265960084393606735865235849275943817401, 1480956705440494323972481582265960084393606735865235850930434730576, 1480956705440494323972481582265960084393606735865235855316712074819, 1480956705440494323972481582265960084393606735865235865897548325410, 1480956705440494323972481582265960084393606735865235889509020924725, 1480956705440494323972481582265960084393606735865235938868003444196, 1480956705440494323972481582265960084393606735865236036477733182431, 1480956705440494323972481582265960084393606735865236220497941336214, 1480956705440494323972481582265960084393606735865236553303631189265, 1480956705440494323972481582265960084393606735865237133641126379960, 1480956705440494323972481582265960084393606735865238113503618968091, 1480956705440494323972481582265960084393606735865239721093259456586, 1480956705440494323972481582265960084393606735865242291514981871309, 1480956705440494323972481582265960084393606735865246307160880195020], [1480956705440494323972481582265960084393606735865235848513624848129, 1480956705440494323972481582265960084393606735865235848514316223418, 1480956705440494323972481582265960084393606735865235848549855840389, 1480956705440494323972481582265960084393606735865235849131248349824, 1480956705440494323972481582265960084393606735865235854139793323681, 1480956705440494323972481582265960084393606735865235882873045390574, 1480956705440494323972481582265960084393606735865236007533318032373, 1480956705440494323972481582265960084393606735865236448907820102164, 1480956705440494323972481582265960084393606735865237788267397727649, 1480956705440494323972481582265960084393606735865241389554923344386, 1480956705440494323972481582265960084393606735865250174691987392069, 1480956705440494323972481582265960084393606735865269958251065936328, 1480956705440494323972481582265960084393606735865311627767118380289, 1480956705440494323972481582265960084393606735865394554544972736374, 1480956705440494323972481582265960084393606735865551738904240871541, 1480956705440494323972481582265960084393606735865837335339231950364, 1480956705440494323972481582265960084393606735866337369004758212033, 1480956705440494323972481582265960084393606735867184647217212461514, 1480956705440494323972481582265960084393606735868579090231200463749, 1480956705440494323972481582265960084393606735870814956362693034896, 1480956705440494323972481582265960084393606735874316719527481258209], [1480956705440494323972481582265960084393606735865235848513732714444, 1480956705440494323972481582265960084393606735865235848549900626753, 1480956705440494323972481582265960084393606735865235850493645770170, 1480956705440494323972481582265960084393606735865235882863256886475, 1480956705440494323972481582265960084393606735865236164304696286584, 1480956705440494323972481582265960084393606735865237787840699903309, 1480956705440494323972481582265960084393606735865244857297536306118, 1480956705440494323972481582265960084393606735865269951749997365655, 1480956705440494323972481582265960084393606735865346245658391234020, 1480956705440494323972481582265960084393606735865551683887914573049, 1480956705440494323972481582265960084393606735866053414282181629074, 1480956705440494323972481582265960084393606735867184328190268930883, 1480956705440494323972481582265960084393606735869568163601782189840, 1480956705440494323972481582265960084393606735874315298608552519365, 1480956705440494323972481582265960084393606735883318217066008477214, 1480956705440494323972481582265960084393606735899683775853434780239, 1480956705440494323972481582265960084393606735928348956311603959548, 1480956705440494323972481582265960084393606735976937853550039826225, 1480956705440494323972481582265960084393606736056930358645827516010, 1480956705440494323972481582265960084393606736185227432582810187579, 1480956705440494323972481582265960084393606736386214169385593275304], [1480956705440494323972481582265960084393606735865235848515390989211, 1480956705440494323972481582265960084393606735865235849132064529640, 1480956705440494323972481582265960084393606735865235882864028279927, 1480956705440494323972481582265960084393606735865236448764198660006, 1480956705440494323972481582265960084393606735865241388379078618667, 1480956705440494323972481582265960084393606735865269951616164427596, 1480956705440494323972481582265960084393606735865394525601631611735, 1480956705440494323972481582265960084393606735865837230944494888682, 1480956705440494323972481582265960084393606735867184321982065246491, 1480956705440494323972481582265960084393606735870814054403708533392, 1480956705440494323972481582265960084393606735879683398993912939031, 1480956705440494323972481582265960084393606735899683677959766289230, 1480956705440494323972481582265960084393606735941856874270396929387, 1480956705440494323972481582265960084393606736025865008495012909876, 1480956705440494323972481582265960084393606736185226585640151984567, 1480956705440494323972481582265960084393606736474978680313898365266, 1480956705440494323972481582265960084393606736982592746043400014875, 1480956705440494323972481582265960084393606737843168697600301284792, 1480956705440494323972481582265960084393606739260157217604958681911, 1480956705440494323972481582265960084393606741533116574342801261942, 1480956705440494323972481582265960084393606745094299500493200363051], [1480956705440494323972481582265960084393606735865235848529228893824, 1480956705440494323972481582265960084393606735865235854147413781007, 1480956705440494323972481582265960084393606735865236164312271957546, 1480956705440494323972481582265960084393606735865241388385882896177, 1480956705440494323972481582265960084393606735865287086014860543812, 1480956705440494323972481582265960084393606735865551682728662628939, 1480956705440494323972481582265960084393606735866706713872848993102, 1480956705440494323972481582265960084393606735870814053378289527341, 1480956705440494323972481582265960084393606735883318161317128058952, 1480956705440494323972481582265960084393606735917023104438798763047, 1480956705440494323972481582265960084393606735999406736164798610354, 1480956705440494323972481582265960084393606736185226536099475250697, 1480956705440494323972481582265960084393606736577131773236026813836, 1480956705440494323972481582265960084393606737357933440952460629027, 1480956705440494323972481582265960084393606738839315384851654064982, 1480956705440494323972481582265960084393606741533115775753134816069, 1480956705440494323972481582265960084393606746252886138941982251792, 1480956705440494323972481582265960084393606754255264106372578148031, 1480956705440494323972481582265960084393606767432794480162036473402, 1480956705440494323972481582265960084393606788572219652640250155617, 1480956705440494323972481582265960084393606821694953489700840144084], [1480956705440494323972481582265960084393606735865235848607115422005, 1480956705440494323972481582265960084393606735865235882920213095750, 1480956705440494323972481582265960084393606735865237787887822822121, 1480956705440494323972481582265960084393606735865269951662515952956, 1480956705440494323972481582265960084393606735865551682768209876789, 1480956705440494323972481582265960084393606735867184321611507451610, 1480956705440494323972481582265960084393606735874315269721351424185, 1480956705440494323972481582265960084393606735899683671514837748016, 1480956705440494323972481582265960084393606735976937528371032640661, 1480956705440494323972481582265960084393606736185226530679965715534, 1480956705440494323972481582265960084393606736694437836222419477865, 1480956705440494323972481582265960084393606737843168378629497783620, 1480956705440494323972481582265960084393606740266232033671026418261, 1480956705440494323972481582265960084393606745094298079630411653666, 1480956705440494323972481582265960084393606754255263836942451380729, 1480956705440494323972481582265960084393606770915294137501552086520, 1480956705440494323972481582265960084393606800107228331492647442805, 1480956705440494323972481582265960084393606849605376865157634491606, 1480956705440494323972481582265960084393606931118719032488135247721, 1480956705440494323972481582265960084393607061889286293332648882124, 1480956705440494323972481582265960084393607266799186535724476398325], [1480956705440494323972481582265960084393606735865235848940802062244, 1480956705440494323972481582265960084393606735865236007753452655253, 1480956705440494323972481582265960084393606735865244857517626142634, 1480956705440494323972481582265960084393606735865394525820950054799, 1480956705440494323972481582265960084393606735866706714085363158656, 1480956705440494323972481582265960084393606735874315269894318341889, 1480956705440494323972481582265960084393606735907560609503466560358, 1480956705440494323972481582265960084393606736025864979914611670459, 1480956705440494323972481582265960084393606736386212720179128183324, 1480956705440494323972481582265960084393606737357933413397478395661, 1480956705440494323972481582265960084393606739733855238396375524834, 1480956705440494323972481582265960084393606745094298057494938955463, 1480956705440494323972481582265960084393606756402347938316300043384, 1480956705440494323972481582265960084393606778935934027461965672249, 1480956705440494323972481582265960084393606821694952096243255470366, 1480956705440494323972481582265960084393606899460583787757720822579, 1480956705440494323972481582265960084393607035729583734609053106068, 1480956705440494323972481582265960084393607266799185411697018491909, 1480956705440494323972481582265960084393607647338947962949840738074, 1480956705440494323972481582265960084393608257854867418835615206271, 1480956705440494323972481582265960084393609214528943827172200416624], [1480956705440494323972481582265960084393606735865235850111807757599, 1480956705440494323972481582265960084393606735865236449743683301988, 1480956705440494323972481582265960084393606735865269952585815779115, 1480956705440494323972481582265960084393606735865837231779541908690, 1480956705440494323972481582265960084393606735870814054206532269839, 1480956705440494323972481582265960084393606735899683672303533242664, 1480956705440494323972481582265960084393606736025864980530340247403, 1480956705440494323972481582265960084393606736474978576897829765750, 1480956705440494323972481582265960084393606737843168373343822531935, 1480956705440494323972481582265960084393606741533115673362485222604, 1480956705440494323972481582265960084393606750556187591777543146379, 1480956705440494323972481582265960084393606770915294040530412028218, 1480956705440494323972481582265960084393606813866528956461103192335, 1480956705440494323972481582265960084393606899460583712922053462480, 1480956705440494323972481582265960084393607061889285447312519111819, 1480956705440494323972481582265960084393607357310472061883492398494, 1480956705440494323972481582265960084393607874997810626069889809183, 1480956705440494323972481582265960084393608752863138535787663293620, 1480956705440494323972481582265960084393610198629498779218139700075, 1480956705440494323972481582265960084393612518195293730219939507234, 1480956705440494323972481582265960084393616153025937750289903983759], [1480956705440494323972481582265960084393606735865235853641920146136, 1480956705440494323972481582265960084393606735865237790978882402835, 1480956705440494323972481582265960084393606735865346248369831122842, 1480956705440494323972481582265960084393606735867184324692733741861, 1480956705440494323972481582265960084393606735883318164020992276812, 1480956705440494323972481582265960084393606735976937531035349610671, 1480956705440494323972481582265960084393606736386212722670478235630, 1480956705440494323972481582265960084393606737843168375219444007297, 1480956705440494323972481582265960084393606742282212433409990736896, 1480956705440494323972481582265960084393606754255263785017139876587, 1480956705440494323972481582265960084393606783535364921241974149506, 1480956705440494323972481582265960084393606849605376549221705755325, 1480956705440494323972481582265960084393606988999459448496249758452, 1480956705440494323972481582265960084393607266799185117896562453831, 1480956705440494323972481582265960084393607793989910992994993919062, 1480956705440494323972481582265960084393608752863138316822874615641, 1480956705440494323972481582265960084393610433213571207870538810920, 1480956705440494323972481582265960084393613282732144179295013770307, 1480956705440494323972481582265960084393617975745012411625704130666, 1480956705440494323972481582265960084393625505300034557933606625237, 1480956705440494323972481582265960084393637304563251855269932402076], [1480956705440494323972481582265960084393606735865235863085760708009, 1480956705440494323972481582265960084393606735865241397323971237202, 1480956705440494323972481582265960084393606735865551691656917679501, 1480956705440494323972481582265960084393606735870814062171940246392, 1480956705440494323972481582265960084393606735917023112200226198537, 1480956705440494323972481582265960084393606736185226538401845903174, 1480956705440494323972481582265960084393606737357933420946391665597, 1480956705440494323972481582265960084393606741533115680295669915596, 1480956705440494323972481582265960084393606754255263790074703094217, 1480956705440494323972481582265960084393606788572218759618537815322, 1480956705440494323972481582265960084393606872499468753005262813389, 1480956705440494323972481582265960084393607061889285405730446076992, 1480956705440494323972481582265960084393607461479496847645137649641, 1480956705440494323972481582265960084393608257854866553368885099342, 1480956705440494323972481582265960084393609769211984331101104858557, 1480956705440494323972481582265960084393612518195292939588876760404, 1480956705440494323972481582265960084393617335686385902967013388137, 1480956705440494323972481582265960084393625505300033986267332556386, 1480956705440494323972481582265960084393638960487544412598662597517, 1480956705440494323972481582265960084393660548590043158327468377992, 1480956705440494323972481582265960084393694378940111467041333360969], [1480956705440494323972481582265960084393606735865235886031206672060, 1480956705440494323972481582265960084393606735865250194825644998345, 1480956705440494323972481582265960084393606735866053434415794448986, 1480956705440494323972481582265960084393606735879683419126754365491, 1480956705440494323972481582265960084393606735999406756290835759304, 1480956705440494323972481582265960084393606736694437856308909378965, 1480956705440494323972481582265960084393606739733855258309898508230, 1480956705440494323972481582265960084393606750556187611075337552831, 1480956705440494323972481582265960084393606783535364938664147080596, 1480956705440494323972481582265960084393606872499468765369872526849, 1480956705440494323972481582265960084393607090085287059898294518770, 1480956705440494323972481582265960084393607581108406568597240963115, 1480956705440494323972481582265960084393608617144775726832311935776, 1480956705440494323972481582265960084393610682004665750811765263501, 1480956705440494323972481582265960084393614600783065503950700752094, 1480956705440494323972481582265960084393621728741087086858621545975, 1480956705440494323972481582265960084393634220460253602865139355500, 1480956705440494323972481582265960084393655404564907986295723515321, 1480956705440494323972481582265960084393690294876741933102669293706, 1480956705440494323972481582265960084393746275198916627575575813539, 1480956705440494323972481582265960084393834002074751899330275625080], [1480956705440494323972481582265960084393606735865235937534996429859, 1480956705440494323972481582265960084393606735865270006277040701088, 1480956705440494323972481582265960084393606735867184376216198909279, 1480956705440494323972481582265960084393606735899683725984924874174, 1480956705440494323972481582265960084393606736185226584117829558131, 1480956705440494323972481582265960084393606737843168426608304843204, 1480956705440494323972481582265960084393606745094298105300779097343, 1480956705440494323972481582265960084393606770915294087720523593154, 1480956705440494323972481582265960084393606849605376594536195844899, 1480956705440494323972481582265960084393607061889285445987372948936, 1480956705440494323972481582265960084393607581108406596489558121599, 1480956705440494323972481582265960084393608752863138270451899898598, 1480956705440494323972481582265960084393611225282165635307508963379, 1480956705440494323972481582265960084393616153025936383062155380524, 1480956705440494323972481582265960084393625505300033762513642196191, 1480956705440494323972481582265960084393642516677063833880643002794, 1480956705440494323972481582265960084393672329520845329105624221603, 1480956705440494323972481582265960084393722888391848817761010606704, 1480956705440494323972481582265960084393806160105712223490357888799, 1480956705440494323972481582265960084393939768234997432456332629646, 1480956705440494323972481582265960084394149147905883106544129319539], [1480956705440494323972481582265960084393606735865236045724484792304, 1480956705440494323972481582265960084393606735865311734623598988023, 1480956705440494323972481582265960084393606735869568270458218011210, 1480956705440494323972481582265960084393606735941856981126061357305, 1480956705440494323972481582265960084393606736577131880084886964244, 1480956705440494323972481582265960084393606740266232140480339320819, 1480956705440494323972481582265960084393606756402348044952646028238, 1480956705440494323972481582265960084393606813866529062481720600245, 1480956705440494323972481582265960084393606988999459552641245691000, 1480956705440494323972481582265960084393607461479496946732570364559, 1480956705440494323972481582265960084393608617144775813555134937234, 1480956705440494323972481582265960084393611225282165694138014806353, 1480956705440494323972481582265960084393616728620167693703427997980, 1480956705440494323972481582265960084393627697468581259554057393995, 1480956705440494323972481582265960084393648515407105059568175207574, 1480956705440494323972481582265960084393686382900091116646201737549, 1480956705440494323972481582265960084393752747467586058875860218368, 1480956705440494323972481582265960084393865294835704222466882165415, 1480956705440494323972481582265960084394050665084421103746650467290, 1480956705440494323972481582265960084394348091470189006801618069289, 1480956705440494323972481582265960084394814197586496383792185897764], [1480956705440494323972481582265960084393606735865236260547176727261, 1480956705440494323972481582265960084393606735865394778614415540830, 1480956705440494323972481582265960084393606735874315522677950537457, 1480956705440494323972481582265960084393606736025865232563639534516, 1480956705440494323972481582265960084393606737357933665014282976157, 1480956705440494323972481582265960084393606745094298303652686752946, 1480956705440494323972481582265960084393606778935934251311273853825, 1480956705440494323972481582265960084393606899460583936155633067112, 1480956705440494323972481582265960084393607266799185339254520583101, 1480956705440494323972481582265960084393608257854866769669280010982, 1480956705440494323972481582265960084393610682004665954747550461681, 1480956705440494323972481582265960084393616153025936559105623420220, 1480956705440494323972481582265960084393627697468581376767019590717, 1480956705440494323972481582265960084393650707400813538087919198586, 1480956705440494323972481582265960084393694378940110317439125832257, 1480956705440494323972481582265960084393773817792403700125407255216, 1480956705440494323972481582265960084393913039711362948702469172765, 1480956705440494323972481582265960084394149147905882180695612151022, 1480956705440494323972481582265960084394538031517605612728430212721, 1480956705440494323972481582265960084395161999911519821230864529732, 1480956705440494323972481582265960084396139847221331298209659550301], [1480956705440494323972481582265960084393606735865236666952270260244, 1480956705440494323972481582265960084393606735865552185358569055197, 1480956705440494323972481582265960084393606735883318663520291874506, 1480956705440494323972481582265960084393606736185227032093663988407, 1480956705440494323972481582265960084393606738839315831298361791312, 1480956705440494323972481582265960084393606754255264283349611859209, 1480956705440494323972481582265960084393606821694952542477449031142, 1480956705440494323972481582265960084393607061889285892930984095651, 1480956705440494323972481582265960084393607793989911436737837427532, 1480956705440494323972481582265960084393609769211984769786385149397, 1480956705440494323972481582265960084393614600783065930271371329474, 1480956705440494323972481582265960084393625505300034160941995615087, 1480956705440494323972481582265960084393648515407105399166022783496, 1480956705440494323972481582265960084393694378940110539824011211457, 1480956705440494323972481582265960084393781426431642048724653465182, 1480956705440494323972481582265960084393939768234997081835696336539, 1480956705440494323972481582265960084394217275598532531405191942532, 1480956705440494323972481582265960084394687907902597017255158206541, 1480956705440494323972481582265960084395463072055112413414328394682, 1480956705440494323972481582265960084396706840825638690068777632167, 1480956705440494323972481582265960084398656015777866301799061715904], [1480956705440494323972481582265960084393606735865237404147898027815, 1480956705440494323972481582265960084393606735865838186183498048540, 1480956705440494323972481582265960084393606735899684626697656092051, 1480956705440494323972481582265960084393606736474979531157348283626, 1480956705440494323972481582265960084393606741533116626589780456919, 1480956705440494323972481582265960084393606770915294988298650479520, 1480956705440494323972481582265960084393606899460584638381852297875, 1480956705440494323972481582265960084393607357310472911891895296846, 1480956705440494323972481582265960084393608752863139164955656038631, 1480956705440494323972481582265960084393612518195293782664094965764, 1480956705440494323972481582265960084393621728741087917569230037875, 1480956705440494323972481582265960084393642516677064636698934336210, 1480956705440494323972481582265960084393686382900091860633987227991, 1480956705440494323972481582265960084393773817792404326900230548936, 1480956705440494323972481582265960084393939768234997486225634251059, 1480956705440494323972481582265960084394241639648372428611531888630, 1480956705440494323972481582265960084394770699298739321183216992295, 1480956705440494323972481582265960084395667952798959105931468624236, 1480956705440494323972481582265960084397145801747451037247370030291, 1480956705440494323972481582265960084399517058875728721101970122554, 1480956705440494323972481582265960084403233200006861334343885352535], [1480956705440494323972481582265960084393606735865238692998989569224, 1480956705440494323972481582265960084393606735866338928362620660923, 1480956705440494323972481582265960084393606735928350515669421622074, 1480956705440494323972481582265960084393606736982594305400446283949, 1480956705440494323972481582265960084393606746252887698292224243356, 1480956705440494323972481582265960084393606800107229890803342186519, 1480956705440494323972481582265960084393607035729585293746780932078, 1480956705440494323972481582265960084393607874997812184591889058249, 1480956705440494323972481582265960084393610433213572764516916584624, 1480956705440494323972481582265960084393617335686387454555827944211, 1480956705440494323972481582265960084393634220460255142089344198114, 1480956705440494323972481582265960084393672329520846840437511905733, 1480956705440494323972481582265960084393752747467587511377242059524, 1480956705440494323972481582265960084393913039711364283990888817199, 1480956705440494323972481582265960084394217275598533644308726207766, 1480956705440494323972481582265960084394770699298740029696813343009, 1480956705440494323972481582265960084395740636661198300819896724888, 1480956705440494323972481582265960084397385603374927443234363793899, 1480956705440494323972481582265960084400095012496347231196516705674, 1480956705440494323972481582265960084404442371566058129064261245021, 1480956705440494323972481582265960084411255414958912071683384580204], [1480956705440494323972481582265960084393606735865240874118599849809, 1480956705440494323972481582265960084393606735867187407832192602858, 1480956705440494323972481582265960084393606735976940614164975181205, 1480956705440494323972481582265960084393606737843171458214465246320, 1480956705440494323972481582265960084393606754255266866979937832049, 1480956705440494323972481582265960084393606849605379625725446927774, 1480956705440494323972481582265960084393607266799188172091864010373, 1480956705440494323972481582265960084393608752863141295566780235140, 1480956705440494323972481582265960084393613282732146937198509236465, 1480956705440494323972481582265960084393625505300036739113264804914, 1480956705440494323972481582265960084393655404564910726777046050389, 1480956705440494323972481582265960084393722888391851530350015983288, 1480956705440494323972481582265960084393865294835706876225381699025, 1480956705440494323972481582265960084394149147905884717241149487910, 1480956705440494323972481582265960084394687907902599331415810164229, 1480956705440494323972481582265960084395667952798961015702182667404, 1480956705440494323972481582265960084397385603374928644491481486353, 1480956705440494323972481582265960084400298672716655363746349647610, 1480956705440494323972481582265960084405096787067365062011287840405, 1480956705440494323972481582265960084412795596642813010455785679744, 1480956705440494323972481582265960084424860978694820206863697083569], [1480956705440494323972481582265960084393606735865244459765080753836, 1480956705440494323972481582265960084393606735868583828903021020625, 1480956705440494323972481582265960084393606736056935097317603286522, 1480956705440494323972481582265960084393606739260161956275963058971, 1480956705440494323972481582265960084393606767432799218826236572952, 1480956705440494323972481582265960084393606931118723771112788099421, 1480956705440494323972481582265960084393607647338952701401526672070, 1480956705440494323972481582265960084393610198629503517054097057127, 1480956705440494323972481582265960084393617975745017147586040012356, 1480956705440494323972481582265960084393638960487549143501435261577, 1480956705440494323972481582265960084393690294876746651640832244306, 1480956705440494323972481582265960084393806160105716914136203680915, 1480956705440494323972481582265960084394050665084425735561990416432, 1480956705440494323972481582265960084394538031517610127330807965141, 1480956705440494323972481582265960084395463072055116705631820767902, 1480956705440494323972481582265960084397145801747454925074924488991, 1480956705440494323972481582265960084400095012496350410510474813660, 1480956705440494323972481582265960084405096787067367040068128255937, 1480956705440494323972481582265960084413335245187405569125181542826, 1480956705440494323972481582265960084426554310942250003500376300427, 1480956705440494323972481582265960084447270979776489166499240123976], [1480956705440494323972481582265960084393606735865250203293528388779, 1480956705440494323972481582265960084393606735870822868141238811992, 1480956705440494323972481582265960084393606736185235344361311178311, 1480956705440494323972481582265960084393606741533124486120530859222, 1480956705440494323972481582265960084393606788572227564411175475387, 1480956705440494323972481582265960084393607061889294205064026954044, 1480956705440494323972481582265960084393608257854875330394026360487, 1480956705440494323972481582265960084393612518195301641162622084506, 1480956705440494323972481582265960084393625505300042467000667727147, 1480956705440494323972481582265960084393660548590051062336966262272, 1480956705440494323972481582265960084393746275198924519220463984359, 1480956705440494323972481582265960084393939768235005296208903641982, 1480956705440494323972481582265960084394348091470196811723683238651, 1480956705440494323972481582265960084395161999911527508939967502372, 1480956705440494323972481582265960084396706840825646155392995225607, 1480956705440494323972481582265960084399517058875735782036249801474, 1480956705440494323972481582265960084404442371566064481484944573227, 1480956705440494323972481582265960084412795596642818161619351315496, 1480956705440494323972481582265960084426554310942253176607101520647, 1480956705440494323972481582265960084448631019879835420731948415142, 1480956705440494323972481582265960084483229337808166859188825022139], [1480956705440494323972481582265960084393606735865259190627437031520, 1480956705440494323972481582265960084393606735874329602994037354335, 1480956705440494323972481582265960084393606736386227052852104585066, 1480956705440494323972481582265960084393606745094312383958940279361, 1480956705440494323972481582265960084393606821694966373159775782884, 1480956705440494323972481582265960084393607266799199419143864789275, 1480956705440494323972481582265960084393609214528956710418621889870, 1480956705440494323972481582265960084393616153025950632920596880061, 1480956705440494323972481582265960084393637304563264736025003823016, 1480956705440494323972481582265960084393694378940124342738841564279, 1480956705440494323972481582265960084393834002074764762663174114930, 1480956705440494323972481582265960084394149147905895941984710650905, 1480956705440494323972481582265960084394814197586509160402261386156, 1480956705440494323972481582265960084396139847221343957606772841971, 1480956705440494323972481582265960084398656015777878738811289628374, 1480956705440494323972481582265960084403233200006873366966175350485, 1480956705440494323972481582265960084411255414958923395792078227440, 1480956705440494323972481582265960084424860978694830329715273038351, 1480956705440494323972481582265960084447270979776497311293975663226, 1480956705440494323972481582265960084483229337808171830876835341169, 1480956705440494323972481582265960084539582962391823324132888397940]] 31 | 32 | 33 | =============================== Committee B members receive share slices from Committee A ====================================== 34 | ===========================================Committee B members recover new shares ============================================== 35 | 36 | 37 | The new shares in Committee B: 38 | [[1480956705440494323972481582265960084393606735865235848513622375400, 1480956705440494323972481582265960084393606735865235848513624848129, 1480956705440494323972481582265960084393606735865235848513732714444, 1480956705440494323972481582265960084393606735865235848515390989211, 1480956705440494323972481582265960084393606735865235848529228893824, 1480956705440494323972481582265960084393606735865235848607115422005, 1480956705440494323972481582265960084393606735865235848940802062244, 1480956705440494323972481582265960084393606735865235850111807757599, 1480956705440494323972481582265960084393606735865235853641920146136, 1480956705440494323972481582265960084393606735865235863085760708009, 1480956705440494323972481582265960084393606735865235886031206672060, 1480956705440494323972481582265960084393606735865235937534996429859, 1480956705440494323972481582265960084393606735865236045724484792304, 1480956705440494323972481582265960084393606735865236260547176727261, 1480956705440494323972481582265960084393606735865236666952270260244, 1480956705440494323972481582265960084393606735865237404147898027815, 1480956705440494323972481582265960084393606735865238692998989569224, 1480956705440494323972481582265960084393606735865240874118599849809, 1480956705440494323972481582265960084393606735865244459765080753836, 1480956705440494323972481582265960084393606735865250203293528388779, 1480956705440494323972481582265960084393606735865259190627437031520], [1480956705440494323972481582265960084393606735865235848513624107755, 1480956705440494323972481582265960084393606735865235848514316223418, 1480956705440494323972481582265960084393606735865235848549900626753, 1480956705440494323972481582265960084393606735865235849132064529640, 1480956705440494323972481582265960084393606735865235854147413781007, 1480956705440494323972481582265960084393606735865235882920213095750, 1480956705440494323972481582265960084393606735865236007753452655253, 1480956705440494323972481582265960084393606735865236449743683301988, 1480956705440494323972481582265960084393606735865237790978882402835, 1480956705440494323972481582265960084393606735865241397323971237202, 1480956705440494323972481582265960084393606735865250194825644998345, 1480956705440494323972481582265960084393606735865270006277040701088, 1480956705440494323972481582265960084393606735865311734623598988023, 1480956705440494323972481582265960084393606735865394778614415540830, 1480956705440494323972481582265960084393606735865552185358569055197, 1480956705440494323972481582265960084393606735865838186183498048540, 1480956705440494323972481582265960084393606735866338928362620660923, 1480956705440494323972481582265960084393606735867187407832192602858, 1480956705440494323972481582265960084393606735868583828903021020625, 1480956705440494323972481582265960084393606735870822868141238811992, 1480956705440494323972481582265960084393606735874329602994037354335], [1480956705440494323972481582265960084393606735865235848513687187706, 1480956705440494323972481582265960084393606735865235848549855840389, 1480956705440494323972481582265960084393606735865235850493645770170, 1480956705440494323972481582265960084393606735865235882864028279927, 1480956705440494323972481582265960084393606735865236164312271957546, 1480956705440494323972481582265960084393606735865237787887822822121, 1480956705440494323972481582265960084393606735865244857517626142634, 1480956705440494323972481582265960084393606735865269952585815779115, 1480956705440494323972481582265960084393606735865346248369831122842, 1480956705440494323972481582265960084393606735865551691656917679501, 1480956705440494323972481582265960084393606735866053434415794448986, 1480956705440494323972481582265960084393606735867184376216198909279, 1480956705440494323972481582265960084393606735869568270458218011210, 1480956705440494323972481582265960084393606735874315522677950537457, 1480956705440494323972481582265960084393606735883318663520291874506, 1480956705440494323972481582265960084393606735899684626697656092051, 1480956705440494323972481582265960084393606735928350515669421622074, 1480956705440494323972481582265960084393606735976940614164975181205, 1480956705440494323972481582265960084393606736056935097317603286522, 1480956705440494323972481582265960084393606736185235344361311178311, 1480956705440494323972481582265960084393606736386227052852104585066], [1480956705440494323972481582265960084393606735865235848514574069021, 1480956705440494323972481582265960084393606735865235849131248349824, 1480956705440494323972481582265960084393606735865235882863256886475, 1480956705440494323972481582265960084393606735865236448764198660006, 1480956705440494323972481582265960084393606735865241388385882896177, 1480956705440494323972481582265960084393606735865269951662515952956, 1480956705440494323972481582265960084393606735865394525820950054799, 1480956705440494323972481582265960084393606735865837231779541908690, 1480956705440494323972481582265960084393606735867184324692733741861, 1480956705440494323972481582265960084393606735870814062171940246392, 1480956705440494323972481582265960084393606735879683419126754365491, 1480956705440494323972481582265960084393606735899683725984924874174, 1480956705440494323972481582265960084393606735941856981126061357305, 1480956705440494323972481582265960084393606736025865232563639534516, 1480956705440494323972481582265960084393606736185227032093663988407, 1480956705440494323972481582265960084393606736474979531157348283626, 1480956705440494323972481582265960084393606736982594305400446283949, 1480956705440494323972481582265960084393606737843171458214465246320, 1480956705440494323972481582265960084393606739260161956275963058971, 1480956705440494323972481582265960084393606741533124486120530859222, 1480956705440494323972481582265960084393606745094312383958940279361], [1480956705440494323972481582265960084393606735865235848521607696124, 1480956705440494323972481582265960084393606735865235854139793323681, 1480956705440494323972481582265960084393606735865236164304696286584, 1480956705440494323972481582265960084393606735865241388379078618667, 1480956705440494323972481582265960084393606735865287086014860543812, 1480956705440494323972481582265960084393606735865551682768209876789, 1480956705440494323972481582265960084393606735866706714085363158656, 1480956705440494323972481582265960084393606735870814054206532269839, 1480956705440494323972481582265960084393606735883318164020992276812, 1480956705440494323972481582265960084393606735917023112200226198537, 1480956705440494323972481582265960084393606735999406756290835759304, 1480956705440494323972481582265960084393606736185226584117829558131, 1480956705440494323972481582265960084393606736577131880084886964244, 1480956705440494323972481582265960084393606737357933665014282976157, 1480956705440494323972481582265960084393606738839315831298361791312, 1480956705440494323972481582265960084393606741533116626589780456919, 1480956705440494323972481582265960084393606746252887698292224243356, 1480956705440494323972481582265960084393606754255266866979937832049, 1480956705440494323972481582265960084393606767432799218826236572952, 1480956705440494323972481582265960084393606788572227564411175475387, 1480956705440494323972481582265960084393606821694966373159775782884], [1480956705440494323972481582265960084393606735865235848559946976455, 1480956705440494323972481582265960084393606735865235882873045390574, 1480956705440494323972481582265960084393606735865237787840699903309, 1480956705440494323972481582265960084393606735865269951616164427596, 1480956705440494323972481582265960084393606735865551682728662628939, 1480956705440494323972481582265960084393606735867184321611507451610, 1480956705440494323972481582265960084393606735874315269894318341889, 1480956705440494323972481582265960084393606735899683672303533242664, 1480956705440494323972481582265960084393606735976937531035349610671, 1480956705440494323972481582265960084393606736185226538401845903174, 1480956705440494323972481582265960084393606736694437856308909378965, 1480956705440494323972481582265960084393606737843168426608304843204, 1480956705440494323972481582265960084393606740266232140480339320819, 1480956705440494323972481582265960084393606745094298303652686752946, 1480956705440494323972481582265960084393606754255264283349611859209, 1480956705440494323972481582265960084393606770915294988298650479520, 1480956705440494323972481582265960084393606800107229890803342186519, 1480956705440494323972481582265960084393606849605379625725446927774, 1480956705440494323972481582265960084393606931118723771112788099421, 1480956705440494323972481582265960084393607061889294205064026954044, 1480956705440494323972481582265960084393607266799199419143864789275], [1480956705440494323972481582265960084393606735865235848720666698990, 1480956705440494323972481582265960084393606735865236007533318032373, 1480956705440494323972481582265960084393606735865244857297536306118, 1480956705440494323972481582265960084393606735865394525601631611735, 1480956705440494323972481582265960084393606735866706713872848993102, 1480956705440494323972481582265960084393606735874315269721351424185, 1480956705440494323972481582265960084393606735907560609503466560358, 1480956705440494323972481582265960084393606736025864980530340247403, 1480956705440494323972481582265960084393606736386212722670478235630, 1480956705440494323972481582265960084393606737357933420946391665597, 1480956705440494323972481582265960084393606739733855258309898508230, 1480956705440494323972481582265960084393606745094298105300779097343, 1480956705440494323972481582265960084393606756402348044952646028238, 1480956705440494323972481582265960084393606778935934251311273853825, 1480956705440494323972481582265960084393606821694952542477449031142, 1480956705440494323972481582265960084393606899460584638381852297875, 1480956705440494323972481582265960084393607035729585293746780932078, 1480956705440494323972481582265960084393607266799188172091864010373, 1480956705440494323972481582265960084393607647338952701401526672070, 1480956705440494323972481582265960084393608257854875330394026360487, 1480956705440494323972481582265960084393609214528956710418621889870], [1480956705440494323972481582265960084393606735865235849275943817401, 1480956705440494323972481582265960084393606735865236448907820102164, 1480956705440494323972481582265960084393606735865269951749997365655, 1480956705440494323972481582265960084393606735865837230944494888682, 1480956705440494323972481582265960084393606735870814053378289527341, 1480956705440494323972481582265960084393606735899683671514837748016, 1480956705440494323972481582265960084393606736025864979914611670459, 1480956705440494323972481582265960084393606736474978576897829765750, 1480956705440494323972481582265960084393606737843168375219444007297, 1480956705440494323972481582265960084393606741533115680295669915596, 1480956705440494323972481582265960084393606750556187611075337552831, 1480956705440494323972481582265960084393606770915294087720523593154, 1480956705440494323972481582265960084393606813866529062481720600245, 1480956705440494323972481582265960084393606899460583936155633067112, 1480956705440494323972481582265960084393607061889285892930984095651, 1480956705440494323972481582265960084393607357310472911891895296846, 1480956705440494323972481582265960084393607874997812184591889058249, 1480956705440494323972481582265960084393608752863141295566780235140, 1480956705440494323972481582265960084393610198629503517054097057127, 1480956705440494323972481582265960084393612518195301641162622084506, 1480956705440494323972481582265960084393616153025950632920596880061], [1480956705440494323972481582265960084393606735865235850930434730576, 1480956705440494323972481582265960084393606735865237788267397727649, 1480956705440494323972481582265960084393606735865346245658391234020, 1480956705440494323972481582265960084393606735867184321982065246491, 1480956705440494323972481582265960084393606735883318161317128058952, 1480956705440494323972481582265960084393606735976937528371032640661, 1480956705440494323972481582265960084393606736386212720179128183324, 1480956705440494323972481582265960084393606737843168373343822531935, 1480956705440494323972481582265960084393606742282212433409990736896, 1480956705440494323972481582265960084393606754255263790074703094217, 1480956705440494323972481582265960084393606783535364938664147080596, 1480956705440494323972481582265960084393606849605376594536195844899, 1480956705440494323972481582265960084393606988999459552641245691000, 1480956705440494323972481582265960084393607266799185339254520583101, 1480956705440494323972481582265960084393607793989911436737837427532, 1480956705440494323972481582265960084393608752863139164955656038631, 1480956705440494323972481582265960084393610433213572764516916584624, 1480956705440494323972481582265960084393613282732146937198509236465, 1480956705440494323972481582265960084393617975745017147586040012356, 1480956705440494323972481582265960084393625505300042467000667727147, 1480956705440494323972481582265960084393637304563264736025003823016], [1480956705440494323972481582265960084393606735865235855316712074819, 1480956705440494323972481582265960084393606735865241389554923344386, 1480956705440494323972481582265960084393606735865551683887914573049, 1480956705440494323972481582265960084393606735870814054403708533392, 1480956705440494323972481582265960084393606735917023104438798763047, 1480956705440494323972481582265960084393606736185226530679965715534, 1480956705440494323972481582265960084393606737357933413397478395661, 1480956705440494323972481582265960084393606741533115673362485222604, 1480956705440494323972481582265960084393606754255263785017139876587, 1480956705440494323972481582265960084393606788572218759618537815322, 1480956705440494323972481582265960084393606872499468765369872526849, 1480956705440494323972481582265960084393607061889285445987372948936, 1480956705440494323972481582265960084393607461479496946732570364559, 1480956705440494323972481582265960084393608257854866769669280010982, 1480956705440494323972481582265960084393609769211984769786385149397, 1480956705440494323972481582265960084393612518195293782664094965764, 1480956705440494323972481582265960084393617335686387454555827944211, 1480956705440494323972481582265960084393625505300036739113264804914, 1480956705440494323972481582265960084393638960487549143501435261577, 1480956705440494323972481582265960084393660548590051062336966262272, 1480956705440494323972481582265960084393694378940124342738841564279], [1480956705440494323972481582265960084393606735865235865897548325410, 1480956705440494323972481582265960084393606735865250174691987392069, 1480956705440494323972481582265960084393606735866053414282181629074, 1480956705440494323972481582265960084393606735879683398993912939031, 1480956705440494323972481582265960084393606735999406736164798610354, 1480956705440494323972481582265960084393606736694437836222419477865, 1480956705440494323972481582265960084393606739733855238396375524834, 1480956705440494323972481582265960084393606750556187591777543146379, 1480956705440494323972481582265960084393606783535364921241974149506, 1480956705440494323972481582265960084393606872499468753005262813389, 1480956705440494323972481582265960084393607090085287059898294518770, 1480956705440494323972481582265960084393607581108406596489558121599, 1480956705440494323972481582265960084393608617144775813555134937234, 1480956705440494323972481582265960084393610682004665954747550461681, 1480956705440494323972481582265960084393614600783065930271371329474, 1480956705440494323972481582265960084393621728741087917569230037875, 1480956705440494323972481582265960084393634220460255142089344198114, 1480956705440494323972481582265960084393655404564910726777046050389, 1480956705440494323972481582265960084393690294876746651640832244306, 1480956705440494323972481582265960084393746275198924519220463984359, 1480956705440494323972481582265960084393834002074764762663174114930], [1480956705440494323972481582265960084393606735865235889509020924725, 1480956705440494323972481582265960084393606735865269958251065936328, 1480956705440494323972481582265960084393606735867184328190268930883, 1480956705440494323972481582265960084393606735899683677959766289230, 1480956705440494323972481582265960084393606736185226536099475250697, 1480956705440494323972481582265960084393606737843168378629497783620, 1480956705440494323972481582265960084393606745094298057494938955463, 1480956705440494323972481582265960084393606770915294040530412028218, 1480956705440494323972481582265960084393606849605376549221705755325, 1480956705440494323972481582265960084393607061889285405730446076992, 1480956705440494323972481582265960084393607581108406568597240963115, 1480956705440494323972481582265960084393608752863138270451899898598, 1480956705440494323972481582265960084393611225282165694138014806353, 1480956705440494323972481582265960084393616153025936559105623420220, 1480956705440494323972481582265960084393625505300034160941995615087, 1480956705440494323972481582265960084393642516677064636698934336210, 1480956705440494323972481582265960084393672329520846840437511905733, 1480956705440494323972481582265960084393722888391851530350015983288, 1480956705440494323972481582265960084393806160105716914136203680915, 1480956705440494323972481582265960084393939768235005296208903641982, 1480956705440494323972481582265960084394149147905895941984710650905], [1480956705440494323972481582265960084393606735865235938868003444196, 1480956705440494323972481582265960084393606735865311627767118380289, 1480956705440494323972481582265960084393606735869568163601782189840, 1480956705440494323972481582265960084393606735941856874270396929387, 1480956705440494323972481582265960084393606736577131773236026813836, 1480956705440494323972481582265960084393606740266232033671026418261, 1480956705440494323972481582265960084393606756402347938316300043384, 1480956705440494323972481582265960084393606813866528956461103192335, 1480956705440494323972481582265960084393606988999459448496249758452, 1480956705440494323972481582265960084393607461479496847645137649641, 1480956705440494323972481582265960084393608617144775726832311935776, 1480956705440494323972481582265960084393611225282165635307508963379, 1480956705440494323972481582265960084393616728620167693703427997980, 1480956705440494323972481582265960084393627697468581376767019590717, 1480956705440494323972481582265960084393648515407105399166022783496, 1480956705440494323972481582265960084393686382900091860633987227991, 1480956705440494323972481582265960084393752747467587511377242059524, 1480956705440494323972481582265960084393865294835706876225381699025, 1480956705440494323972481582265960084394050665084425735561990416432, 1480956705440494323972481582265960084394348091470196811723683238651, 1480956705440494323972481582265960084394814197586509160402261386156], [1480956705440494323972481582265960084393606735865236036477733182431, 1480956705440494323972481582265960084393606735865394554544972736374, 1480956705440494323972481582265960084393606735874315298608552519365, 1480956705440494323972481582265960084393606736025865008495012909876, 1480956705440494323972481582265960084393606737357933440952460629027, 1480956705440494323972481582265960084393606745094298079630411653666, 1480956705440494323972481582265960084393606778935934027461965672249, 1480956705440494323972481582265960084393606899460583712922053462480, 1480956705440494323972481582265960084393607266799185117896562453831, 1480956705440494323972481582265960084393608257854866553368885099342, 1480956705440494323972481582265960084393610682004665750811765263501, 1480956705440494323972481582265960084393616153025936383062155380524, 1480956705440494323972481582265960084393627697468581259554057393995, 1480956705440494323972481582265960084393650707400813538087919198586, 1480956705440494323972481582265960084393694378940110539824011211457, 1480956705440494323972481582265960084393773817792404326900230548936, 1480956705440494323972481582265960084393913039711364283990888817199, 1480956705440494323972481582265960084394149147905884717241149487910, 1480956705440494323972481582265960084394538031517610127330807965141, 1480956705440494323972481582265960084395161999911527508939967502372, 1480956705440494323972481582265960084396139847221343957606772841971], [1480956705440494323972481582265960084393606735865236220497941336214, 1480956705440494323972481582265960084393606735865551738904240871541, 1480956705440494323972481582265960084393606735883318217066008477214, 1480956705440494323972481582265960084393606736185226585640151984567, 1480956705440494323972481582265960084393606738839315384851654064982, 1480956705440494323972481582265960084393606754255263836942451380729, 1480956705440494323972481582265960084393606821694952096243255470366, 1480956705440494323972481582265960084393607061889285447312519111819, 1480956705440494323972481582265960084393607793989910992994993919062, 1480956705440494323972481582265960084393609769211984331101104858557, 1480956705440494323972481582265960084393614600783065503950700752094, 1480956705440494323972481582265960084393625505300033762513642196191, 1480956705440494323972481582265960084393648515407105059568175207574, 1480956705440494323972481582265960084393694378940110317439125832257, 1480956705440494323972481582265960084393781426431642048724653465182, 1480956705440494323972481582265960084393939768234997486225634251059, 1480956705440494323972481582265960084394217275598533644308726207766, 1480956705440494323972481582265960084394687907902599331415810164229, 1480956705440494323972481582265960084395463072055116705631820767902, 1480956705440494323972481582265960084396706840825646155392995225607, 1480956705440494323972481582265960084398656015777878738811289628374], [1480956705440494323972481582265960084393606735865236553303631189265, 1480956705440494323972481582265960084393606735865837335339231950364, 1480956705440494323972481582265960084393606735899683775853434780239, 1480956705440494323972481582265960084393606736474978680313898365266, 1480956705440494323972481582265960084393606741533115775753134816069, 1480956705440494323972481582265960084393606770915294137501552086520, 1480956705440494323972481582265960084393606899460583787757720822579, 1480956705440494323972481582265960084393607357310472061883492398494, 1480956705440494323972481582265960084393608752863138316822874615641, 1480956705440494323972481582265960084393612518195292939588876760404, 1480956705440494323972481582265960084393621728741087086858621545975, 1480956705440494323972481582265960084393642516677063833880643002794, 1480956705440494323972481582265960084393686382900091116646201737549, 1480956705440494323972481582265960084393773817792403700125407255216, 1480956705440494323972481582265960084393939768234997081835696336539, 1480956705440494323972481582265960084394241639648372428611531888630, 1480956705440494323972481582265960084394770699298740029696813343009, 1480956705440494323972481582265960084395667952798961015702182667404, 1480956705440494323972481582265960084397145801747454925074924488991, 1480956705440494323972481582265960084399517058875735782036249801474, 1480956705440494323972481582265960084403233200006873366966175350485], [1480956705440494323972481582265960084393606735865237133641126379960, 1480956705440494323972481582265960084393606735866337369004758212033, 1480956705440494323972481582265960084393606735928348956311603959548, 1480956705440494323972481582265960084393606736982592746043400014875, 1480956705440494323972481582265960084393606746252886138941982251792, 1480956705440494323972481582265960084393606800107228331492647442805, 1480956705440494323972481582265960084393607035729583734609053106068, 1480956705440494323972481582265960084393607874997810626069889809183, 1480956705440494323972481582265960084393610433213571207870538810920, 1480956705440494323972481582265960084393617335686385902967013388137, 1480956705440494323972481582265960084393634220460253602865139355500, 1480956705440494323972481582265960084393672329520845329105624221603, 1480956705440494323972481582265960084393752747467586058875860218368, 1480956705440494323972481582265960084393913039711362948702469172765, 1480956705440494323972481582265960084394217275598532531405191942532, 1480956705440494323972481582265960084394770699298739321183216992295, 1480956705440494323972481582265960084395740636661198300819896724888, 1480956705440494323972481582265960084397385603374928644491481486353, 1480956705440494323972481582265960084400095012496350410510474813660, 1480956705440494323972481582265960084404442371566064481484944573227, 1480956705440494323972481582265960084411255414958923395792078227440], [1480956705440494323972481582265960084393606735865238113503618968091, 1480956705440494323972481582265960084393606735867184647217212461514, 1480956705440494323972481582265960084393606735976937853550039826225, 1480956705440494323972481582265960084393606737843168697600301284792, 1480956705440494323972481582265960084393606754255264106372578148031, 1480956705440494323972481582265960084393606849605376865157634491606, 1480956705440494323972481582265960084393607266799185411697018491909, 1480956705440494323972481582265960084393608752863138535787663293620, 1480956705440494323972481582265960084393613282732144179295013770307, 1480956705440494323972481582265960084393625505300033986267332556386, 1480956705440494323972481582265960084393655404564907986295723515321, 1480956705440494323972481582265960084393722888391848817761010606704, 1480956705440494323972481582265960084393865294835704222466882165415, 1480956705440494323972481582265960084394149147905882180695612151022, 1480956705440494323972481582265960084394687907902597017255158206541, 1480956705440494323972481582265960084395667952798959105931468624236, 1480956705440494323972481582265960084397385603374927443234363793899, 1480956705440494323972481582265960084400298672716655363746349647610, 1480956705440494323972481582265960084405096787067367040068128255937, 1480956705440494323972481582265960084412795596642818161619351315496, 1480956705440494323972481582265960084424860978694830329715273038351], [1480956705440494323972481582265960084393606735865239721093259456586, 1480956705440494323972481582265960084393606735868579090231200463749, 1480956705440494323972481582265960084393606736056930358645827516010, 1480956705440494323972481582265960084393606739260157217604958681911, 1480956705440494323972481582265960084393606767432794480162036473402, 1480956705440494323972481582265960084393606931118719032488135247721, 1480956705440494323972481582265960084393607647338947962949840738074, 1480956705440494323972481582265960084393610198629498779218139700075, 1480956705440494323972481582265960084393617975745012411625704130666, 1480956705440494323972481582265960084393638960487544412598662597517, 1480956705440494323972481582265960084393690294876741933102669293706, 1480956705440494323972481582265960084393806160105712223490357888799, 1480956705440494323972481582265960084394050665084421103746650467290, 1480956705440494323972481582265960084394538031517605612728430212721, 1480956705440494323972481582265960084395463072055112413414328394682, 1480956705440494323972481582265960084397145801747451037247370030291, 1480956705440494323972481582265960084400095012496347231196516705674, 1480956705440494323972481582265960084405096787067365062011287840405, 1480956705440494323972481582265960084413335245187405569125181542826, 1480956705440494323972481582265960084426554310942253176607101520647, 1480956705440494323972481582265960084447270979776497311293975663226], [1480956705440494323972481582265960084393606735865242291514981871309, 1480956705440494323972481582265960084393606735870814956362693034896, 1480956705440494323972481582265960084393606736185227432582810187579, 1480956705440494323972481582265960084393606741533116574342801261942, 1480956705440494323972481582265960084393606788572219652640250155617, 1480956705440494323972481582265960084393607061889286293332648882124, 1480956705440494323972481582265960084393608257854867418835615206271, 1480956705440494323972481582265960084393612518195293730219939507234, 1480956705440494323972481582265960084393625505300034557933606625237, 1480956705440494323972481582265960084393660548590043158327468377992, 1480956705440494323972481582265960084393746275198916627575575813539, 1480956705440494323972481582265960084393939768234997432456332629646, 1480956705440494323972481582265960084394348091470189006801618069289, 1480956705440494323972481582265960084395161999911519821230864529732, 1480956705440494323972481582265960084396706840825638690068777632167, 1480956705440494323972481582265960084399517058875728721101970122554, 1480956705440494323972481582265960084404442371566058129064261245021, 1480956705440494323972481582265960084412795596642813010455785679744, 1480956705440494323972481582265960084426554310942250003500376300427, 1480956705440494323972481582265960084448631019879835420731948415142, 1480956705440494323972481582265960084483229337808171830876835341169], [1480956705440494323972481582265960084393606735865246307160880195020, 1480956705440494323972481582265960084393606735874316719527481258209, 1480956705440494323972481582265960084393606736386214169385593275304, 1480956705440494323972481582265960084393606745094299500493200363051, 1480956705440494323972481582265960084393606821694953489700840144084, 1480956705440494323972481582265960084393607266799186535724476398325, 1480956705440494323972481582265960084393609214528943827172200416624, 1480956705440494323972481582265960084393616153025937750289903983759, 1480956705440494323972481582265960084393637304563251855269932402076, 1480956705440494323972481582265960084393694378940111467041333360969, 1480956705440494323972481582265960084393834002074751899330275625080, 1480956705440494323972481582265960084394149147905883106544129319539, 1480956705440494323972481582265960084394814197586496383792185897764, 1480956705440494323972481582265960084396139847221331298209659550301, 1480956705440494323972481582265960084398656015777866301799061715904, 1480956705440494323972481582265960084403233200006861334343885352535, 1480956705440494323972481582265960084411255414958912071683384580204, 1480956705440494323972481582265960084424860978694820206863697083569, 1480956705440494323972481582265960084447270979776489166499240123976, 1480956705440494323972481582265960084483229337808166859188825022139, 1480956705440494323972481582265960084539582962391823324132888397940]] 39 | 40 | 41 | =============================== Recovered Secret in Committee B ====================================== 42 | recovered_Secret: 43 | [1480956705440494323972481582265960084393606735865235848513622358902, -97338895, 190946888, 148158372, 66788074, 8073370, 136787461, 98049447, 52708154, 109487978, 21270718] 44 | --------------------------------------------------------------------------------