New Release for SmartPy and Open Source Version and Syntax, Testing, and Michelson Compiler Improvements
3 min readJan 13, 2020


It is our great pleasure to announce the first open source release of SmartPy and

Open Source Release

This release is our first Open Source version. It uses an MIT license.

It is available here:

In 2019, the development has been very active in a private repository that is expected to remain active while the gitlab repository will be used to interact with the community.

We expect to make regular releases and fully transition to the public repository sometime this year.

Change of Syntax

This release contains some important changes.

Snake Case

First, we are switching SmartPy commands to snake case for readability and coherence with both Python and Michelson. For example sp.entryPoint is now called sp.entry_point.

There is an automated translation tool for this part in that is triggered automatically when evaluating a script.

Local Variables

Second, we listened to our users and a point of misunderstanding and bugs was related to the syntax of local variables. We changed the syntax and, here, the translation tool cannot work so please expect some work for this part.

  • sp.newLocal is renammed sp.local (this is done automatically)
  • if loc is a local variables, its value is set and accessed to by using loc.value. For example, we now write loc.value = 3 + 2 * loc.value.

A complete example with the new syntax:

def squareRoot(self, 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))) = y.value

Remark: we don’t use loc.set(...) anymore.

Updates in Scenarios

Scenarios are now more powerful than ever.

A typical scenario has this shape.

c1 = MyContract(12, 123)
scenario += c1
# And call some of its entry points
scenario += c1.myEntryPoint(12)
scenario += c1.myEntryPoint(13)
scenario += c1.myEntryPoint(14)
scenario += c1.myEntryPoint(50)
scenario += c1.myEntryPoint(50)
# this is expected to fail
scenario += c1.myEntryPoint(50).run(valid = False)
# Finally, we check its final storage
scenario.verify( == 151)

Test Accounts

We can now define test accounts by name in scenarios. A test account is then generated and comes with an address, a public key, a public key hash and a secret key.

  admin = sp.test_account("Administrator")
alice = sp.test_account("Alice")
bob = sp.test_account("Robert")

Showing Expressions

In a scenario, it’s possible to show expressions. It’s useful to follow what is happening., html = True, stripStrings = False)

Computing Expressions

In a scenario, we can also compute expressions.

The following command in a script

x = scenario.compute( * 12)

computes * 12 and stores its value in a variable x.

The variable x can later be used in expressions in the scenario.

Testing Equality

Testing equalities is of paramount importance in tests.

There are two ways to test equalities:

# Verifying a boolean expression that happens to be an equality
scenario.verify( == 51)
# Verifying an equality
scenario.verify_equal( == [2, 3, 5, 7])

The new construction scenario.verify_equal is useful to test equality on non comparable types.


The Michelson compiler generates Michelson code from SmartPy code. It has witnessed huge improvements in the past months. We are now able to compile many more constructions.

Better exception handling

Exception handling has been an important subject and we are now closer to where we want to be in terms of precision of error messages including location information.

Regular vs Reference Templates

Templates have been split between Regular and Reference templates.

Regular templates are templates that are supposed to do something meaningful. Reference templates are here to document the syntax and show how things can be articulated.


We’re now managing our own nodes on all networks: mainnet, carthagenet, babylonnet, labnet, zeronet.


The reference manual has been enhanced. It is visible from the editor by doing Help -> Reference Manual.

What comes next

Many things are coming for contracts, tests and compiler.

For tests, something that is arriving is the possibility to directly execute the scenarios in the translated Michelson world.

How To Contribute

The open source release means that we need to explain to the community how to contribute.

The code is more stable than it used to be, we expect to refactor huge parts of the code on a less frequent basis so it may be a better timing now to get involved.

There are several possibilities to get involved:

  • Providing documentation
  • Writing templates
  • Reporting bugs and asking for improvements
  • Adding features or operators

In general, please bear in mind that the development is quite active so please do not hesitate to contact us prior to working on a feature.



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