1syntax = "proto2"; 2 3// Sugar for easier handling in Java 4option java_package = "com.shapeshift.keepkey.lib.protobuf"; 5option java_outer_classname = "KeepKeyMessageEos"; 6 7enum EosPublicKeyKind { 8 EOS = 0; 9 EOS_K1 = 1; 10 EOS_R1 = 2; 11} 12 13/** 14 * Request: Ask device for Eos public key corresponding to address_n path 15 * @start 16 * @next EosPublicKey 17 * @next Failure 18 */ 19message EosGetPublicKey { 20 repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node 44'/194'/0' 21 optional bool show_display = 2; // optionally show on display before sending the result 22 optional EosPublicKeyKind kind = 3; // format to display the pubkey in 23} 24 25/** 26 * Response: Contains an Eos public key derived from device private seed 27 * @end 28 */ 29message EosPublicKey { 30 optional string wif_public_key = 1; // EOS pub key in Base58 encoding 31 optional bytes raw_public_key = 2; // Raw public key 32} 33 34/** 35 * Request: Ask device to sign transaction 36 * @start 37 * @next EosTxRequest 38 * @next Failure 39 */ 40 message EosSignTx { 41 repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node 44'/194'/0' 42 optional bytes chain_id = 2; // 256-bit long chain id 43 optional EosTxHeader header = 3; // EOS transaction header 44 optional uint32 num_actions = 4; // number of actions 45} 46 47/** 48* Structure representing EOS transaction header 49*/ 50message EosTxHeader { 51 required uint32 expiration = 1; // time at which transaction expires 52 required uint32 ref_block_num = 2; // 16-bit specifies a block num in the last 2^16 blocks. 53 required uint32 ref_block_prefix = 3; // specifies the lower 32 bits of the blockid at get_ref_blocknum 54 required uint32 max_net_usage_words = 4; // upper limit on total network bandwidth (in 8 byte words) billed for this transaction 55 required uint32 max_cpu_usage_ms = 5; // 8-bit upper limit on the total CPU time billed for this transaction 56 required uint32 delay_sec = 6; // number of seconds to delay this transaction for during which it may be canceled. 57} 58 59/** 60 * Response: Device asks to upload next action 61 * @next EosTxActionAck 62 */ 63message EosTxActionRequest { 64} 65 66/** 67 * Request: Next action data that needs to be uploaded 68 * @next EosTxActionRequest 69 * @next EosSignedTx 70 * @next Failure 71 */ 72message EosTxActionAck { 73 optional EosActionCommon common = 1; 74 optional EosActionTransfer transfer = 2; 75 optional EosActionDelegate delegate = 3; 76 optional EosActionUndelegate undelegate = 4; 77 optional EosActionRefund refund = 5; 78 optional EosActionBuyRam buy_ram = 6; 79 optional EosActionBuyRamBytes buy_ram_bytes = 7; 80 optional EosActionSellRam sell_ram = 8; 81 optional EosActionVoteProducer vote_producer = 9; 82 optional EosActionUpdateAuth update_auth = 10; 83 optional EosActionDeleteAuth delete_auth = 11; 84 optional EosActionLinkAuth link_auth = 12; 85 optional EosActionUnlinkAuth unlink_auth = 13; 86 optional EosActionNewAccount new_account = 14; 87 optional EosActionUnknown unknown = 15; 88 89} 90 91/** 92* Structure representing asset type 93*/ 94message EosAsset { 95 optional sint64 amount = 1 [jstype = JS_STRING]; 96 optional uint64 symbol = 2 [jstype = JS_STRING]; // First 8-bits used for precission. 97} 98 99/** 100* Structure representing action permission level 101*/ 102message EosPermissionLevel { 103 optional uint64 actor = 1 [jstype = JS_STRING]; 104 optional uint64 permission = 2 [jstype = JS_STRING]; 105} 106 107/** 108* Structure representing auth key 109*/ 110message EosAuthorizationKey { 111 optional uint32 type = 1; 112 optional bytes key = 2; 113 optional uint32 weight = 3; 114 repeated uint32 address_n = 4; 115} 116 117/** 118* Structure representing auth account 119*/ 120message EosAuthorizationAccount { 121 optional EosPermissionLevel account = 1; 122 optional uint32 weight = 2; 123} 124 125/** 126* Structure representing auth delays 127*/ 128message EosAuthorizationWait { 129 optional uint32 wait_sec = 1; 130 optional uint32 weight = 2; 131} 132 133/** 134* Structure representing authorization settings 135*/ 136message EosAuthorization { 137 optional uint32 threshold = 1; 138 repeated EosAuthorizationKey keys = 2; 139 repeated EosAuthorizationAccount accounts = 3; 140 repeated EosAuthorizationWait waits = 4; 141} 142 143/** 144* Structure representing the common part of every action 145*/ 146message EosActionCommon { 147 optional uint64 account = 1 [jstype = JS_STRING]; // Contract name 148 optional uint64 name = 2 [jstype = JS_STRING]; // Action name 149 repeated EosPermissionLevel authorization = 3; 150} 151 152/** 153* Structure representing transfer data structure 154*/ 155message EosActionTransfer { 156 optional uint64 sender = 1 [jstype = JS_STRING]; // Asset sender 157 optional uint64 receiver = 2 [jstype = JS_STRING]; 158 optional EosAsset quantity = 3; 159 optional string memo = 4; 160} 161 162/** 163* Structure representing delegation data structure 164*/ 165message EosActionDelegate { 166 optional uint64 sender = 1 [jstype = JS_STRING]; 167 optional uint64 receiver = 2 [jstype = JS_STRING]; 168 optional EosAsset net_quantity = 3; // Asset format '1.0000 EOS' 169 optional EosAsset cpu_quantity = 4; // Asset format '1.0000 EOS' 170 optional bool transfer = 5; // Transfer delegated tokens or not. 171} 172 173/** 174* Structure representing the removal of delegated resources from `payer` 175*/ 176message EosActionUndelegate { 177 optional uint64 sender = 1 [jstype = JS_STRING]; 178 optional uint64 receiver = 2 [jstype = JS_STRING]; 179 optional EosAsset net_quantity = 3; // Asset format '1.0000 EOS' 180 optional EosAsset cpu_quantity = 4; // Asset format '1.0000 EOS' 181} 182 183/** 184* Structure representing fallbalck if undelegate wasnt executed automaticaly. 185*/ 186message EosActionRefund { 187 optional uint64 owner = 1 [jstype = JS_STRING]; 188} 189 190/** 191* Structure representing buying RAM operation for EOS tokens 192*/ 193message EosActionBuyRam { 194 optional uint64 payer = 1 [jstype = JS_STRING]; 195 optional uint64 receiver = 2 [jstype = JS_STRING]; 196 optional EosAsset quantity = 3; // Asset format '1.0000 EOS' 197} 198 199/** 200* Structure representing buying bytes according to RAM market price. 201*/ 202message EosActionBuyRamBytes { 203 optional uint64 payer = 1 [jstype = JS_STRING]; 204 optional uint64 receiver = 2 [jstype = JS_STRING]; 205 optional uint32 bytes = 3; // Number of bytes 206} 207 208/** 209* Structure representing sell RAM 210*/ 211message EosActionSellRam { 212 optional uint64 account = 1 [jstype = JS_STRING]; 213 optional sint64 bytes = 2 [jstype = JS_STRING]; // Number of bytes 214} 215 216/** 217* Structure representing voting. Currently, there could be up to 30 producers. 218*/ 219message EosActionVoteProducer { 220 optional uint64 voter = 1 [jstype = JS_STRING]; // Voter account 221 optional uint64 proxy = 2 [jstype = JS_STRING]; // Proxy voter account 222 repeated uint64 producers = 3 [jstype = JS_STRING]; // List of producers 223} 224 225/** 226* Structure representing update authorization. 227*/ 228message EosActionUpdateAuth { 229 optional uint64 account = 1 [jstype = JS_STRING]; 230 optional uint64 permission = 2 [jstype = JS_STRING]; 231 optional uint64 parent = 3 [jstype = JS_STRING]; 232 optional EosAuthorization auth = 4; 233} 234 235/** 236* Structure representing delete authorization. 237*/ 238message EosActionDeleteAuth { 239 optional uint64 account = 1 [jstype = JS_STRING]; 240 optional uint64 permission = 2 [jstype = JS_STRING]; 241} 242 243/** 244* Structure representing link authorization to action. 245*/ 246message EosActionLinkAuth { 247 optional uint64 account = 1 [jstype = JS_STRING]; 248 optional uint64 code = 2 [jstype = JS_STRING]; 249 optional uint64 type = 3 [jstype = JS_STRING]; 250 optional uint64 requirement = 4 [jstype = JS_STRING]; 251} 252 253/** 254* Structure representing unlink authorization from action. 255*/ 256message EosActionUnlinkAuth { 257 optional uint64 account = 1 [jstype = JS_STRING]; 258 optional uint64 code = 2 [jstype = JS_STRING]; 259 optional uint64 type = 3 [jstype = JS_STRING]; 260} 261 262/** 263* Structure representing creation of a new account. 264*/ 265message EosActionNewAccount { 266 optional uint64 creator = 1 [jstype = JS_STRING]; 267 optional uint64 name = 2 [jstype = JS_STRING]; 268 optional EosAuthorization owner = 3; 269 optional EosAuthorization active = 4; 270} 271 272/** 273* Structure representing actions not implemented above. 274*/ 275message EosActionUnknown { 276 optional uint32 data_size = 1; 277 optional bytes data_chunk = 2; 278} 279 280/** 281 * Response: Device returns the signature. 282 * The signature_* fields contain the computed transaction signature. All three fields will be present. 283 * @end 284 */ 285message EosSignedTx { 286 optional uint32 signature_v = 1; // Computed signature (recovery parameter, limited to 31 or 32) 287 optional bytes signature_r = 2; // Computed signature R component (256 bit) 288 optional bytes signature_s = 3; // Computed signature S component (256 bit) 289 optional bytes hash = 4; // Hash 290} 291