-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathblockchain.mol
108 lines (88 loc) · 2.3 KB
/
blockchain.mol
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
/* Basic Types */
array Uint32 [byte; 4];
array Uint64 [byte; 8];
array Uint128 [byte; 16];
array Byte32 [byte; 32];
array Uint256 [byte; 32];
vector Bytes <byte>;
option BytesOpt (Bytes);
vector BytesVec <Bytes>;
vector Byte32Vec <Byte32>;
/* Types for Chain */
option ScriptOpt (Script);
array ProposalShortId [byte; 10];
vector UncleBlockVec <UncleBlock>;
vector TransactionVec <Transaction>;
vector ProposalShortIdVec <ProposalShortId>;
vector CellDepVec <CellDep>;
vector CellInputVec <CellInput>;
vector CellOutputVec <CellOutput>;
table Script {
code_hash: Byte32,
hash_type: byte,
args: Bytes,
}
struct OutPoint {
tx_hash: Byte32,
index: Uint32,
}
struct CellInput {
since: Uint64,
previous_output: OutPoint,
}
table CellOutput {
capacity: Uint64,
lock: Script,
type_: ScriptOpt,
}
struct CellDep {
out_point: OutPoint,
dep_type: byte,
}
table RawTransaction {
version: Uint32,
cell_deps: CellDepVec,
header_deps: Byte32Vec,
inputs: CellInputVec,
outputs: CellOutputVec,
outputs_data: BytesVec,
}
table Transaction {
raw: RawTransaction,
witnesses: BytesVec,
}
struct RawHeader {
version: Uint32,
compact_target: Uint32,
timestamp: Uint64,
number: Uint64,
epoch: Uint64,
parent_hash: Byte32,
transactions_root: Byte32,
proposals_hash: Byte32,
uncles_hash: Byte32,
dao: Byte32,
}
struct Header {
raw: RawHeader,
nonce: Uint128,
}
table UncleBlock {
header: Header,
proposals: ProposalShortIdVec,
}
table Block {
header: Header,
uncles: UncleBlockVec,
transactions: TransactionVec,
proposals: ProposalShortIdVec,
}
table CellbaseWitness {
lock: Script,
message: Bytes,
}
table WitnessArgs {
lock: BytesOpt, // Lock args
input_type: BytesOpt, // Type args for input
output_type: BytesOpt, // Type args for output
}