Introducing SmartPyBasic, a simple CLI to build Tezos smart contract in Python


sh <(curl -s local-install ~
~/SmartPyBasic/scripts         # A list of demo scripts (here, only # The SmartPy library # A helper module used by SmartPy, mostly in browser
smartmljs.bc.js # The SmartML library # A mock module to simulate a browser
smartmlbasic.js # A node JavaScript file to interact with SmartML # A helper library # A helper shell-script

A demo script

## Copyright 2019 Smart Chain Arena LLC. ### To run this script, we need to setup a PYTHONPATH to the
# SmartPyBasic directory.
# If the SmartPyBasic directory is ~/SmartPyBasic, then
# PYTHONPATH=~/SmartPyBasic python3
# or
# ~/SmartPyBasic/ run
# should work.
import smartpy as spclass MyContract(sp.Contract):
def __init__(self, myParameter1, myParameter2):
self.init(myParameter1 = myParameter1,
myParameter2 = myParameter2)
def myEntryPoint(self, params):
sp.verify( <= 123) += params
# We evaluate a contract with parameters.
contract = MyContract(12, 13)
# We need to export the compile the contract.
# It can be done with the following.
import smartpybasic as spb
targetBaseFilename = /tmp/myContractDemo")
print("Contract compiled in /tmp/")

Direct use with Python

PYTHONPATH=~/SmartPyBasic python3 ~/SmartPyBasic/scripts/
ls -ltr /tmp/myContractDemo*
~/SmartPyBasic/ run ~/SmartPyBasic/scripts/
ls -ltr /tmp/myContractDemo*
-rw-r--r--   ... myContractDemoExpression.smlse
-rw-r--r-- ...
-rw-r--r-- ...

The run command

with sp.ifBlock(condition):
with sp.elseBlock():
with sp.forBlock('x', l) as x:
with sp.whileBlock(condition):
~/SmartPyBasic/ run <>

The local-compile command

~/SmartPyBasic/ local-compile "TicTacToe()" /tmp/tictactoe

Going further




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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Cloud-Native Speed and Performance Matters

Git and GitHub Reference

3 Surefire Ways Offline Apps Will Not Drive Your Business Into The Ground During Crisis.

Someone reading a book by the window, visual artwork including translucent images design

Kylin Network is Supported by Web3 Foundation Grants Program

Modern File Transfer Solution on Azure — SFTP

INT 4.0 3-Day Countdown to Launch — China Node

The Ultimate Guide To Power Metrics For Mac OS X

AUTOSAR for Dummies — part 1

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

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

More from Medium

A-Z List Smart Contract Auditing Companies

Available types of variables in solidity

[DApps] Part III : Call Smart contract function by Web3.js

Problem: Running into the following error message when attempting to run the command truffle…