One Year Anniversary release
3 min readMar 5, 2020


One year after announcing SmartPy and, it is our great pleasure to announce our new release. It coincides with the great Carthage activation on the Tezos mainnet for no reason.

As always, we first activated it on
We’ll propagate it on in the next days if everything goes as smoothly as hoped and expected.

Compared to our last big release in January,, no big changes at the surface of SmartPy, we expect close to zero changes for existing SmartPy scripts; but, many new constructions, better explorer and a lot of work under the hood.

SmartPy Documentation

We updated our documentation:
It’s simply better compared to what we had before and we encourage all SmartPy developers to have a look at it. We also added links to SmartPy templates and Nomadic Labs’s awesome Michelson documentation.

Private Entry Points

This version introduces a new experimental feature called private entry points. These are entry points that you define in your contract, that you can call in tests but they are not generated in Michelson.

These are useful in tests for constructions such as:

def edit_storage(self, params):
sp.verify(params.a > 12) # verify some invariant # replace the complete storage

Custom Type Layouts

Another experimental and yet very useful feature is the ability to define custom layouts for records. The rational is that SmartPy maps records to trees of pairs in Michelson and these trees may require to be set precisely, typically for inter-contract communication such as with Asset Standards or such.

This is done by calling sp.set_record_layout.

For example,

sp.set_record_layout(params, ("a", ("b", "c")))

verifies that params has a record type with fields “a”, “b”, “c” and further ensures that those fields are paired according to the layout ("a", ("b", "c")).

Type Inference

SmartPy uses a type inference algorithm to keep the programming experience pleasurable while ensuring that everything goes smoothly afterward.

We have improved our algorithm in some subtle directions which enables us to nicely type sp.ediv and other heavily overloaded constructions.


New work on integrating lambdas inside SmartPy led to new nice constructions.

In a contract, we can now write

def square_root(x):
sp.verify(x >= 0)
y = sp.local('y', x)
sp.while y.value * y.value > x:
y.value = (x // y.value + y.value) // 2
sp.verify((y.value * y.value <= x)
& (x < (y.value + 1) * (y.value + 1)))
return y.value

This will simply define a global function that can be call from entry points when necessary. This is a special case of a more general construction but clearly the most important one.

Local lambdas can also be created by simply doing, for example:

f = sp.build_lambda(lambda x: x + 3)

A lambda can then be used by simply calling it f(x). The Michelson APPLY notion has an exact SmartPy formulation. When f is a lambda on a pair, f.apply(x) partially applies f to x.

Contract Explorer

Our contract explorer has also seen several important improvements: it is really fast, operations (thanks to TzStats api) are better reported, Michelson code is nicely typed and shown for SmartPy and non-SmartPy contracts alike, etc.

Command Line Interface

The command line interface has been updated as well for the dev version.

To install from dev, please see the documentation and type:

sh <(curl -s local-install-dev ~

Former Versions

We do not expect anyone to need these former versions.

The former dev version is here:

The former dev CLI is here:

sh <(curl -s local-install-custom SmartPyBasicPrevDev20200305 ~

Data Type Layout

(this is an new edit from March 17)

Record and variant types are mapped to pair and or trees in Michelson. A mapping is built automatically by SmartPy (balanced binary tree).

Two important elements for this version:

  • This mapping changed with this version. The new version is much better than what it used to be but it can be disconcerting.
  • There is now a way to explicitely determine the obtained geometry called layout. It is explained and demo’ed in the SmartPy reference manual



An intuitive and effective smart contracts language and development platform for Tezos. In Python.