Basic Types
fi is a statically typed language, where a variable must be typed on declaration and that type cannot change. When you are setting a variable to a literal value, you must also ensure the type is declared.
storage nat Foo;
entry Test(int Bar){
let string Hello = string "World";
#We must declare the type of all literals
During compilation, types are strictly checked and enforced. These types reflect the native Michelson types. All available basic types are defined below:


bool - possible values being either true or false.
let bool available = bool true;

Integers & Natural Numbers

Integers and naturals are arbitrary-precision, meaning the only size limit is fuel. The only difference is that Natural Numbers are unsigned.
int - possible values being any integer value (negative and positive) nat - possible values being any positive integer value
let nat n1 = nat 1;
let nat n2 = nat 2;
let nat n3 = sub(n1, n2); # Fail - must be declared as an int
let int n4 = sub(n1, n2); # OK
let nat n5 = to_int(sub(n1, n2)); # Also OK
Note: Some arithmetic functions will return a different type based on the input types. You can use to_* functions if you need to typecast a specific value.


Strings are used to hold a value in text form.
string - possible value being anything, but must be encompassed by double-quotes "text"
let string name = string "John";


Mutez is the native Michelson type for defining a variable to represent a mutez, the native currency of Tezos in its smallest denomination (e.g. 0.000001 tez).
Mutez are internally represented by a 64 bit signed integer. There are restrictions to prevent creating a negative amount of mutez. Operations are limited to prevent overflow and mixing them with other numerical types by mistake. They are also checked for under/overflows.
mutez - possible values being any positive integer value
let mutez amount = mutez 100000000;


Timestamps represent a date/time value.
timestamp - valid RFC 339 notation, encompassed by double-quotes, or alternatively number of seconds since Unix Epoch.
let timestamp today = timestamp "2019-02-20 00:00:00";
let timestamp alsotoday = timestamp 1550638795;


Addresses are untyped native contract addresses stored on the Tezos blockchain.
address - must be a valid public address and must be provided in the base58-check encoded version encompassed by double quotes (e.g. "KT1...", "tz1...").
let address payee = address "tz1...";

Public Key

Public keys are used for verifying a signed message using the verify function, or can be converted to a public key hash (pkh/key_hash) and used for on-chain operations (delegation, origination and transfer).
key - must be a valid public key, encompassed by double quotes, in the base58-check encoded format (e.g. "edpk...", "p2pk")
let key signer = key "edpk...";

Public Key Hash

Public key hashes are the hashed form of a key, and can also be used to create an implicit contract (and therefore address using typecasting). This type can be declared as key_hash or via an alias, pkh.
key_hash|pkh - must be a valid public key hash, encompassed by double quotes, in the base58-check encoded format (e.g. "tz1...", "tz2...").
let key_hash signer = pkh "tz1...";


Signatures are base58-check encoded signatures (e.g. "edsig..."). These can be generated by the node-client to sign a message with a users private key. This can then be verified within fi using the verify function.
signature - must be a valid base58-check encoded signature, encompassed by double-quotes "..."
let signature sig = signature "edsig...";


Bytes are defined as hexadecimal, and can be used for multiple purposes.
bytes - must be valid hex, starting with 0x. This should not be wrapped in double quotes;
let bytes b = bytes 0x08aa28;