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-2.12.0.tar.gz (82.6 MB view details)

Uploaded Source

Built Distributions

zenroom-2.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.12.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.3 kB view details)

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

zenroom-2.12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.12.0-cp311-cp311-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.12.0-cp311-cp311-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.11

zenroom-2.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.12.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.3 kB view details)

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

zenroom-2.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.12.0-cp310-cp310-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.12.0-cp310-cp310-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.10

zenroom-2.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.12.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.3 kB view details)

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

zenroom-2.12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.12.0-cp39-cp39-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.12.0-cp39-cp39-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.9

zenroom-2.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.12.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.3 kB view details)

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

zenroom-2.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.12.0-cp38-cp38-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.12.0-cp38-cp38-linux_armv7l.whl (877.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.12.0.tar.gz
Algorithm Hash digest
SHA256 c2d40fde42428397fa15cc028439a68c18ce4e6d5823e06f65d66f4847bdbd86
MD5 de7ebee26a7e3047b76e74baefdb15f9
BLAKE2b-256 377e39f188c994685837ba1f0ed551c98261e1c377c1ddda2b60c23efe45d1c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7ec2f099fb498536ded4976d0587aa29e61e05124fd6f97cd2e018301ab82e88
MD5 29847be8fde61bd50b2782ddda1d7375
BLAKE2b-256 8edca454a5db64b62b318a38e6971b41778113f0e8d334152f7e927e2fbe631a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3edae4694464024165422874dd333671e517cba6d3495d559ff78c8755b37b63
MD5 61702f00f806921dae8a12679e5879bd
BLAKE2b-256 6820804668c26e87d05b29f856a90bef10cbce937e8f25c73ec96e380b551c7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 ee572499f30dfce976dc789118a571da537f39b9af7364c5bd8ee0b4978096a5
MD5 e3afb0a4e4deca94b018ddc44f757f75
BLAKE2b-256 4a48618038b1263efce3676d7c00fe7371102adaff47501c7cab00f59ee870d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 39b91fdc621d7fc510ded954f302a7580644e3805f514f3545b49b183db8c9f3
MD5 e52dbf745c98f74137b470002a38d666
BLAKE2b-256 11b1302bcd6c9cd97264feb7d2def6aa4ef945f3d315886cde72cc8d03e8c081

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 da56cad5a5f94ba9553de3d8ecbf3cddd5f4c483b933c3631504ab7938d2402b
MD5 65049ef9de7a1bd09c9bf2b4d629153d
BLAKE2b-256 19b1be44946bac4ffb4bb44d504ce06f33e1b5b4f21f9a8f631a9b3530f6018a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0201a10c98a5c2d452d528b31a675befe639104810239865b6b58899c0d83859
MD5 aa2577c3f53fab2644b1d1fd7eb0ae09
BLAKE2b-256 06ef38d02b11a9f847d8f9c3306b5ec4367f80cc92e909d2ba19b1bdd54b0bd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 59e73ece77a7cdbe5fc103f1d202bb5691c0fccbd20f5a572e885cf64d21964a
MD5 70991b0acaa379bca9626614afd96c86
BLAKE2b-256 9f6cffb5d4d9d7e9647d612e4172e2d8bf986aabf8552f773cd6781add0274d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 1dcdb3381c6bea33d5dbce769b729f63c8652d7bc6299b3a64c49775e6f4bad2
MD5 2a0d24cde49f0ea6e705a82593cb6be3
BLAKE2b-256 10726fa6eae9e2d164cecb9e74b3043911bb993cf53a5c427c13842e793534b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0fe0da95c2cac3f74879c4b763e4ddcfc9b15e3577bba4e574305100da7a805e
MD5 567f71e16f994351347612d620ffe0b6
BLAKE2b-256 35b3ba442074f719bb2c09421dfe5350ba2ec9e4e56f1a6989c41b790e400d1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 671a8c68d88e702797b805d75c8438247ba80a4af7759c7433cd4ad093ca0271
MD5 70271e5e5c45fdaeb4850113a7c7ecf4
BLAKE2b-256 19d4067e0ed5f1470cd7e7f0595c381d565555beed517520c86da98445d53e93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 71959978134f6f38b8f7c840012b4f117d79c05916cdde67a2c56481a2c385d5
MD5 e7ccbe6526742b404590e74fa68d974b
BLAKE2b-256 6cac2f19a2b61ed6d16ef33bd89fcf2326846b0292980496f0029273d8d3afed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 70aa78343be9cf7bda248632333fa0477670cc7a6bd16f5066fb29b6ffbb398d
MD5 75c3d4a2041d3e11f2638d7229bfb20f
BLAKE2b-256 b1074c77c9e78f5f7232cde441c4404cced1f402d986210834f5a0e848d57148

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c75d8c5ab3f0d1b1f06a7bf59153488753dd2abb174a1cda1579b9169a102756
MD5 1a9a9e9c44027ea5405580d5f73db913
BLAKE2b-256 47b25ef404312c9d1e56164f6a246ff53acac4bf02f1aec6ef71600d9bb59e3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0fa56e44f6788cf8b2022e6ddb5fe902ddecf17c3d7c0f242c16d9e66cdd811a
MD5 f0c55c7b172a92141f04c9f6600b3261
BLAKE2b-256 ce363630b9f6044e5eca1f37ea9a663a8007dce3b8f2cc7ec01b59f9669b7d8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 882509f3768461910a5859a36885b9a754a04c53f2e7ce7b3f74d89ce98e75e5
MD5 5f59bf7779b9145bcfb70003b8a1adea
BLAKE2b-256 abb612236efed1f65696e6cf4745731d7d5da49581126a8d2a15ceff394a6db2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9916420acba724f8fc3de2605daf8fbadb2a268113ce645af90c5f924ebe6b44
MD5 ddfaa3f6b824d084c46bc0696dd05ab6
BLAKE2b-256 9cc34c9313bcac8e1f7573914d92d1773796c4aa42f8e0fde8cbb23188ba5685

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9576862d89de7f5a12b64b9c9e0a14afbbed3c3eb8eef940c184952dfbc2897c
MD5 3f7ad4e875b5dc01171b40e7f0d1aff6
BLAKE2b-256 b142df264abf2ac48ff42f761004eac3eff56a6c6c78d572c978435d1720cb22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 be71a27d3856f8acf444cb3deb11441b47ad76ce5c7250bf9e002493e6e514da
MD5 e0b79012a8ec67f4a333eee8089d433e
BLAKE2b-256 fa64ca5f42bd5935ea651e1f58062157c79cac3a3ba1654e65d60e64b3729936

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 755bbc64119d883c66dc35c36b37b1389e875cb927b80540defe71ac3c25aa3b
MD5 8dbdfee5b43adef320eeae540ca0425f
BLAKE2b-256 827a662fcd764db39340657ce1dea79e2fd97421d50bc7494e0e4c99683c9227

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.12.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 e9a267ac2cf6c77d0d434c483220c63616f78804e5ca0bcb449550db44d6a354
MD5 9cfb11153644a9bfdb43421364f4c1ce
BLAKE2b-256 9c9e02c013e5ee964456e82c85795033faef4cf8b07ea1ee05a8f44488cec917

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