Advertisement
Guest User

Michelson serialization protocol v1

a guest
May 21st, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.26 KB | None | 0 0
  1. Generated from this module of Tezos Michelson implementation: https://gitlab.com/tezos/tezos/blob/3c301d68d57746ed2221e820cada4cfd46c4b416/src/lib_data_encoding/binary_schema.ml
  2. --------------------------------------------------------------------------------------------
  3.  
  4. michelson.v1.primitives (Enumeration: unsigned 8-bit integer):
  5. **************************************************************
  6.  
  7. +-------------+------------------+
  8. | Case number | Encoded string |
  9. +=============+==================+
  10. | 0 | parameter |
  11. +-------------+------------------+
  12. | 1 | storage |
  13. +-------------+------------------+
  14. | 2 | code |
  15. +-------------+------------------+
  16. | 3 | False |
  17. +-------------+------------------+
  18. | 4 | Elt |
  19. +-------------+------------------+
  20. | 5 | Left |
  21. +-------------+------------------+
  22. | 6 | None |
  23. +-------------+------------------+
  24. | 7 | Pair |
  25. +-------------+------------------+
  26. | 8 | Right |
  27. +-------------+------------------+
  28. | 9 | Some |
  29. +-------------+------------------+
  30. | 10 | True |
  31. +-------------+------------------+
  32. | 11 | Unit |
  33. +-------------+------------------+
  34. | 12 | PACK |
  35. +-------------+------------------+
  36. | 13 | UNPACK |
  37. +-------------+------------------+
  38. | 14 | BLAKE2B |
  39. +-------------+------------------+
  40. | 15 | SHA256 |
  41. +-------------+------------------+
  42. | 16 | SHA512 |
  43. +-------------+------------------+
  44. | 17 | ABS |
  45. +-------------+------------------+
  46. | 18 | ADD |
  47. +-------------+------------------+
  48. | 19 | AMOUNT |
  49. +-------------+------------------+
  50. | 20 | AND |
  51. +-------------+------------------+
  52. | 21 | BALANCE |
  53. +-------------+------------------+
  54. | 22 | CAR |
  55. +-------------+------------------+
  56. | 23 | CDR |
  57. +-------------+------------------+
  58. | 24 | CHECK_SIGNATURE |
  59. +-------------+------------------+
  60. | 25 | COMPARE |
  61. +-------------+------------------+
  62. | 26 | CONCAT |
  63. +-------------+------------------+
  64. | 27 | CONS |
  65. +-------------+------------------+
  66. | 28 | CREATE_ACCOUNT |
  67. +-------------+------------------+
  68. | 29 | CREATE_CONTRACT |
  69. +-------------+------------------+
  70. | 30 | IMPLICIT_ACCOUNT |
  71. +-------------+------------------+
  72. | 31 | DIP |
  73. +-------------+------------------+
  74. | 32 | DROP |
  75. +-------------+------------------+
  76. | 33 | DUP |
  77. +-------------+------------------+
  78. | 34 | EDIV |
  79. +-------------+------------------+
  80. | 35 | EMPTY_MAP |
  81. +-------------+------------------+
  82. | 36 | EMPTY_SET |
  83. +-------------+------------------+
  84. | 37 | EQ |
  85. +-------------+------------------+
  86. | 38 | EXEC |
  87. +-------------+------------------+
  88. | 39 | FAILWITH |
  89. +-------------+------------------+
  90. | 40 | GE |
  91. +-------------+------------------+
  92. | 41 | GET |
  93. +-------------+------------------+
  94. | 42 | GT |
  95. +-------------+------------------+
  96. | 43 | HASH_KEY |
  97. +-------------+------------------+
  98. | 44 | IF |
  99. +-------------+------------------+
  100. | 45 | IF_CONS |
  101. +-------------+------------------+
  102. | 46 | IF_LEFT |
  103. +-------------+------------------+
  104. | 47 | IF_NONE |
  105. +-------------+------------------+
  106. | 48 | INT |
  107. +-------------+------------------+
  108. | 49 | LAMBDA |
  109. +-------------+------------------+
  110. | 50 | LE |
  111. +-------------+------------------+
  112. | 51 | LEFT |
  113. +-------------+------------------+
  114. | 52 | LOOP |
  115. +-------------+------------------+
  116. | 53 | LSL |
  117. +-------------+------------------+
  118. | 54 | LSR |
  119. +-------------+------------------+
  120. | 55 | LT |
  121. +-------------+------------------+
  122. | 56 | MAP |
  123. +-------------+------------------+
  124. | 57 | MEM |
  125. +-------------+------------------+
  126. | 58 | MUL |
  127. +-------------+------------------+
  128. | 59 | NEG |
  129. +-------------+------------------+
  130. | 60 | NEQ |
  131. +-------------+------------------+
  132. | 61 | NIL |
  133. +-------------+------------------+
  134. | 62 | NONE |
  135. +-------------+------------------+
  136. | 63 | NOT |
  137. +-------------+------------------+
  138. | 64 | NOW |
  139. +-------------+------------------+
  140. | 65 | OR |
  141. +-------------+------------------+
  142. | 66 | PAIR |
  143. +-------------+------------------+
  144. | 67 | PUSH |
  145. +-------------+------------------+
  146. | 68 | RIGHT |
  147. +-------------+------------------+
  148. | 69 | SIZE |
  149. +-------------+------------------+
  150. | 70 | SOME |
  151. +-------------+------------------+
  152. | 71 | SOURCE |
  153. +-------------+------------------+
  154. | 72 | SENDER |
  155. +-------------+------------------+
  156. | 73 | SELF |
  157. +-------------+------------------+
  158. | 74 | STEPS_TO_QUOTA |
  159. +-------------+------------------+
  160. | 75 | SUB |
  161. +-------------+------------------+
  162. | 76 | SWAP |
  163. +-------------+------------------+
  164. | 77 | TRANSFER_TOKENS |
  165. +-------------+------------------+
  166. | 78 | SET_DELEGATE |
  167. +-------------+------------------+
  168. | 79 | UNIT |
  169. +-------------+------------------+
  170. | 80 | UPDATE |
  171. +-------------+------------------+
  172. | 81 | XOR |
  173. +-------------+------------------+
  174. | 82 | ITER |
  175. +-------------+------------------+
  176. | 83 | LOOP_LEFT |
  177. +-------------+------------------+
  178. | 84 | ADDRESS |
  179. +-------------+------------------+
  180. | 85 | CONTRACT |
  181. +-------------+------------------+
  182. | 86 | ISNAT |
  183. +-------------+------------------+
  184. | 87 | CAST |
  185. +-------------+------------------+
  186. | 88 | RENAME |
  187. +-------------+------------------+
  188. | 89 | bool |
  189. +-------------+------------------+
  190. | 90 | contract |
  191. +-------------+------------------+
  192. | 91 | int |
  193. +-------------+------------------+
  194. | 92 | key |
  195. +-------------+------------------+
  196. | 93 | key_hash |
  197. +-------------+------------------+
  198. | 94 | lambda |
  199. +-------------+------------------+
  200. | 95 | list |
  201. +-------------+------------------+
  202. | 96 | map |
  203. +-------------+------------------+
  204. | 97 | big_map |
  205. +-------------+------------------+
  206. | 98 | nat |
  207. +-------------+------------------+
  208. | 99 | option |
  209. +-------------+------------------+
  210. | 100 | or |
  211. +-------------+------------------+
  212. | 101 | pair |
  213. +-------------+------------------+
  214. | 102 | set |
  215. +-------------+------------------+
  216. | 103 | signature |
  217. +-------------+------------------+
  218. | 104 | string |
  219. +-------------+------------------+
  220. | 105 | bytes |
  221. +-------------+------------------+
  222. | 106 | mutez |
  223. +-------------+------------------+
  224. | 107 | timestamp |
  225. +-------------+------------------+
  226. | 108 | unit |
  227. +-------------+------------------+
  228. | 109 | operation |
  229. +-------------+------------------+
  230. | 110 | address |
  231. +-------------+------------------+
  232. | 111 | SLICE |
  233. +-------------+------------------+
  234.  
  235.  
  236. micheline.michelson_v1.expression (Determined from data, 8-bit tag)
  237. *******************************************************************
  238.  
  239. Int (tag 0)
  240. ===========
  241.  
  242. +------+----------------------+------------------------+
  243. | Name | Size | Contents |
  244. +======+======================+========================+
  245. | Tag | 1 byte | unsigned 8-bit integer |
  246. +------+----------------------+------------------------+
  247. | int | Determined from data | $Z.t |
  248. +------+----------------------+------------------------+
  249.  
  250.  
  251. String (tag 1)
  252. ==============
  253.  
  254. +-----------------------+----------+-------------------------+
  255. | Name | Size | Contents |
  256. +=======================+==========+=========================+
  257. | Tag | 1 byte | unsigned 8-bit integer |
  258. +-----------------------+----------+-------------------------+
  259. | # bytes in next field | 4 bytes | unsigned 30-bit integer |
  260. +-----------------------+----------+-------------------------+
  261. | string | Variable | bytes |
  262. +-----------------------+----------+-------------------------+
  263.  
  264.  
  265. Sequence (tag 2)
  266. ================
  267.  
  268. +-----------------------+----------+------------------------------------------------+
  269. | Name | Size | Contents |
  270. +=======================+==========+================================================+
  271. | Tag | 1 byte | unsigned 8-bit integer |
  272. +-----------------------+----------+------------------------------------------------+
  273. | # bytes in next field | 4 bytes | unsigned 30-bit integer |
  274. +-----------------------+----------+------------------------------------------------+
  275. | Unnamed field 0 | Variable | sequence of $micheline.michelson_v1.expression |
  276. +-----------------------+----------+------------------------------------------------+
  277.  
  278.  
  279. Prim (no args, annot) (tag 3)
  280. =============================
  281.  
  282. +------+--------+------------------------------------------------------------------------------+
  283. | Name | Size | Contents |
  284. +======+========+==============================================================================+
  285. | Tag | 1 byte | unsigned 8-bit integer |
  286. +------+--------+------------------------------------------------------------------------------+
  287. | prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
  288. +------+--------+------------------------------------------------------------------------------+
  289.  
  290.  
  291. Prim (no args + annot) (tag 4)
  292. ==============================
  293.  
  294. +-----------------------+----------+------------------------------------------------------------------------------+
  295. | Name | Size | Contents |
  296. +=======================+==========+==============================================================================+
  297. | Tag | 1 byte | unsigned 8-bit integer |
  298. +-----------------------+----------+------------------------------------------------------------------------------+
  299. | prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
  300. +-----------------------+----------+------------------------------------------------------------------------------+
  301. | # bytes in next field | 4 bytes | unsigned 30-bit integer |
  302. +-----------------------+----------+------------------------------------------------------------------------------+
  303. | annots | Variable | bytes |
  304. +-----------------------+----------+------------------------------------------------------------------------------+
  305.  
  306.  
  307. Prim (1 arg, no annot) (tag 5)
  308. ==============================
  309.  
  310. +------+----------------------+------------------------------------------------------------------------------+
  311. | Name | Size | Contents |
  312. +======+======================+==============================================================================+
  313. | Tag | 1 byte | unsigned 8-bit integer |
  314. +------+----------------------+------------------------------------------------------------------------------+
  315. | prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
  316. +------+----------------------+------------------------------------------------------------------------------+
  317. | arg | Determined from data | $micheline.michelson_v1.expression |
  318. +------+----------------------+------------------------------------------------------------------------------+
  319.  
  320.  
  321. Prim (1 arg + annot) (tag 6)
  322. ============================
  323.  
  324. +-----------------------+----------------------+------------------------------------------------------------------------------+
  325. | Name | Size | Contents |
  326. +=======================+======================+==============================================================================+
  327. | Tag | 1 byte | unsigned 8-bit integer |
  328. +-----------------------+----------------------+------------------------------------------------------------------------------+
  329. | prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
  330. +-----------------------+----------------------+------------------------------------------------------------------------------+
  331. | arg | Determined from data | $micheline.michelson_v1.expression |
  332. +-----------------------+----------------------+------------------------------------------------------------------------------+
  333. | # bytes in next field | 4 bytes | unsigned 30-bit integer |
  334. +-----------------------+----------------------+------------------------------------------------------------------------------+
  335. | annots | Variable | bytes |
  336. +-----------------------+----------------------+------------------------------------------------------------------------------+
  337.  
  338.  
  339. Prim (2 args, no annot) (tag 7)
  340. ===============================
  341.  
  342. +------+----------------------+------------------------------------------------------------------------------+
  343. | Name | Size | Contents |
  344. +======+======================+==============================================================================+
  345. | Tag | 1 byte | unsigned 8-bit integer |
  346. +------+----------------------+------------------------------------------------------------------------------+
  347. | prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
  348. +------+----------------------+------------------------------------------------------------------------------+
  349. | arg1 | Determined from data | $micheline.michelson_v1.expression |
  350. +------+----------------------+------------------------------------------------------------------------------+
  351. | arg2 | Determined from data | $micheline.michelson_v1.expression |
  352. +------+----------------------+------------------------------------------------------------------------------+
  353.  
  354.  
  355. Prim (2 args + annot) (tag 8)
  356. =============================
  357.  
  358. +-----------------------+----------------------+------------------------------------------------------------------------------+
  359. | Name | Size | Contents |
  360. +=======================+======================+==============================================================================+
  361. | Tag | 1 byte | unsigned 8-bit integer |
  362. +-----------------------+----------------------+------------------------------------------------------------------------------+
  363. | prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
  364. +-----------------------+----------------------+------------------------------------------------------------------------------+
  365. | arg1 | Determined from data | $micheline.michelson_v1.expression |
  366. +-----------------------+----------------------+------------------------------------------------------------------------------+
  367. | arg2 | Determined from data | $micheline.michelson_v1.expression |
  368. +-----------------------+----------------------+------------------------------------------------------------------------------+
  369. | # bytes in next field | 4 bytes | unsigned 30-bit integer |
  370. +-----------------------+----------------------+------------------------------------------------------------------------------+
  371. | annots | Variable | bytes |
  372. +-----------------------+----------------------+------------------------------------------------------------------------------+
  373.  
  374.  
  375. Generic prim (any number of args with or without annot) (tag 9)
  376. ===============================================================
  377.  
  378. +-----------------------+----------+------------------------------------------------------------------------------+
  379. | Name | Size | Contents |
  380. +=======================+==========+==============================================================================+
  381. | Tag | 1 byte | unsigned 8-bit integer |
  382. +-----------------------+----------+------------------------------------------------------------------------------+
  383. | prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
  384. +-----------------------+----------+------------------------------------------------------------------------------+
  385. | # bytes in next field | 4 bytes | unsigned 30-bit integer |
  386. +-----------------------+----------+------------------------------------------------------------------------------+
  387. | args | Variable | sequence of $micheline.michelson_v1.expression |
  388. +-----------------------+----------+------------------------------------------------------------------------------+
  389. | # bytes in next field | 4 bytes | unsigned 30-bit integer |
  390. +-----------------------+----------+------------------------------------------------------------------------------+
  391. | annots | Variable | bytes |
  392. +-----------------------+----------+------------------------------------------------------------------------------+
  393.  
  394.  
  395. Bytes (tag 10)
  396. ==============
  397.  
  398. +-----------------------+----------+-------------------------+
  399. | Name | Size | Contents |
  400. +=======================+==========+=========================+
  401. | Tag | 1 byte | unsigned 8-bit integer |
  402. +-----------------------+----------+-------------------------+
  403. | # bytes in next field | 4 bytes | unsigned 30-bit integer |
  404. +-----------------------+----------+-------------------------+
  405. | bytes | Variable | bytes |
  406. +-----------------------+----------+-------------------------+
  407.  
  408.  
  409. Z.t
  410. ***
  411.  
  412. A variable length sequence of bytes, encoding a Zarith number. Each
  413. byte has a running unary size bit: the most significant bit of each
  414. byte tells is this is the last byte in the sequence (0) or if there
  415. is more to read (1). The second most significant bit of the first
  416. byte is reserved for the sign (positive if zero). Size and sign bits
  417. ignored, data is then the binary representation of the absolute
  418. value of the number in little endian order.
  419.  
  420. +------+----------------------+----------+
  421. | Name | Size | Contents |
  422. +======+======================+==========+
  423. | Z.t | Determined from data | bytes |
  424. +------+----------------------+----------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement