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

This version

3.3.0

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

Uploaded Source

Built Distributions

zenroom-3.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.5 kB view details)

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

zenroom-3.3.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.2 kB view details)

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

zenroom-3.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (746.9 kB view details)

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

zenroom-3.3.0-cp311-cp311-macosx_10_9_x86_64.whl (652.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.3.0-cp311-cp311-linux_armv7l.whl (775.1 kB view details)

Uploaded CPython 3.11

zenroom-3.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.5 kB view details)

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

zenroom-3.3.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.2 kB view details)

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

zenroom-3.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (746.9 kB view details)

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

zenroom-3.3.0-cp310-cp310-macosx_10_9_x86_64.whl (652.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.3.0-cp310-cp310-linux_armv7l.whl (774.6 kB view details)

Uploaded CPython 3.10

zenroom-3.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (786.8 kB view details)

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

zenroom-3.3.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.2 kB view details)

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

zenroom-3.3.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (746.9 kB view details)

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

zenroom-3.3.0-cp39-cp39-macosx_10_9_x86_64.whl (652.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.3.0-cp39-cp39-linux_armv7l.whl (775.1 kB view details)

Uploaded CPython 3.9

zenroom-3.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.5 kB view details)

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

zenroom-3.3.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.2 kB view details)

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

zenroom-3.3.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (746.9 kB view details)

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

zenroom-3.3.0-cp38-cp38-macosx_10_9_x86_64.whl (652.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.3.0-cp38-cp38-linux_armv7l.whl (774.5 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 c6f42c00e488f7c6b1f22745ac16276f5e9e93dcb868767f771466b22e8f6b41
MD5 72de2a7233ec346fd866f0043ae6a9c4
BLAKE2b-256 b052e29d95909e394590f8608cf1f5e2fdd65550bf4741887c892985f9ba6a5a

See more details on using hashes here.

File details

Details for the file zenroom-3.3.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.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c6576a4d32eba8d09a37727237ecb4c8909ed37e7aa1e1ae11e5143a1963bd7f
MD5 27e3e5d958ecdc60f2184273c448dca5
BLAKE2b-256 206d50094e3cfa60f2afa775f945fef63465a2d1ea3e9f315db1f6621fdfa707

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 6419385f32cfefa66e9fc7508902922df8c519cd8cc1504bf5423d18ca4d7a24
MD5 1dffb387310ffde84b7395aa76bfd9e0
BLAKE2b-256 55436ae502e0723150d257ed3cd6a1ea305486aa9b98b9a3c02a8394c51013c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e854f2eda215f90cffc0fcc5162815eb4fb3ba3a5247c951d515e99937e7d1b5
MD5 4a0e10c5b9bb842dbf161808f81053e4
BLAKE2b-256 b829ab6678ea9afc3dbaaff708dbc995d7552cd74bf016c5fea0dbc5356df453

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d9b86ef53f1d90d6b18f87fefb4685fe7d0272a05b7a296434e28a08410cfc08
MD5 44c561b9883f718b57a2eaa0f7898174
BLAKE2b-256 d03779cac2171fd633c7c28d84bde33eb0453407a823f66029cd86791ae11e24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 fd6637f17f393e2e2c78ce39c1540e34afc3700300dca1d35a38f4980a9e1458
MD5 bd5316f78222ae34054ca5fcdeb2ecb7
BLAKE2b-256 52b976943acd89180c2a68858e457cb020be5b4266fb2a0e9d822e295b379a7d

See more details on using hashes here.

File details

Details for the file zenroom-3.3.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.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 8977ae4bc9056835577cc14fc7b458b116ffcab22f5602a7f30891ec626bf640
MD5 94371c18eaf68b35c2865a92a2c43d76
BLAKE2b-256 948e28fd0d7da534b2cc8987c57a01641b033488c98affd6f17f78b42a8421c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f7a30482a88488a90df0b52b59691b7ba66279f34b25cd3bf37bb915c827162b
MD5 160b16cf92bec5edf7947265e8d80504
BLAKE2b-256 643068318fdc7ab279ce4d7adca342f1dd7fc9898ca72e0e5bd77bde9510f897

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 4dd218677d105545ce4ea14a17c6476652f6237a685aebc3573f534e62f93978
MD5 6d754eaefbfe020597d4fb63a1e92bb8
BLAKE2b-256 5d1d13c11a25dab8624311b06f1653b36ac3978600900fa7a9eec7704f6ce063

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 847416dc4c406a576aa8250202853637e4d8bf208650894b182111ce27b710cd
MD5 42c17c88637e8e9b19c30ccff92c6c21
BLAKE2b-256 710e0bc7f1225f81ba92a5a3783708c502a252a0f2a8d94d3c2cfbc67e8ff65d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 ef0f5d97f60ae1c869abb0b4d93626a8073f158c66ffad9cfabd9422e4683d03
MD5 0c63276c60b28f43537e46908ff59e0d
BLAKE2b-256 d4f3e780f79cac938d12fe953278d7491c87221c779556cea5d3a663a606c5ca

See more details on using hashes here.

File details

Details for the file zenroom-3.3.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.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 5c1171ad24e66caad06506bc4b6110b2aacd1c89d980fe48df6c2470e812e97f
MD5 cc44a8d45ce3b0caee96d68ad171110e
BLAKE2b-256 5e486bfe55cf27b5796a1ee63f74679780b078101424196c12bdab225343a4f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d1fe250e684fa15359d0c1f4fea28ff8d0dd7b003be175af828f01b6d0bc0be4
MD5 24e7e78cd7c3ab3dee5e510ccbb40e1d
BLAKE2b-256 e0fd5f29dd4b007fbbe12fc7eb83af695c28a8709454d7834d4bb08c04a97023

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 3f3237a4f874d7b0c0ca983fdbe05b128fb790de1071fd7dc5a907bf501b3f02
MD5 1cd0d5f851ceb0853ada043b29ada13a
BLAKE2b-256 dafcf6783d5d775348bbf8cafa2eddbaefe06946148faf8c7cadeca0705a4278

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c06464a5c130d04bc109f309865a1fedde767fe20dd889e8d9be8e7bd53f3a3b
MD5 05582fbd76d289a4e86d841b8a2868ac
BLAKE2b-256 0613fe3ed98c97c5c0dd37df19bb07aa01a0e672b0a42f62d0304951ea097ae0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 198b91fcf2bffc0f24621062cc7aacae0b1f86607a84c91c8c857b37179d6f2f
MD5 a155b48fd88bde761c2d3e1548939942
BLAKE2b-256 20f401d74e0a19f04039472eb5fabafe794e251192e9c4f72d6b607c58119bd1

See more details on using hashes here.

File details

Details for the file zenroom-3.3.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.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 bf35708380b511cb2c98aef1dc9a12c00284b6b25f297f90ecbad89939a46868
MD5 5b9aef4783221487257c759632527403
BLAKE2b-256 4ee9c662e3b40fe4004255524b346f101cfe44954c193d20825024985c29a3a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 dc2707cdb82326f5eadf8d94ab8e641a971aa240a4e71fc40d74c621af8a9985
MD5 ae91ddc5cc0d75301d5843bd3f7d9c78
BLAKE2b-256 326523f53642c58a6b6124db6f375ee8c766e9c6d56cc7d80bf42d0d3369e4c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c0521d19dca7512d0382cbd3f2ba85419cd297ad389413063597295d1eac01e7
MD5 334edbb708e4f9bee47e20e735d032a6
BLAKE2b-256 f8e6d1fbd90128e63116d56a41fe3bc953bb3f8ece997800f409e41c16ee6cb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 eb98d232777680d3b800c893449d818d55e52435b53a5384ebcf3356de111355
MD5 bf1546e310da19dc0814746a0e5a435c
BLAKE2b-256 2b9174081130cf5d22e788e250fcc19f6be27da5aebe15301a282b2089e3b7d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 e83d24938eb193a591baaef74e604902f6b9dcdac6fd39e48b6a1674c3539390
MD5 92802f99bbd244426205cc7f1f3abc19
BLAKE2b-256 8ffeabbb9c5798675b70ed00f6f9899b7c3b9904497ac71e07f79ea93bba319c

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