3
3
syntax = "proto3" ;
4
4
package cusf.mainchain ;
5
5
6
+ enum AddressType {
7
+ ADDRESS_TYPE_UNSPECIFIED = 0 ;
8
+ ADDRESS_TYPE_DEFAULT = 1 ;
9
+ ADDRESS_TYPE_BECH32 = 2 ;
10
+ ADDRESS_TYPE_LEGACY = 3 ;
11
+ ADDRESS_TYPE_P2SH_SEGWIT = 4 ;
12
+ }
13
+
6
14
message BlockHeaderInfo {
7
15
bytes block_hash = 1 ;
8
16
bytes prev_block_hash = 2 ;
@@ -11,10 +19,28 @@ message BlockHeaderInfo {
11
19
bytes work = 4 ;
12
20
}
13
21
22
+ enum Network {
23
+ NETWORK_UNSPECIFIED = 0 ;
24
+ NETWORK_MAINNET = 1 ;
25
+ NETWORK_REGTEST = 2 ;
26
+ NETWORK_SIGNET = 3 ;
27
+ NETWORK_TESTNET = 3 ;
28
+ }
29
+
30
+ message OutPoint {
31
+ bytes txid = 1 ;
32
+ uint32 vout = 2 ;
33
+ }
34
+
35
+ message Output {
36
+ bytes address = 2 ;
37
+ uint64 value_sats = 3 ;
38
+ }
39
+
14
40
message Deposit {
15
41
uint64 sequence_number = 1 ;
16
- bytes address = 2 ;
17
- uint64 value = 3 ;
42
+ OutPoint outpoint = 2 ;
43
+ Output output = 3 ;
18
44
}
19
45
20
46
enum WithdrawalBundleEventType {
@@ -28,22 +54,67 @@ message WithdrawalBundleEvent {
28
54
WithdrawalBundleEventType withdrawal_bundle_event_type = 2 ;
29
55
}
30
56
57
+ // Specific to an individual sidechain slot
31
58
message BlockInfo {
32
59
repeated Deposit deposits = 1 ;
33
60
optional WithdrawalBundleEvent withdrawal_bundle_event = 2 ;
34
- repeated bytes bmm_hashes = 3 ;
61
+ optional bytes bmm_commitment = 3 ;
35
62
}
36
63
37
64
service Mainchain {
65
+ rpc BroadcastWithdrawalBundle (BroadcastWithdrawalBundleRequest )
66
+ returns (BroadcastWithdrawalBundleResponse );
67
+ rpc CreateBmmCriticalDataTransaction (CreateBmmCriticalDataTransactionRequest )
68
+ returns (CreateBmmCriticalDataTransactionResponse );
69
+ rpc CreateNewAddress (CreateNewAddressRequest )
70
+ returns (CreateNewAddressResponse );
71
+ // Regtest only
72
+ rpc GenerateBlocks (GenerateBlocksRequest )
73
+ returns (GenerateBlocksResponse );
38
74
rpc GetBlockHeaderInfo (GetBlockHeaderInfoRequest )
39
75
returns (GetBlockHeaderInfoResponse );
40
76
rpc GetBlockInfo (GetBlockInfoRequest ) returns (GetBlockInfoResponse );
41
77
rpc GetBmmHStarCommitments (GetBmmHStarCommitmentsRequest )
42
78
returns (GetBmmHStarCommitmentsResponse );
79
+ rpc GetChainInfo (GetChainInfoRequest ) returns (GetChainInfoResponse );
43
80
rpc GetChainTip (GetChainTipRequest ) returns (GetChainTipResponse );
81
+ rpc GetTwoWayPegData (GetTwoWayPegDataRequest )
82
+ returns (GetTwoWayPegDataResponse );
44
83
rpc SubscribeEvents (SubscribeEventsRequest ) returns (stream EventResponse );
45
84
}
46
85
86
+ message BroadcastWithdrawalBundleRequest {
87
+ uint32 sidechain_id = 1 ;
88
+ bytes transaction = 2 ;
89
+ }
90
+ message BroadcastWithdrawalBundleResponse {
91
+ }
92
+
93
+ message CreateBmmCriticalDataTransactionRequest {
94
+ uint32 sidechain_id = 1 ;
95
+ uint64 value_sats = 2 ;
96
+ uint32 height = 3 ;
97
+ bytes critical_hash = 4 ;
98
+ bytes prev_bytes = 5 ;
99
+ }
100
+ message CreateBmmCriticalDataTransactionResponse {
101
+ bytes txid = 1 ;
102
+ }
103
+
104
+ message CreateNewAddressRequest {
105
+ optional string label = 1 ;
106
+ AddressType address_type = 2 ;
107
+ }
108
+ message CreateNewAddressResponse {
109
+ string address = 1 ;
110
+ }
111
+
112
+ message GenerateBlocksRequest {
113
+ uint32 blocks = 1 ;
114
+ }
115
+ message GenerateBlocksResponse {
116
+ }
117
+
47
118
message GetBlockHeaderInfoRequest {
48
119
bytes block_hash = 1 ;
49
120
}
@@ -53,6 +124,7 @@ message GetBlockHeaderInfoResponse {
53
124
54
125
message GetBlockInfoRequest {
55
126
bytes block_hash = 1 ;
127
+ uint32 sidechain_id = 2 ;
56
128
}
57
129
message GetBlockInfoResponse {
58
130
BlockHeaderInfo header_info = 1 ;
@@ -64,7 +136,22 @@ message GetBmmHStarCommitmentsRequest {
64
136
uint32 sidechain_id = 2 ;
65
137
}
66
138
message GetBmmHStarCommitmentsResponse {
67
- repeated bytes commitments = 1 ;
139
+ message BlockNotFoundError {
140
+ bytes block_hash = 1 ;
141
+ }
142
+ message Commitments {
143
+ repeated bytes commitments = 1 ;
144
+ }
145
+ oneof result {
146
+ BlockNotFoundError block_not_found = 1 ;
147
+ Commitments commitments = 2 ;
148
+ }
149
+ }
150
+
151
+ message GetChainInfoRequest {
152
+ }
153
+ message GetChainInfoResponse {
154
+ Network network = 1 ;
68
155
}
69
156
70
157
message GetChainTipRequest {
@@ -73,7 +160,21 @@ message GetChainTipResponse {
73
160
BlockHeaderInfo block_header_info = 1 ;
74
161
}
75
162
163
+ message GetTwoWayPegDataRequest {
164
+ uint32 sidechain_id = 1 ;
165
+ optional bytes start_block_hash = 2 ;
166
+ bytes end_block_hash = 3 ;
167
+ }
168
+ message GetTwoWayPegDataResponse {
169
+ message ResponseItem {
170
+ BlockHeaderInfo block_header_info = 1 ;
171
+ BlockInfo block_info = 2 ;
172
+ }
173
+ repeated ResponseItem blocks = 1 ;
174
+ }
175
+
76
176
message SubscribeEventsRequest {
177
+ uint32 sidechain_id = 1 ;
77
178
}
78
179
message EventResponse {
79
180
message Event {
0 commit comments