Package: zenroom
Use Zenroom in Python3zenroom.py 🐍A Python3 wrapper ofZenroom, a secure and small virtual machine for crypto language processingThis library attempts to provide a very simple wrapper around the Zenroom
(https://zenroom.dyne.org/) crypto virtual machine developed as part of the
DECODE project (https://decodeproject.eu/), that aims to make the Zenroom
virtual machine easier to call from normal Python code.Zenroom itself does have good cross platform functionality, so if you are
interested in finding out more about the functionalities offered by Zenroom,
then please visit the website linked to above to find out more.💾 InstallationpipinstallzenroomNOTE- the above command attempts to install the zenroom package, pulling in
the Zenroom VM as a precompiled binary, so will only work on Linux and macOS
machines.for the edge (syn to the latest commit on master) version please run:pipinstallzenroom--preThezenroompackage is just a wrapper around thezencode-executility.
You also need to installzencode-exec, you can download if from the officialreleases on githubWhen after downloading you have to move it somewhere in your path:sudo cp zencode-exec /usr/local/bin/Warning: on Mac OS, the executable iszencode-exec.commandand you have to symlink it tozencode-execsudo cp zencode-exec.command /usr/local/bin/
cd /usr/local/bin
sudo ln -s zencode-exec.command zencode-exec🎮 UsageTwo main calls are exposed, one to runzencodeand one forzenroom scripts.If you don't know whatzencodeis, you can start with this blogposthttps://decodeproject.eu/blog/smart-contracts-english-speakerThe official documentation is available onhttps://dev.zenroom.org/zencode/A good set of examples ofzencodecontracts could be found onzencode simple testszencode coconut tests🐍 Python wrapperthe wrapper exposes two simple calls:zenroom_execzencode_execas the names suggest are the two methods to execute zenroom (lua scripts) and zencode.argsBoth functions accept the same arguments:scriptstringthe lua script or
the zencode script to be executedkeysstringthe optional keys
string to pass in execution as documented in zenroom docsheredatastringthe optional data
string to pass in execution as documented in zenroom docshereconfstringthe optional conf
string to pass according to zen_configherereturnBoth functions return the same object resultZenResultthat have two attributes:stdoutstringholds the stdout of the script executionstderrstringholds the stderr of the script executionExamplesExample usage ofzencode_exec(script, keys=None, data=None, conf=None)fromzenroomimportzenroomcontract="""Scenario ecdh: Create a keypair"Given that I am known as 'identifier'When I create the keypairThen print my data"""result=zenroom.zencode_exec(contract)print(result.output)Example usage ofzenroom_exec(script, keys=None, data=None, conf=None)fromzenroomimportzenroomscript="print('Hello world')"result=zenroom.zenroom_exec(script)print(result.output)The same arguments and the same result are applied as thezencode_execcall.📋 TestingTests are made with pytests, just runpython setup.py testinzenroom_test.pyfile you'll find more usage examples of the wrapper🌐 Linkshttps://decodeproject.eu/https://zenroom.org/https://dev.zenroom.org/😍 AcknowledgementsCopyright (C) 2018-2022 byDyne.orgfoundation, AmsterdamOriginally designed and written by Sam Mulube.Designed, written and maintained by Puria Nafisi AziziRewritten by Danilo Spinella and David DashyanThis project is receiving funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement nr. 732546 (DECODE).👥 ContributingPlease first take a look at theDyne.org - Contributor License Agreementthen🔀FORK ITCreate your feature branchgit checkout -b feature/branchCommit your changesgit commit -am 'Add some fooBar'Push to the branchgit push origin feature/branchCreate a new Pull Requestgh pr create -f🙏 Thank you💼 LicenseZenroom.py - a python wrapper of zenroom
  Copyright (c) 2018-2022 Dyne.org foundation, Amsterdam

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as
  published by the Free Software Foundation, either version 3 of the
  License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.