Skip to main content

Zenroom for Python: Bindings of Zenroom library for Python.

Project description

Use Zenroom in Python3


Zenroom

zenroom.py 🐍
A Python3 wrapper of Zenroom, a secure and small virtual machine for crypto language processing



Build status Code coverage PyPI


This 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.


💾 Installation

pip install zenroom

NOTE - 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:

pip install zenroom --pre

🎮 Usage

Two main calls are exposed, one to run zencode and one for zenroom scripts.

If you don't know what zencode is, you can start with this blogpost https://decodeproject.eu/blog/smart-contracts-english-speaker The official documentation is available on https://dev.zenroom.org/zencode/

A good set of examples of zencode contracts could be found on

🐍 Python wrapper

the wrapper exposes two simple calls:

  • zenroom_exec
  • zencode_exec

as the names suggest are the two methods to execute zenroom (lua scripts) and zencode.

args

Both functions accept the same arguments:

  • script string the lua script or the zencode script to be executed
  • keys string the optional keys string to pass in execution as documented in zenroom docs here
  • data string the optional data string to pass in execution as documented in zenroom docs here
  • conf string the optional conf string to pass according to zen_config here

return

Both functions return the same object result ZenResult that have two attributes:

  • stdout string holds the stdout of the script execution
  • stderr string holds the stderr of the script execution
Examples

Example usage of zencode_exec(script, keys=None, data=None, conf=None)

from zenroom import zenroom

contract = """Scenario ecdh: Create a keypair"
Given that I am known as 'identifier'
When I create the keypair
Then print my data
"""

result = zenroom.zencode_exec(contract)
print(result.output)

Example usage of zenroom_exec(script, keys=None, data=None, conf=None)

from zenroom import zenroom

script = "print('Hello world')"
result = zenroom.zenroom_exec(script)

print(result.output)

The same arguments and the same result are applied as the zencode_exec call.


📋 Testing

Tests are made with pytests, just run

python setup.py test

in zenroom_test.py file you'll find more usage examples of the wrapper


🌐 Links

https://decodeproject.eu/

https://zenroom.org/

https://dev.zenroom.org/

😍 Acknowledgements

Copyright (C) 2018-2022 by Dyne.org foundation, Amsterdam

Originally designed and written by Sam Mulube.

Designed, written and maintained by Puria Nafisi Azizi

Rewritten by Danilo Spinella and David Dashyan

Project funded by the European Commission This project is receiving funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement nr. 732546 (DECODE).

👥 Contributing

Please first take a look at the Dyne.org - Contributor License Agreement then

  1. 🔀 FORK IT
  2. Create your feature branch git checkout -b feature/branch
  3. Commit your changes git commit -am 'Add some fooBar'
  4. Push to the branch git push origin feature/branch
  5. Create a new Pull Request gh pr create -f
  6. 🙏 Thank you

💼 License

  Zenroom.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/>.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zenroom-3.6.0.tar.gz (25.6 MB view details)

Uploaded Source

Built Distributions

zenroom-3.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.0 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

zenroom-3.6.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.7 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.24+ i686

zenroom-3.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.7 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64 manylinux: glibc 2.24+ ARM64

zenroom-3.6.0-cp311-cp311-macosx_10_9_x86_64.whl (652.8 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.6.0-cp311-cp311-linux_armv7l.whl (775.7 kB view details)

Uploaded CPython 3.11

zenroom-3.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.0 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

zenroom-3.6.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.24+ i686

zenroom-3.6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64 manylinux: glibc 2.24+ ARM64

zenroom-3.6.0-cp310-cp310-macosx_10_9_x86_64.whl (652.8 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.6.0-cp310-cp310-linux_armv7l.whl (775.7 kB view details)

Uploaded CPython 3.10

zenroom-3.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

zenroom-3.6.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.24+ i686

zenroom-3.6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.7 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64 manylinux: glibc 2.24+ ARM64

zenroom-3.6.0-cp39-cp39-macosx_10_9_x86_64.whl (652.8 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.6.0-cp39-cp39-linux_armv7l.whl (775.7 kB view details)

Uploaded CPython 3.9

zenroom-3.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.0 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

zenroom-3.6.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.24+ i686

zenroom-3.6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.7 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64 manylinux: glibc 2.24+ ARM64

zenroom-3.6.0-cp38-cp38-macosx_10_9_x86_64.whl (652.8 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.6.0-cp38-cp38-linux_armv7l.whl (775.1 kB view details)

Uploaded CPython 3.8

File details

Details for the file zenroom-3.6.0.tar.gz.

File metadata

  • Download URL: zenroom-3.6.0.tar.gz
  • Upload date:
  • Size: 25.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for zenroom-3.6.0.tar.gz
Algorithm Hash digest
SHA256 e7174756663646a411f4865ed6c5fdf211413868549549b2c820ff2ed1dba188
MD5 313dd6e811a598c04dd71c5da84ee5b6
BLAKE2b-256 4cf798b4bb9bd5f50489dcaa3908e6dc33bc5d1411d5539a08f19afe0c7098c1

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 8e11860ed9c347df7640222c8e98c1561ccdc2b8945e6d0e2482b8b4d7417811
MD5 b650301996d411466e2edaad9d53378d
BLAKE2b-256 87eb989a0165747d0e079838db860ec18593e465d691503e7d0ebc91a303866a

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d33084111a6c87ee3dd3dd5d74b28a4b203f87065403c79412718c8771f385b5
MD5 8672dab55576b12fc277a5be22e759bf
BLAKE2b-256 c7e01134017558e5c32f7bb77a8f4259111649a78a2439acb7b2291a14d7395f

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8f0512e71d2f3d98de069e0b423ac84343da60e466c52174336d4d012498c972
MD5 16050149653fcaaf8e6cfd597274d42f
BLAKE2b-256 77c96acfb152bd779c951fd3386a7e32d6de9669f99505bb1fed08ba2f2b5a91

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f9258dc39ae13aec216a96835c881e3d1b7c43afc5c236662ab5030a0e19afe3
MD5 ac3d43893afccd8dc8ca375b795310be
BLAKE2b-256 84d57a33860a854b3abd98f264ad652a2ae41bcae78df6b55178c906a06f11b1

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp311-cp311-linux_armv7l.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 2ad7aec803cb5aa375faf1fd7028a6f6bdbe7616c2eb020b8e1148a79b85f70e
MD5 9698a934d4234e29e8a2691dd0a00f71
BLAKE2b-256 df96c0742ee14f297d57415e52127ec5466ba6a733eafc34075614eb974ace6c

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 6ffc5c40d9bd658360227351ef53e0ef3177f9539d7afbb28958296dd145422b
MD5 99ab7d5f58d207adaf328d0da56a7e10
BLAKE2b-256 3927aaa7e34d957695cfae3a6c7e5b8efa8913bb3f9bf15aac53eaff133b10b0

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b2b7e9b5bc1ee9d5ec66e61ffedf1b4a2fcd5ca12e27e901a5a4f9d8cf0a718d
MD5 9eb3d11214e4d788c0a6699cba448743
BLAKE2b-256 7fdc07bf1a2464eec3f5a4f0d80264c0e3223a9de9a57f0d92f8c8747ebe1793

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 3c7cdb9ee6590ca4ee3cc7ed5e59c6427fec3b819f676d21bd36db827bfbd9a6
MD5 252d9b5234127c5b5520d15028f0fb6c
BLAKE2b-256 e8e71bf04a618ee227e8afceca016e75369ef82a2add31c8ed8f63b695567430

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9c88efb0b7bed2c09a96b626b5bee0debb4da5a2391b373d5952626ecc6af94b
MD5 2f9af3225c151109952dd501b219e735
BLAKE2b-256 eb10aa108799b02b5ef702ecea17a97ad32ec03ec7686b9d10543a68cd2f88d7

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp310-cp310-linux_armv7l.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 24b338736514885333b114b40d3a92ecdd11075e3cae76e345ae1d4890acc4de
MD5 b807fc3067144f3b5a86d91efe44f7ea
BLAKE2b-256 6384a44bc94db645c9fa533f0f864217c56feed460066d5e006a846a8062644e

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 98057941a82c5d2d41b4e1769e67e6c02e677c4e93b7a94d2237397bd9492265
MD5 fd4296378208f69158a86faa7de518e2
BLAKE2b-256 9b75a526c663714bb3021cdb69a39313b843a820cbf68033ea07782ef99693be

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ff537531c7d25637b4187373170cba44fb3c19494bf79caeed4a2b45917181c4
MD5 f754883cfa9a743c0455a6c2dc1ed26d
BLAKE2b-256 7499b937f7381cf2f4830d2d5548b96d2b850d3f3bc5dd748252aea05f0e4798

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 dd7a64e3ecbb0c22eed2b65d33471b8c4ac8da977c69a3729ae869f68f655304
MD5 fdba8a98bda53e9e32dfc802858ff338
BLAKE2b-256 640cee782a8063acc16e8b492092a7d125720b64ffa21e3e4c7b9350359c1f37

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 747eb449904af87d5822931ee54eaba04f43c8eda83fda363a178ccf454f2cb0
MD5 cd9d20e44dfbb132710d7018cd0573b0
BLAKE2b-256 7c522070abba68e756c4270278bb5c2c652d27e585a4049277e8d08942733e0b

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp39-cp39-linux_armv7l.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 f9aab9607ecacee68f83af0ee2704c4775edf08faf62b3f0017ccdf7b547760e
MD5 6130fe204a9b6df327b382db6b8bc00b
BLAKE2b-256 cf9a5b3795e05ad37929bd6ba4ffbde28553cf0fc2da04e84a648a63d35adee5

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 6e1471a4e5da7983257f41f9960c81a5e8d905b820f9942d96b96ee1472c5e79
MD5 29f6fae9fa3c6c98697fcefb36dd4fc5
BLAKE2b-256 bc1c7fc1d9f0261bb1a52e8e3468b15334b78168247f3e8c8651d543d67d1f43

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5ed05a4e2b4eed39671e87c2ff4aec702a7ee5cfcdf9cb09b5c83ff567a34c61
MD5 1ac18c13119a7f188a65a1ff70decde2
BLAKE2b-256 956d46e22bc15e95a823e3e84f9624b9e5d4d9885dc80afe3b7a03fbb6679be9

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 273751b818d5f862ae88c090d6a80e7cdeac9b7b0584ae03d07d5846397f0da8
MD5 e7ac1df6f90b4c97a180e5bd5407a3b0
BLAKE2b-256 e962c12f1dda90dad6025a3716117fb31e3089c03f0bd28257bb374858ab810b

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b1eca22ad69a74e79ddc079fcac988a25a7542a1f34fc88039686680386b6baa
MD5 f68d244ef518476f00fb6df95250a197
BLAKE2b-256 15c8059c281187408234b4903e88ffd874bf2cd459f3453b28864f8fe82a3d39

See more details on using hashes here.

File details

Details for the file zenroom-3.6.0-cp38-cp38-linux_armv7l.whl.

File metadata

File hashes

Hashes for zenroom-3.6.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 92f84d654a1853d9c47f35cc7985248d268d451575e48437d6ad5a8948ffb977
MD5 273eca37b2890bb7e543f5900621c8b3
BLAKE2b-256 c030e70f9b0f4e6b4e37a2620ffb1ad20d11d25a7ee829ff0d094a03f1ecb598

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page