Python compiler for the Neo Virtual Machine

License: MIT

Language: Python


Python compiler for the Neo Virtual Machine

Coverage Status


The neo-boa compiler is a tool for compiling Python files to the .avm format for usage in the Neo Virtual Machine which is used to execute contracts on the Neo Blockchain.

The compiler supports a subset of the Python language ( in the same way that a boa constrictor is a subset of the Python snake species)

What does it currently do

  • Compiles a subset of the Python language to the .avm format for use in the Neo Virtual Machine
  • Works for Python 3.6+
  • supports dictionaries
  • Adds debugging map for debugging in neo-python or other NEO debuggers

What will it do

  • Compile a larger subset of the Python language

Get Help or give help

  • Open a new issue if you encounter a problem.
  • Or ping @localhuman on the NEO official community chatroom.
  • Pull requests welcome. New features, writing tests and documentation are all needed.


Installation requires a Python 3.6 or later environment.


pip install neo-boa


This project contains a Dockerfile to batch compile Python smart contracts. Clone the repository and navigate into the docker sub directory of the project. Run the following command to build the container:

docker build -t neo-boa .

The neo-boa Docker container takes a directory on the host containing python smart contracts as an input and a directory to compile the .avm files to as an output. It can be executed like this:

docker run -it --rm -v /absolute/path/input_dir:/python-contracts -v /absolute/path/output_dir:/compiled-contracts neo-boa

The -v (volume) command maps the directories on the host to the directories within the container.


Clone the repository and navigate into the project directory. Make a Python 3 virtual environment and activate it via:

python3 -m venv venv
source venv/bin/activate

or, to install Python 3.6 specifically:

virtualenv -p /usr/local/bin/python3.6 venv
source venv/bin/activate

Then, install the requirements:

pip install -r requirements.txt


The compiler may be used like in the following example:

from boa.compiler import Compiler


For legacy functionality without NEP8 stack isolation compatibility, use the following:

from boa.compiler import Compiler

Compiler.load_and_save('path/to/your/', use_nep8=False)


You can read the docs here.


Install neo-python ( or use requirements_test.txt) and run the following command

python -m unittest discover boa_test



Accepted at ATEMNPSjRVvsXmaJW4ZYJBSVuJ6uR2mjQU

Project Statistics

Sourcerank 8
Repository Size 1.19 MB
Stars 57
Forks 51
Watchers 16
Open issues 10
Dependencies 21
Contributors 20
Tags 19
Last updated
Last pushed

Top Contributors See all

localhuman hal0x2328 Nikolaj Kuntner belane Erik van den Brink Sérgio Flores jordanfung Travis Chris Hager Alex Hulbert slipo Jorrit van den Berg Conor Scott Stefan Dasbach iddober Shargon Wyatt Mufson Anton jhepkema Jonathan Winters

Packages Referencing this Repo

A simplified Python compiler for the Neo Virtual Machine to support ontology-python-obox
Latest release 0.4.11 - Updated - 57 stars
A Python compiler for the Neo Virtual Machine
Latest release 0.5.6 - Updated - 57 stars

Recent Tags See all

v0.5.6 October 30, 2018
v0.5.5 October 10, 2018
v0.5.4 October 10, 2018
v0.5.3 September 28, 2018
v0.5.2 September 25, 2018
v0.5.1 September 25, 2018
v0.5.0 August 26, 2018
v0.4.9 August 24, 2018
v0.4.8 July 05, 2018
v0.4.7 June 21, 2018
v0.4.6 June 19, 2018
v0.4.5 June 18, 2018
v0.4.4 May 31, 2018
v0.4.3 May 14, 2018
v0.4.2 April 30, 2018

Interesting Forks See all

Python compiler for the Neo Virtual Machine
Python - MIT - Last pushed - 4 stars - 9 forks

Something wrong with this page? Make a suggestion

Last synced: 2018-09-25 15:52:37 UTC

Login to resync this repository