Skip to content

Instantly share code, notes, and snippets.

@smondet

smondet/pack-binary-schema.txt Secret

Created Sep 29, 2020
Embed
What would you like to do?
+-----------------+----------------------+------------------------------------+
| Name | Size | Contents |
+=================+======================+====================================+
| Unnamed field 0 | Determined from data | $micheline.michelson_v1.expression |
+-----------------+----------------------+------------------------------------+
michelson.v1.primitives (Enumeration: unsigned 8-bit integer):
**************************************************************
+-------------+------------------+
| Case number | Encoded string |
+=============+==================+
| 0 | parameter |
+-------------+------------------+
| 1 | storage |
+-------------+------------------+
| 2 | code |
+-------------+------------------+
| 3 | False |
+-------------+------------------+
| 4 | Elt |
+-------------+------------------+
| 5 | Left |
+-------------+------------------+
| 6 | None |
+-------------+------------------+
| 7 | Pair |
+-------------+------------------+
| 8 | Right |
+-------------+------------------+
| 9 | Some |
+-------------+------------------+
| 10 | True |
+-------------+------------------+
| 11 | Unit |
+-------------+------------------+
| 12 | PACK |
+-------------+------------------+
| 13 | UNPACK |
+-------------+------------------+
| 14 | BLAKE2B |
+-------------+------------------+
| 15 | SHA256 |
+-------------+------------------+
| 16 | SHA512 |
+-------------+------------------+
| 17 | ABS |
+-------------+------------------+
| 18 | ADD |
+-------------+------------------+
| 19 | AMOUNT |
+-------------+------------------+
| 20 | AND |
+-------------+------------------+
| 21 | BALANCE |
+-------------+------------------+
| 22 | CAR |
+-------------+------------------+
| 23 | CDR |
+-------------+------------------+
| 24 | CHECK_SIGNATURE |
+-------------+------------------+
| 25 | COMPARE |
+-------------+------------------+
| 26 | CONCAT |
+-------------+------------------+
| 27 | CONS |
+-------------+------------------+
| 28 | CREATE_ACCOUNT |
+-------------+------------------+
| 29 | CREATE_CONTRACT |
+-------------+------------------+
| 30 | IMPLICIT_ACCOUNT |
+-------------+------------------+
| 31 | DIP |
+-------------+------------------+
| 32 | DROP |
+-------------+------------------+
| 33 | DUP |
+-------------+------------------+
| 34 | EDIV |
+-------------+------------------+
| 35 | EMPTY_MAP |
+-------------+------------------+
| 36 | EMPTY_SET |
+-------------+------------------+
| 37 | EQ |
+-------------+------------------+
| 38 | EXEC |
+-------------+------------------+
| 39 | FAILWITH |
+-------------+------------------+
| 40 | GE |
+-------------+------------------+
| 41 | GET |
+-------------+------------------+
| 42 | GT |
+-------------+------------------+
| 43 | HASH_KEY |
+-------------+------------------+
| 44 | IF |
+-------------+------------------+
| 45 | IF_CONS |
+-------------+------------------+
| 46 | IF_LEFT |
+-------------+------------------+
| 47 | IF_NONE |
+-------------+------------------+
| 48 | INT |
+-------------+------------------+
| 49 | LAMBDA |
+-------------+------------------+
| 50 | LE |
+-------------+------------------+
| 51 | LEFT |
+-------------+------------------+
| 52 | LOOP |
+-------------+------------------+
| 53 | LSL |
+-------------+------------------+
| 54 | LSR |
+-------------+------------------+
| 55 | LT |
+-------------+------------------+
| 56 | MAP |
+-------------+------------------+
| 57 | MEM |
+-------------+------------------+
| 58 | MUL |
+-------------+------------------+
| 59 | NEG |
+-------------+------------------+
| 60 | NEQ |
+-------------+------------------+
| 61 | NIL |
+-------------+------------------+
| 62 | NONE |
+-------------+------------------+
| 63 | NOT |
+-------------+------------------+
| 64 | NOW |
+-------------+------------------+
| 65 | OR |
+-------------+------------------+
| 66 | PAIR |
+-------------+------------------+
| 67 | PUSH |
+-------------+------------------+
| 68 | RIGHT |
+-------------+------------------+
| 69 | SIZE |
+-------------+------------------+
| 70 | SOME |
+-------------+------------------+
| 71 | SOURCE |
+-------------+------------------+
| 72 | SENDER |
+-------------+------------------+
| 73 | SELF |
+-------------+------------------+
| 74 | STEPS_TO_QUOTA |
+-------------+------------------+
| 75 | SUB |
+-------------+------------------+
| 76 | SWAP |
+-------------+------------------+
| 77 | TRANSFER_TOKENS |
+-------------+------------------+
| 78 | SET_DELEGATE |
+-------------+------------------+
| 79 | UNIT |
+-------------+------------------+
| 80 | UPDATE |
+-------------+------------------+
| 81 | XOR |
+-------------+------------------+
| 82 | ITER |
+-------------+------------------+
| 83 | LOOP_LEFT |
+-------------+------------------+
| 84 | ADDRESS |
+-------------+------------------+
| 85 | CONTRACT |
+-------------+------------------+
| 86 | ISNAT |
+-------------+------------------+
| 87 | CAST |
+-------------+------------------+
| 88 | RENAME |
+-------------+------------------+
| 89 | bool |
+-------------+------------------+
| 90 | contract |
+-------------+------------------+
| 91 | int |
+-------------+------------------+
| 92 | key |
+-------------+------------------+
| 93 | key_hash |
+-------------+------------------+
| 94 | lambda |
+-------------+------------------+
| 95 | list |
+-------------+------------------+
| 96 | map |
+-------------+------------------+
| 97 | big_map |
+-------------+------------------+
| 98 | nat |
+-------------+------------------+
| 99 | option |
+-------------+------------------+
| 100 | or |
+-------------+------------------+
| 101 | pair |
+-------------+------------------+
| 102 | set |
+-------------+------------------+
| 103 | signature |
+-------------+------------------+
| 104 | string |
+-------------+------------------+
| 105 | bytes |
+-------------+------------------+
| 106 | mutez |
+-------------+------------------+
| 107 | timestamp |
+-------------+------------------+
| 108 | unit |
+-------------+------------------+
| 109 | operation |
+-------------+------------------+
| 110 | address |
+-------------+------------------+
| 111 | SLICE |
+-------------+------------------+
| 112 | DIG |
+-------------+------------------+
| 113 | DUG |
+-------------+------------------+
| 114 | EMPTY_BIG_MAP |
+-------------+------------------+
| 115 | APPLY |
+-------------+------------------+
| 116 | chain_id |
+-------------+------------------+
| 117 | CHAIN_ID |
+-------------+------------------+
Z.t
***
A variable length sequence of bytes, encoding a Zarith number. Each byte has a running unary size bit: the most significant bit of each byte tells is this is the last byte in the sequence (0) or if there is more to read (1). The second most significant bit of the first byte is reserved for the sign (positive if zero). Size and sign bits ignored, data is then the binary representation of the absolute value of the number in little endian order.
+------+----------------------+----------+
| Name | Size | Contents |
+======+======================+==========+
| Z.t | Determined from data | bytes |
+------+----------------------+----------+
micheline.michelson_v1.expression (Determined from data, 8-bit tag)
*******************************************************************
Int (tag 0)
===========
+------+----------------------+------------------------+
| Name | Size | Contents |
+======+======================+========================+
| Tag | 1 byte | unsigned 8-bit integer |
+------+----------------------+------------------------+
| int | Determined from data | $Z.t |
+------+----------------------+------------------------+
String (tag 1)
==============
+-----------------------+----------+-------------------------+
| Name | Size | Contents |
+=======================+==========+=========================+
| Tag | 1 byte | unsigned 8-bit integer |
+-----------------------+----------+-------------------------+
| # bytes in next field | 4 bytes | unsigned 30-bit integer |
+-----------------------+----------+-------------------------+
| string | Variable | bytes |
+-----------------------+----------+-------------------------+
Sequence (tag 2)
================
+-----------------------+----------+------------------------------------------------+
| Name | Size | Contents |
+=======================+==========+================================================+
| Tag | 1 byte | unsigned 8-bit integer |
+-----------------------+----------+------------------------------------------------+
| # bytes in next field | 4 bytes | unsigned 30-bit integer |
+-----------------------+----------+------------------------------------------------+
| Unnamed field 0 | Variable | sequence of $micheline.michelson_v1.expression |
+-----------------------+----------+------------------------------------------------+
Prim (no args, annot) (tag 3)
=============================
+------+--------+------------------------------------------------------------------------------+
| Name | Size | Contents |
+======+========+==============================================================================+
| Tag | 1 byte | unsigned 8-bit integer |
+------+--------+------------------------------------------------------------------------------+
| prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
+------+--------+------------------------------------------------------------------------------+
Prim (no args + annot) (tag 4)
==============================
+-----------------------+----------+------------------------------------------------------------------------------+
| Name | Size | Contents |
+=======================+==========+==============================================================================+
| Tag | 1 byte | unsigned 8-bit integer |
+-----------------------+----------+------------------------------------------------------------------------------+
| prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
+-----------------------+----------+------------------------------------------------------------------------------+
| # bytes in next field | 4 bytes | unsigned 30-bit integer |
+-----------------------+----------+------------------------------------------------------------------------------+
| annots | Variable | bytes |
+-----------------------+----------+------------------------------------------------------------------------------+
Prim (1 arg, no annot) (tag 5)
==============================
+------+----------------------+------------------------------------------------------------------------------+
| Name | Size | Contents |
+======+======================+==============================================================================+
| Tag | 1 byte | unsigned 8-bit integer |
+------+----------------------+------------------------------------------------------------------------------+
| prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
+------+----------------------+------------------------------------------------------------------------------+
| arg | Determined from data | $micheline.michelson_v1.expression |
+------+----------------------+------------------------------------------------------------------------------+
Prim (1 arg + annot) (tag 6)
============================
+-----------------------+----------------------+------------------------------------------------------------------------------+
| Name | Size | Contents |
+=======================+======================+==============================================================================+
| Tag | 1 byte | unsigned 8-bit integer |
+-----------------------+----------------------+------------------------------------------------------------------------------+
| prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
+-----------------------+----------------------+------------------------------------------------------------------------------+
| arg | Determined from data | $micheline.michelson_v1.expression |
+-----------------------+----------------------+------------------------------------------------------------------------------+
| # bytes in next field | 4 bytes | unsigned 30-bit integer |
+-----------------------+----------------------+------------------------------------------------------------------------------+
| annots | Variable | bytes |
+-----------------------+----------------------+------------------------------------------------------------------------------+
Prim (2 args, no annot) (tag 7)
===============================
+------+----------------------+------------------------------------------------------------------------------+
| Name | Size | Contents |
+======+======================+==============================================================================+
| Tag | 1 byte | unsigned 8-bit integer |
+------+----------------------+------------------------------------------------------------------------------+
| prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
+------+----------------------+------------------------------------------------------------------------------+
| arg1 | Determined from data | $micheline.michelson_v1.expression |
+------+----------------------+------------------------------------------------------------------------------+
| arg2 | Determined from data | $micheline.michelson_v1.expression |
+------+----------------------+------------------------------------------------------------------------------+
Prim (2 args + annot) (tag 8)
=============================
+-----------------------+----------------------+------------------------------------------------------------------------------+
| Name | Size | Contents |
+=======================+======================+==============================================================================+
| Tag | 1 byte | unsigned 8-bit integer |
+-----------------------+----------------------+------------------------------------------------------------------------------+
| prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
+-----------------------+----------------------+------------------------------------------------------------------------------+
| arg1 | Determined from data | $micheline.michelson_v1.expression |
+-----------------------+----------------------+------------------------------------------------------------------------------+
| arg2 | Determined from data | $micheline.michelson_v1.expression |
+-----------------------+----------------------+------------------------------------------------------------------------------+
| # bytes in next field | 4 bytes | unsigned 30-bit integer |
+-----------------------+----------------------+------------------------------------------------------------------------------+
| annots | Variable | bytes |
+-----------------------+----------------------+------------------------------------------------------------------------------+
Generic prim (any number of args with or without annot) (tag 9)
===============================================================
+-----------------------+----------+------------------------------------------------------------------------------+
| Name | Size | Contents |
+=======================+==========+==============================================================================+
| Tag | 1 byte | unsigned 8-bit integer |
+-----------------------+----------+------------------------------------------------------------------------------+
| prim | 1 byte | unsigned 8-bit integer encoding an enumeration (see michelson.v1.primitives) |
+-----------------------+----------+------------------------------------------------------------------------------+
| # bytes in next field | 4 bytes | unsigned 30-bit integer |
+-----------------------+----------+------------------------------------------------------------------------------+
| args | Variable | sequence of $micheline.michelson_v1.expression |
+-----------------------+----------+------------------------------------------------------------------------------+
| # bytes in next field | 4 bytes | unsigned 30-bit integer |
+-----------------------+----------+------------------------------------------------------------------------------+
| annots | Variable | bytes |
+-----------------------+----------+------------------------------------------------------------------------------+
Bytes (tag 10)
==============
+-----------------------+----------+-------------------------+
| Name | Size | Contents |
+=======================+==========+=========================+
| Tag | 1 byte | unsigned 8-bit integer |
+-----------------------+----------+-------------------------+
| # bytes in next field | 4 bytes | unsigned 30-bit integer |
+-----------------------+----------+-------------------------+
| bytes | Variable | bytes |
+-----------------------+----------+-------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment