Skip to content

Commit ad5abeb

Browse files
committed
Add RPCs needed for thunder-cusf
1 parent 95b2c97 commit ad5abeb

File tree

1 file changed

+117
-4
lines changed

1 file changed

+117
-4
lines changed

proto/mainchain.proto

+117-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
syntax = "proto3";
44
package cusf.mainchain;
55

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+
614
message BlockHeaderInfo {
715
bytes block_hash = 1;
816
bytes prev_block_hash = 2;
@@ -11,10 +19,28 @@ message BlockHeaderInfo {
1119
bytes work = 4;
1220
}
1321

22+
enum Network {
23+
NETWORK_UNSPECIFIED = 0;
24+
NETWORK_MAINNET = 1;
25+
NETWORK_REGTEST = 2;
26+
NETWORK_SIGNET = 3;
27+
NETWORK_TESTNET = 4;
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+
1440
message Deposit {
1541
uint64 sequence_number = 1;
16-
bytes address = 2;
17-
uint64 value = 3;
42+
OutPoint outpoint = 2;
43+
Output output = 3;
1844
}
1945

2046
enum WithdrawalBundleEventType {
@@ -28,22 +54,79 @@ message WithdrawalBundleEvent {
2854
WithdrawalBundleEventType withdrawal_bundle_event_type = 2;
2955
}
3056

57+
// Specific to an individual sidechain slot
3158
message BlockInfo {
3259
repeated Deposit deposits = 1;
3360
optional WithdrawalBundleEvent withdrawal_bundle_event = 2;
34-
repeated bytes bmm_hashes = 3;
61+
optional bytes bmm_commitment = 3;
3562
}
3663

3764
service Mainchain {
65+
rpc BroadcastWithdrawalBundle(BroadcastWithdrawalBundleRequest)
66+
returns (BroadcastWithdrawalBundleResponse);
67+
rpc CreateBmmCriticalDataTransaction(CreateBmmCriticalDataTransactionRequest)
68+
returns (CreateBmmCriticalDataTransactionResponse);
69+
rpc CreateDepositTransaction(CreateDepositTransactionRequest)
70+
returns (CreateDepositTransactionResponse);
71+
rpc CreateNewAddress(CreateNewAddressRequest)
72+
returns (CreateNewAddressResponse);
73+
// Regtest only
74+
rpc GenerateBlocks(GenerateBlocksRequest)
75+
returns (GenerateBlocksResponse);
3876
rpc GetBlockHeaderInfo(GetBlockHeaderInfoRequest)
3977
returns (GetBlockHeaderInfoResponse);
4078
rpc GetBlockInfo(GetBlockInfoRequest) returns (GetBlockInfoResponse);
4179
rpc GetBmmHStarCommitments(GetBmmHStarCommitmentsRequest)
4280
returns (GetBmmHStarCommitmentsResponse);
81+
rpc GetChainInfo(GetChainInfoRequest) returns (GetChainInfoResponse);
4382
rpc GetChainTip(GetChainTipRequest) returns (GetChainTipResponse);
83+
rpc GetTwoWayPegData(GetTwoWayPegDataRequest)
84+
returns (GetTwoWayPegDataResponse);
4485
rpc SubscribeEvents(SubscribeEventsRequest) returns (stream EventResponse);
4586
}
4687

88+
message BroadcastWithdrawalBundleRequest {
89+
uint32 sidechain_id = 1;
90+
bytes transaction = 2;
91+
}
92+
message BroadcastWithdrawalBundleResponse {
93+
}
94+
95+
message CreateBmmCriticalDataTransactionRequest {
96+
uint32 sidechain_id = 1;
97+
uint64 value_sats = 2;
98+
uint32 height = 3;
99+
bytes critical_hash = 4;
100+
bytes prev_bytes = 5;
101+
}
102+
message CreateBmmCriticalDataTransactionResponse {
103+
bytes txid = 1;
104+
}
105+
106+
message CreateDepositTransactionRequest {
107+
uint32 sidechain_id = 1;
108+
string address = 2;
109+
uint64 value_sats = 3;
110+
uint64 fee_sats = 4;
111+
}
112+
message CreateDepositTransactionResponse {
113+
bytes txid = 1;
114+
}
115+
116+
message CreateNewAddressRequest {
117+
optional string label = 1;
118+
AddressType address_type = 2;
119+
}
120+
message CreateNewAddressResponse {
121+
string address = 1;
122+
}
123+
124+
message GenerateBlocksRequest {
125+
uint32 blocks = 1;
126+
}
127+
message GenerateBlocksResponse {
128+
}
129+
47130
message GetBlockHeaderInfoRequest {
48131
bytes block_hash = 1;
49132
}
@@ -53,6 +136,7 @@ message GetBlockHeaderInfoResponse {
53136

54137
message GetBlockInfoRequest {
55138
bytes block_hash = 1;
139+
uint32 sidechain_id = 2;
56140
}
57141
message GetBlockInfoResponse {
58142
BlockHeaderInfo header_info = 1;
@@ -64,7 +148,22 @@ message GetBmmHStarCommitmentsRequest {
64148
uint32 sidechain_id = 2;
65149
}
66150
message GetBmmHStarCommitmentsResponse {
67-
repeated bytes commitments = 1;
151+
message BlockNotFoundError {
152+
bytes block_hash = 1;
153+
}
154+
message Commitments {
155+
repeated bytes commitments = 1;
156+
}
157+
oneof result {
158+
BlockNotFoundError block_not_found = 1;
159+
Commitments commitments = 2;
160+
}
161+
}
162+
163+
message GetChainInfoRequest {
164+
}
165+
message GetChainInfoResponse {
166+
Network network = 1;
68167
}
69168

70169
message GetChainTipRequest {
@@ -73,7 +172,21 @@ message GetChainTipResponse {
73172
BlockHeaderInfo block_header_info = 1;
74173
}
75174

175+
message GetTwoWayPegDataRequest {
176+
uint32 sidechain_id = 1;
177+
optional bytes start_block_hash = 2;
178+
bytes end_block_hash = 3;
179+
}
180+
message GetTwoWayPegDataResponse {
181+
message ResponseItem {
182+
BlockHeaderInfo block_header_info = 1;
183+
BlockInfo block_info = 2;
184+
}
185+
repeated ResponseItem blocks = 1;
186+
}
187+
76188
message SubscribeEventsRequest {
189+
uint32 sidechain_id = 1;
77190
}
78191
message EventResponse {
79192
message Event {

0 commit comments

Comments
 (0)