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