-
Notifications
You must be signed in to change notification settings - Fork 6
/
blockchain.proto
193 lines (169 loc) · 4.01 KB
/
blockchain.proto
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
syntax = "proto3";
package types;
option go_package = "/types";
message Block {
bytes hash = 1;
BlockHeader header = 2;
BlockBody body = 3;
}
message BlockHeader {
bytes chainID = 1; // chain identifier
bytes prevBlockHash = 2; // hash of previous block
uint64 blockNo = 3; // block number
int64 timestamp = 4; // block creation time stamp
bytes blocksRootHash = 5; // hash of root of block merkle tree
bytes txsRootHash = 6; // hash of root of transaction merkle tree
bytes receiptsRootHash = 7; // hash of root of receipt merkle tree
uint64 confirms = 8; // number of blocks this block is able to confirm
bytes pubKey = 9; // block producer's public key
bytes coinbaseAccount = 10; // address of account to receive fees
bytes sign = 11; // block producer's signature of BlockHeader
bytes consensus = 12; // consensus meta
// CAUTION: WHENEVER A NEW FIELD ADDED HERE, types.lastFieldOfBH MUST BE
// REPLACE BY IT.
}
message BlockBody {
repeated Tx txs = 1;
}
message TxList {
repeated Tx txs = 1;
}
enum TxType {
NORMAL = 0;
GOVERNANCE = 1;
REDEPLOY = 2;
FEEDELEGATION = 3;
TRANSFER = 4;
CALL = 5;
DEPLOY = 6;
}
message Tx {
bytes hash = 1;
TxBody body = 2;
}
message TxBody {
uint64 nonce = 1; // increasing number used only once per sender account
bytes account = 2; // decoded account address
bytes recipient = 3; // decoded account address
bytes amount = 4; // variable-length big integer
bytes payload = 5;
uint64 gasLimit = 6; // maximum gas used for this transaction. 0 = no limit
bytes gasPrice = 7; // variable-length big integer. currently not used
TxType type = 8;
bytes chainIdHash = 9; // hash value of chain identifier in the block
bytes sign = 10; // sender's signature for this TxBody
}
// TxIdx specifies a transaction's block hash and index within the block body
message TxIdx {
bytes blockHash = 1;
int32 idx = 2;
}
message TxInBlock {
TxIdx txIdx = 1;
Tx tx = 2;
}
message State {
uint64 nonce = 1;
bytes balance = 2;
bytes codeHash = 3;
bytes storageRoot = 4;
uint64 sqlRecoveryPoint = 5;
}
message AccountProof {
State state = 1;
bool inclusion = 2;
bytes key = 3;
bytes proofKey = 4;
bytes proofVal = 5;
bytes bitmap = 6;
uint32 height = 7;
repeated bytes auditPath = 8;
}
message ContractVarProof{
bytes value = 1;
bool inclusion = 2;
reserved 3;
bytes proofKey = 4;
bytes proofVal = 5;
bytes bitmap = 6;
uint32 height = 7;
repeated bytes auditPath = 8;
bytes key = 9;
}
message StateQueryProof {
AccountProof contractProof = 1;
repeated ContractVarProof varProofs = 2;
}
message Receipt {
bytes contractAddress = 1;
string status = 2;
string ret = 3;
bytes txHash = 4;
bytes feeUsed = 5;
bytes cumulativeFeeUsed = 6;
bytes bloom = 7;
repeated Event events = 8;
uint64 blockNo = 9;
bytes blockHash = 10;
int32 txIndex = 11;
bytes from = 12;
bytes to = 13;
bool feeDelegation = 14;
uint64 gasUsed = 15;
}
message Event {
bytes contractAddress = 1;
string eventName = 2;
string jsonArgs = 3;
int32 eventIdx = 4;
bytes txHash = 5;
bytes blockHash = 6;
uint64 blockNo = 7;
int32 txIndex = 8;
}
message FnArgument {
string name = 1;
}
message Function {
string name = 1;
repeated FnArgument arguments = 2;
bool payable = 3;
bool view = 4;
bool fee_delegation = 5;
}
message StateVar {
string name = 1;
string type = 2;
int32 len = 3;
}
message ABI {
string version = 1;
string language = 2;
repeated Function functions = 3;
repeated StateVar state_variables = 4;
}
message Query {
bytes contractAddress = 1;
bytes queryinfo= 2;
}
message StateQuery {
bytes contractAddress = 1;
reserved 2;
bytes root = 3;
bool compressed = 4;
repeated bytes storageKeys = 5;
}
message FilterInfo {
bytes contractAddress = 1;
string eventName = 2;
uint64 blockfrom = 3;
uint64 blockto = 4;
bool desc = 5;
bytes argFilter = 6;
int32 recentBlockCnt = 7;
}
message Proposal {
string id = 1;
string description = 3;
uint32 multipleChoice = 6;
}