Skip to main content

Types

address

Account or contract address on the Tezos blockchain.

An address is formed of a prefix (tz1 tz2 tz3 and KT1 for contracts) followed by a Base58 encoded hash and terminated by a 4-byte checksum.

Examples

tz1Lc2qBKEWCBeDU8npG6zCeCqpmaegRi6Jg
tz2BFTyPeYRzxd5aiBchbXN3WCZhx7BqbMBq
tz3hFR7NZtjT2QtzgMQnWb4xMuD6yt2YzXUt
KT1VMCj69PwwKK7aRLRPnWoYh4X1xQqk2Vm2

Properties


Michelson


Related

aggregate<A>

Type of asset field to reference assets from another collection A.

For example, field drives references assets from the car asset collection:

asset car {
vin : string;
nbdoors : nat = 0
}

asset driver {
id : address;
drives : aggregate<car>
}

Notes:

  • two drivers may reference the same car
  • adding in drives fails if car's vin is not present in car collection.

Example

[ "1G1AF1F57A7192174" ]

Properties


Michelson


Related

asset_key<A>

Type of the key of asset A.

Parameter

A

(asset)

Any declared asset.


Example


Properties


Michelson


Related

asset_value<A>

Type of an asset value generated from asset declaration. An asset value is a record that provides all asset fields but the asset identifier field(s).

Consider for example the following asset declaration:

asset result {
id : string;
score : nat;
time : duration;
}

The asset value for result is the record with score and time fields. Hence asset_value<result> is equivalent to the following declaration:

record ledger_asset_value {
score : nat;
time : duration;
}

An asset record value is returned by the [] asset method (and get). As for any record, fields are accessed normally with . operator:

const v : asset_value<result> = result["#sub001"];
const s = v.score;
const t = v.time;

Parameter

A

(asset)

Any declared asset.


Example


Properties


Michelson


Related

asset_view<A>

Read-only view on asset collection returned by asset methods. It is possible to iterate on an asset_view with the for instruction. They are internally represented as list of asset keys.

Example

[]

Properties


Michelson


Related

big_map<K, V>

Map from K-typed key to V-typed value, that can deal with a high number of keys.

The issue with a standard map is that the cost of deserialisation becomes prohibitive as the number of keys increases. Indeed a map, as well as any storage element, is stored in a serialised format, and gets deserialised each time the contract storage is accessed.

A big map is not stored in the contract storage, but rather has its own dedicated storage; it is referenced from the contract storage by an integer value, hence the deserialisation cost of the contract storage is not impacted by the number of keys in the big map.

info

The constraint is that a big map is not iterable (because only a hash of the key is stored, not the key itself). It means that the for instruction and the length builtin are not available for big maps. See the iterable_big_map type for an iterable big map.

Examples

[]
[ ("#1G1AF1F57A7192174", 5); ("#2F4AH1J77O7132095", 10) ]

Properties


Michelson


Related

bls12_381_fr

Multplicative scalar for the BLS12_381 curves g1 and g2.
Literals can either be a raw bytes representation or a natural.

Examples

0x02
2

Properties


Michelson


Related

bls12_381_g1

Point on the elliptic curve g1.

Example

0x063bd6e11e2fcaac1dd8cf68c6b1925a73c3c583e298ed37c41c3715115cf96358a42dbe85a0228cbfd8a6c8a8c54cd015b5ae2860d1cc47f84698d951f14d9448d03f04df2ca0ffe609a2067d6f1a892163a5e05e541279134cae52b1f23c6b

Properties


Michelson


Related

bls12_381_g2

Point on the elliptic curve g2.

Example

0x10c6d5cdca84fc3c7f33061add256f48e0ab03a697832b338901898b650419eb6f334b28153fb73ad2ecd1cd2ac67053161e9f46cfbdaf7b1132a4654a55162850249650f9b873ac3113fa8c02ef1cd1df481480a4457f351d28f4da89d19fa405c3d77f686dc9a24d2681c9184bf2b091f62e6b24df651a3da8bd7067e14e7908fb02f8955b84af5081614cb5bc49b416d9edf914fc608c441b3f2eb8b6043736ddb9d4e4d62334a23b5625c14ef3e1a7e99258386310221b22d83a5eac035c

Properties


Michelson


Related

bool

bytes

Array of byte values to represent any serialised data. It is used for signatures and hash values.

Examples

0x00
0x050002
0x

Properties


Michelson


Related

chain_id

Type of the chain network identifier.

Examples

"NetXdQprcVkpaWU"
chain_id

Properties


Michelson


Related

chest

Timelocked encrypted value. It is generated off-chain with the timelock-utils, and decrypted on-chain with the open_chest builtin.

Example

0xc5ecdde89eb8c1e7aaeb85abb8f5e5cef3b4fa80c4aee2fccbf0a78ce0debaa5e9ddede3ddfbd9abdea28cc7dc99e6d3a9baf3cbae9adaaabc89cbc39e97e2c7a6cba99197d19ba09ddfd181afc997ffbcc5acb2d29ecbb698c2cacbdd83d1b4ced0bffe9cd78295b3fba4d9f9d5f4d4ec9ad3c7e1a8eeb9dba5cbd8a2dbf29af8e4a4c1e4b1edacf98fccefaef9fea4f0bacdd38ecbfe81c3f9839b9e9ab8fbf5f1eabac48a9f8ca7c588eefe94d1f18bd9bcee9aecde8dd285cf9098f4e1a7eec787f3a0e0ff9cd0ce8ec5a2a4e5ecb08fce899eb5baa397fabf90de9397cebc81bbdfb386e6b4da9fd8fdd19ed9f8d684c782b0aacfeebae4f6e7d1c5c1e6a093c68081cf83b991b4ecd7b38aee92deddcad79eb9abe0a0a0c6b5909dc58495f69445fff5ae9cefe8b8beb2fb86ccf5c9ad91989bdad8a3cfbedaffa2de8bf19dc6ac8cbc8a9584fa9f85f9ba958fc6bbc09ac8e7d5f0fdb98b86c1c7d59ad7c6dfc2d2cefaf5d9db909bf0e3acd3ccc792bc9bccbab4a4febda9b685dbc39ea2a4a7b69990d3abd8b9b3d7dbc581b984f3e08a98f7f7f0e697cc8dfd88edc8c3ca8dc3b2a9ccf6cdd6d0efcc848bc8ead5858bbabfcfc1c8ecea84fd9b96a5e4eabb8c918dafe6f78d83e8e1c2e5f8ee88a4ee8dcaeeafffebfcbbfda1e9eb86c582f2eedd9299cbc0a7fce083ced8c8ddb0e7eaacb696c1fccdadcdc8e3c6f7b9de84eece9bb7919094fef4fdf6efd8b1ba8bbecb9380add4f59ddbf9a19f95facc84e9d0a99bfa93f1fcc3a0fbde9b9ce0c7e8dec6e8d1dfa7dda6f490bb9580abfdbcc0e202e5ff731c3c17d080ee430edd30979a47aa653656e11e593800000015c2ca2a23b732a72932611618ad9ea324986377591e

Properties


Michelson


Related

chest_key

Key used by open_chest builtin to decrypt a chest value. It is generated off-chain with the timelock-utils together with the chest value.

Example

0xa0aceddfb3c9fbe1b8c382c7d5a7dedbe2e5adf9edcfc3e9d084caa6aeb9818ff1e985cb9efe8fa089ceeaa0f5d0bcb583e2f29196f2d3908fffffdcda868faffcb78fb697e7eaf3e7dca9d4b5dda2c3e4f8adf8abf484ecae85f7d6e0f2d28cb69af1d7b19082e8d8d7ba96e7e1e0bb8ac9b9fcf0a9e5b7c1a499c4faf4c8a3a9c8e4d09aa780eac6cee1b78a97a3e983abf9a5f1e8d2a2a2b5e3bcb8c4effeb7a3a68a85a497cd91c9a2c096c3f596deb8d1aca3a5aff28effb8cfc9c7ced892e3a7c09deeb8c8ec9387a3b384b5c8bccaafc7a9a2c1cfd8c7becfd7d6828a9af8f4988fe4ead3b59ecfb8ff8cabf8be90d4c8bdbddfce9cd7c2bb81edc4b7ad80a59a978f8c9debe7aaf08cf0c588f3eaade6b9f4e4e6edf1ed9c9988e48d9ba0aa8f01d18bac92b886db9dd798b5f6fdc891a28da2c4c48da1918897a2b7c2dfa0b78ab8e291b68fb1a2bfa5e8b88e9cabb0b5b0feabcffc9cfeee888ac4afeed9dc8bf5a4eaa9ae89a3838cf6cfd4f8acff8fa7aef7a9889fbbc7d8f6dde4edf3e58096e580e299e5b082b9cf85f3fe8ac6c0998eb1bcbab9bfb8fba39faea7bce0f6fed9ea86dfdad58cf7cbc7fcc4ecf7e2e898d3b19582e38c8092b7e4a0cddc83eb8bc38d91fefed6be869496b8e4fc99d5fae5c6a2b2dcabe2a4ea85b68b87b182d7e8cac29fe0b9efd6d0eb999ffa98aaaf9bf09fe7c4b39d81db97e4e7bbaef0e3bfedd69d9089bc8d91b292afa6c8b389fc9fb7aaa8decab6d9b493a6eafaa5baffe8fb85f2d483ecd1f2d1e58f938df9d8d5e385fe96c5f58ae1e0b09bf2b3c2931f

Properties


Michelson


Related

contract<T>

Destination value of an operation; it represents either an account's address, a contract's address, or a contract entrypoint.
It is returned by the get_entrypoint builtin, or by the conversion builtins address_to_contract and key_hash_to_contract

Example


Properties


Michelson


Related

date

Date in ISO_8601 format.

Examples

2019-01-01
2019-01-01T01:02:03
2019-01-01T01:02:03Z
2019-01-01T00:00:00+01:00
2019-01-01T00:00:00-05:30

Properties


Michelson


Related

duration

Number of seconds expressed in seconds, minutes, hours or weeks, for operations on dates.

Examples

10s
5m
18h
3d
1w
5m10s
5d12h
3w8d4h34m18s

Properties


Michelson


Related

enum

Union of several types: its value is one of the possible declared values; values can be parameterized.

Examples

enum color = | Red | Green | Blue
Red
Green
Blue

Properties


Michelson


Related

event

Type of event to be emitted, as explained in this blog entry.

Example


Property


Michelson


Related

int

Arbitrary-precision integer values (no arithmetic overflow).

Examples

0i
2i
123i
-1
100_000i

Properties


Michelson


Related

iterable_big_map<K, V>

An iterable big map has the scalability property of a big_map and can be iterated.

Consider the following declaration:

variable m : iterable_big_map<nat, string> = []

It is then possible to iterate over m:

for (k,v) in m do
/* k is the key */
/* v is the value associated to k */
done

An iterable big map is compiled in Michelson as a triplet:

  • a big map for the keys
  • a big map for the values
  • a counter

The detailed mechanism is presented in this blog entry.

info

The order in which keys are iterated is not the natural order.

caution

The possiblity to iterate comes with an increased cost of put remove and update operations.

Examples

[]
[ ("#1G1AF1F57A7192174", 5); ("#2F4AH1J77O7132095", 10) ]

Properties


Michelson


Related

key

Account's public key.

Example

"edpkurLzuFFL1XyP3fed4u7MsgeywQoQmHM45Bz91PBzDvUjQ9bvdn"

Properties


Michelson


Related

key_hash

Hash of a public key.

Example

"tz1Lc2qBKEWCBeDU8npG6zCeCqpmaegRi6Jg"

Properties


Michelson


Related

lambda<T, R>

Anonymous function value with a parameter of type T that returns a value of type R.

Example

lambda<nat>((x : nat) -> 2 * x + 1)

Properties


Michelson


Related

list<T>

Chained list of elements.

Parameter

T

(any type)

type of the elements of the list


Examples

[]
[ 1 ]
[ "abc", "def" ]

Properties


Michelson


Related

map<K, V>

Imutable (read only) maps from key to value; keys are sorted in natural order (K is comparable).

Parameters

K

(any comparable type)

type of the key


V

(any type)

type of the associated value


Example

[ (0, "a string"); (1, "another string") ]

Properties


Michelson


Related

nat

never

Empty type.

Example


Properties


Michelson


Related

operation

Operation generated by contract execution.

Example


Property


Michelson


Related

option<T>

Optional value, that is either some value of type T, or none.

Parameter

T

(any type)

type of the value when the option is some value


Examples

none
some("abcd")

Properties


Michelson


Related

or<T1, T2>

Union of two types: its value can either be of the one or the other type (left or right).

Parameters

T1

(any type)

left type


T2

(any type)

right type


Examples

const o : or<nat, string> = left<string>(2)
const o : or<nat, string> = left<nat, string>(2)
const o : or<nat, string> = right<nat>("#a56fG")
const o : or<nat, string> = right<nat, string>("#a56fG")

Properties


Michelson


Related

partition<A>

Type of asset field to reference assets from another collection A, so that each asset from A is referenced by exactly one asset from this collection.

For example, field drives references assets from the car asset collection:

asset car {
vin : string;
nbdoors : nat = 0
}

asset driver {
id : address;
drives : partition<car>
}

Notes:

  • a car asset may only be added via the drives partition with for example:
driver[a].drives.add({ vin : "1G1AF1F57A7192174" })
  • straightforwardly adding in car collection fails at compilation
  • two drivers cannot reference the same car

Example


Properties


Michelson


Related

rational

Arbitrary-precision floating point number.

It is implemented in Michelson as a pair of int and nat.

Examples

1.1
-1.1
1 / 3
-1 / 3
80%
4.2%

Properties


Michelson


Related

record

Fixed list of named fields of different types.

A record has the common properties of its fields.

Example

{ red = 0xa4; green = 0x6a; blue = 0xc0 }

Property


Michelson


Related

sapling_state(n)

Sapling state.

Parameter

n

(natural number)

Memo size


Example


Properties


Michelson


Related

sapling_transaction(n)

Sapling transaction.

Parameter

n

(natural number)

Memo size


Example


Properties


Michelson


Related

set<T>

Set of values of comparable type T. It can be iterated with for in T's natural order.

Example

[ tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb; tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6]

Properties


Michelson


Related

signature

Cryptographic signature.

Example

"edsigtvwtJaiM7phNNkZjazqKtthDxc3WswYNL961GKgz7VxvPJmWJ8WEkmEZd9oFM1RvwABYW3uYgwGRP7nuBns5WrqyfYsUaB"

Properties


Michelson


Related

string

Array of non-extended ASCII characters.

Examples

"This is a string"
"12345"

Properties


Michelson


Related

tez

Tezos currency in mutez (millionth of XTZ); several literal units are provided:
  • 1tz is 1000000 mutez
  • 1mtz is 1000 mutez
  • 1utz is 1 mutez
For tz and mtz it is possible to use floating point literals with a maximum of respectively 6 and 3 decimal places; hence 1.5324235tz and 1.5324mtz are not valid.

Examples

1tz
1mtz
1utz
1.23tz
1.2mtz

Properties


Michelson


Related

ticket<T>

Contract-authenticated data.

Parameter

T

(any type)

type of the value held by the ticket


Example


Properties


Michelson


Related

tuple

Fixed list of anonymous values of different types.

Examples

("a string", 3)
(0x22, none)

Properties


Michelson


Related

unit

Type to express no value, only inhabited by the Unit value.

Examples

Unit
()

Properties


Michelson


Related