-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcardano.proto
157 lines (136 loc) · 4.56 KB
/
cardano.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
// Copyright 2021 Shift Crypto AG
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package shiftcrypto.bitbox02;
import "common.proto";
message CardanoXpubsRequest {
repeated Keypath keypaths = 1;
}
message CardanoXpubsResponse {
repeated bytes xpubs = 1;
}
enum CardanoNetwork {
CardanoMainnet = 0;
CardanoTestnet = 1;
}
message CardanoScriptConfig {
message PkhSkh {
repeated uint32 keypath_payment = 1;
repeated uint32 keypath_stake = 2;
}
// Entries correspond to address types as described in:
// https://github.com/cardano-foundation/CIPs/blob/6c249ef48f8f5b32efc0ec768fadf4321f3173f2/CIP-0019/CIP-0019.md
// See also:
// https://github.com/input-output-hk/cardano-ledger-specs/blob/d0aa86ded0b973b09b629e5aa62aa1e71364d088/eras/alonzo/test-suite/cddl-files/alonzo.cddl#L137
oneof config {
// Shelley PaymentKeyHash & StakeKeyHash
PkhSkh pkh_skh = 1;
}
}
message CardanoAddressRequest {
CardanoNetwork network = 1;
bool display = 2;
CardanoScriptConfig script_config = 3;
}
// Max allowed transaction size is 16384 bytes according to
// https://github.com/cardano-foundation/CIPs/blob/master/CIP-0009/CIP-0009.md. Unlike with BTC, we
// can fit the whole request in RAM and don't need to stream.
//
// See also: https://github.com/input-output-hk/cardano-ledger-specs/blob/d0aa86ded0b973b09b629e5aa62aa1e71364d088/eras/alonzo/test-suite/cddl-files/alonzo.cddl#L50
message CardanoSignTransactionRequest {
message Input {
repeated uint32 keypath = 1;
bytes prev_out_hash = 2;
uint32 prev_out_index = 3;
}
// https://github.com/input-output-hk/cardano-ledger/blob/d0aa86ded0b973b09b629e5aa62aa1e71364d088/eras/alonzo/test-suite/cddl-files/alonzo.cddl#L358
message AssetGroup {
bytes policy_id = 1;
message Token {
bytes asset_name = 1;
// Number of tokens transacted of this asset.
uint64 value = 2;
}
repeated Token tokens = 2;
}
message Output {
string encoded_address = 1;
uint64 value = 2;
// Optional. If provided, this is validated as a change output.
CardanoScriptConfig script_config = 3;
repeated AssetGroup asset_groups = 4;
}
// See https://github.com/IntersectMBO/cardano-ledger/blob/cardano-ledger-conway-1.12.0.0/eras/conway/impl/cddl-files/conway.cddl#L273
message Certificate {
message StakeDelegation {
repeated uint32 keypath = 1;
bytes pool_keyhash = 2;
}
message VoteDelegation {
enum CardanoDRepType {
KEY_HASH = 0;
SCRIPT_HASH = 1;
ALWAYS_ABSTAIN = 2;
ALWAYS_NO_CONFIDENCE = 3;
}
// keypath in this instance refers to stake credential
repeated uint32 keypath = 1;
CardanoDRepType type = 2;
optional bytes drep_credhash = 3;
}
oneof cert {
Keypath stake_registration = 1;
Keypath stake_deregistration = 2;
StakeDelegation stake_delegation = 3;
VoteDelegation vote_delegation = 10;
}
}
message Withdrawal {
repeated uint32 keypath = 1;
uint64 value = 2;
}
CardanoNetwork network = 1;
repeated Input inputs = 2;
repeated Output outputs = 3;
uint64 fee = 4;
uint64 ttl = 5;
repeated Certificate certificates = 6;
repeated Withdrawal withdrawals = 7;
uint64 validity_interval_start = 8;
bool allow_zero_ttl = 9; // include ttl even if it is zero
// Tag arrays in the transaction serialization with the 258 tag.
// See https://github.com/IntersectMBO/cardano-ledger/blob/6e2d37cc0f47bd02e89b4ce9f78b59c35c958e96/eras/conway/impl/cddl-files/extra.cddl#L5
bool tag_cbor_sets = 10;
}
message CardanoSignTransactionResponse {
message ShelleyWitness {
bytes public_key = 1;
bytes signature = 2;
}
repeated ShelleyWitness shelley_witnesses = 1;
}
message CardanoRequest {
oneof request {
CardanoXpubsRequest xpubs = 1;
CardanoAddressRequest address = 2;
CardanoSignTransactionRequest sign_transaction = 3;
}
}
message CardanoResponse {
oneof response {
CardanoXpubsResponse xpubs = 1;
PubResponse pub = 2;
CardanoSignTransactionResponse sign_transaction = 3;
}
}