-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAPI definition.txt
More file actions
148 lines (100 loc) · 4.48 KB
/
Copy pathAPI definition.txt
File metadata and controls
148 lines (100 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
DKG-BLS terminiology:
'share' refers to the shares created to perform the BLS and the recover function to generate random numbers (done for every new block)
'dkg_share' refers to the shares exchange to setup a new DKG, done every DKG_RENEWAL_INTERVAL
#####################
#p2p
#####################
################## RX ##################
block get_block()
#returns a new block or None if there is no data
transaction get_tx()
#returns a new transaction or None if there is no data
answer_block_queries(blocks bls)
#list of the blocks asked from the network
answer_tx_pool_query(transactions txs)
#response with transactions in the transaction pool (to send to the network)
member, share get_dkg_share()
#returns a DKG share and the originating member
share get_share()
#returns a new share received from the network or None if there is no data
################## TX ##################
broadcast_block(block bl)
#sends a new block to the network
broadcast_tx(transaction tx)
#send a new transaction to the network
block_numbers get_block_queries()
#returns a list of block numbers queried by the network or None if no queries are pending
transaction tx_pool_query()
#returns True if the network requests the transaction pool, False otherwise
send_dkg_share(id, verif_vector, secret_key_share_contrib)
#sends a DKG individual verification vector and secret key share contribution to the specified member
broadcast_share(share sh)
#broadcasts a new share to the network
#####################
#consensus
#####################
get_threshold()
#returns the configured threshold T
signer get_next_signer(count ct)
#returns the next IP that has to sign the next block. If count != 0, it should recalculate the random number count times
################## share management ##################
share create_share(block_number)
#returns a new share to send to the network
store_share(share sh)
#saves a new share internally
shares_ready()
#returns True if the module has received the minimum T shares, False otherwise
################## DKG management ##################
new_dkg()
#starts a new DKG. Returns a dictionary of (memberID, data), data is a dictionary with verif_vector and secret_key_share_contrib elements for a specific member
verifyContributionShare(member, share['verif_vector'], share['secret_key_share_contrib'])
#Returns True if the share share is correct, false otherwise. Stores the share internally, and if it has received all shares calculates the new VV and secret key.
dkg_ready()
#Returns True if the new DKG is ready, false otherwise
OLD#################################################################
#I think not needed
calculate_next_signer(myIPs ip, timestamp t)
#calculates the next IP that will sign a block. It is stored in an internal variable that get_next_signer() uses
#myIPs is the set of IPs owned by the node, updated each time a block is added
#timestamp is the timestamp of the last block added to the chain, used to randomly select the new signer
OLD#################################################################
#####################
#chain
#####################
add_pending_transaction (transaction tx)
#adds a transaction to the pool of unconfirmed transactions
#raises an exception if there is an error
add_block (block bl)
#adds a new block to the chain. DOES NOT CHECK if the block signature is correct
#Internally, checks ALL transactions
#raises an exception if there is an error
block create_block(signer sig)
#Creates and signs a new block with the IP in sig
#returns the new block but does not add it to the chain
info query_eid(query q)
#returns an RLOC record or a MS list corresponding to the EID in q
verify_block_signature(block bl, ip_addres ip)
#Returns True if the block bl is signed with the key associated with ip address ip, False otherwise
block get_block(block_number num)
#returns the block with number num
transactions get_transaction_pool()
#returns the transactions in the pool of pending transactions
block get_head_block()
#returns the last block of the chain
#####################
#user
#####################
transaction get_tx()
#returns a new transaction submitted by the user or None if there is no data
#####################
#oor
#####################
get_query(query q)
#returns an EID query from OOR or None if there is no data
send(info i)
#writes the RLOC record or MS list to the OOR socket
#data objects
block
signer: IP that has to sign the new block
transaction
myIPs: Two python lists of IP addresses owned by the node (one for IPv4, one for IPv6)