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

2.3.1

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

Uploaded Source

Built Distributions

zenroom-2.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (903.5 kB view details)

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

zenroom-2.3.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (914.3 kB view details)

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

zenroom-2.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (846.0 kB view details)

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

zenroom-2.3.1-cp311-cp311-macosx_10_9_x86_64.whl (761.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.3.1-cp311-cp311-linux_armv7l.whl (854.8 kB view details)

Uploaded CPython 3.11

zenroom-2.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (903.5 kB view details)

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

zenroom-2.3.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (914.3 kB view details)

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

zenroom-2.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (846.0 kB view details)

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

zenroom-2.3.1-cp310-cp310-macosx_10_9_x86_64.whl (761.2 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.3.1-cp310-cp310-linux_armv7l.whl (854.8 kB view details)

Uploaded CPython 3.10

zenroom-2.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (903.5 kB view details)

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

zenroom-2.3.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (914.3 kB view details)

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

zenroom-2.3.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (846.0 kB view details)

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

zenroom-2.3.1-cp39-cp39-macosx_10_9_x86_64.whl (761.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.3.1-cp39-cp39-linux_armv7l.whl (854.8 kB view details)

Uploaded CPython 3.9

zenroom-2.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (903.5 kB view details)

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

zenroom-2.3.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (914.3 kB view details)

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

zenroom-2.3.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (846.0 kB view details)

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

zenroom-2.3.1-cp38-cp38-macosx_10_9_x86_64.whl (761.2 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.3.1-cp38-cp38-linux_armv7l.whl (854.5 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.3.1.tar.gz
Algorithm Hash digest
SHA256 ea7ab2e9a859a1d7650088e5e2850383f05d70d44866f0a10c8c56199fe4f2e6
MD5 ed5875074fcabec2ee246bd7aca4fdc3
BLAKE2b-256 3cbf11b34ea9f6afefa792aaabdb43356ff41b9123426f4d4970fcdecc64ed9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 fb5791689999ec025241d90fd1fad76f5027eaaf5c4d880e8d3506fde35a355a
MD5 721615549500a99d5ce6ea4ccea373f5
BLAKE2b-256 dbdab65a0af1006da07bf65f3db61b7f3ead4bdac748ca10ceb368affd425756

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3c0c9681f26d9059293f3bf6764dc5d3f3932e4e0c6bef45a261a15104988f83
MD5 bb97fd1009c22edb3c1c6324d857680f
BLAKE2b-256 fcad72309cf048f331561bb0f3e833edf9870c033f7a1a268c6b0a7efaa61b53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 759f2f8806fb8124339ae5dfaf21cc553eb1076f990b819b98fa436a0a903435
MD5 5853fd7a9bae620eb6022dd43254fb13
BLAKE2b-256 5b2c1c9ae4f8432d928a47ff764ba8deabbb7add964dfaa93c2d2037164e293b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 23adbb343cc8c10e0fcec4b25b604102d0305d7bfc0c5bccbdf9608e74545f79
MD5 2b23ece04a82c0d7dacee960a8e356db
BLAKE2b-256 5007e0321f29d1ce0dee25b7951d9f7d02ef85abc8ddc67d4a38d47215ecf18d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 f2b6426ad6a3400d367238c9717529bd60332a43b6f10a34f2f86aeecefc6f4c
MD5 39e10a2e8b9e21d5a2cffd1734ebc39f
BLAKE2b-256 14c40bfc000fa6319b6b20188b06c2792079d29b5ddb79a2f4c2b13e764dd669

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b20209c10fbd9a4721643cc06893acb15a082cfd9c659b08f0e20c1168fbbe35
MD5 56d3dabd4f9ba26a85dc310d82a15fee
BLAKE2b-256 df79e19c29449fcf1291715fdc8bac05bd1c21f05cca39601fafc851b795cc90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e06c114b029b7362d12ee53fd5f4784a3def491bde84d1f0856691a5c9a0b914
MD5 f7835a4c5095f5bdabb6dad50d5d383c
BLAKE2b-256 e5f8810fa36d26a962f92c84192411be4cd79c02a96eee5f1bae7d39b6312e1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 21d4095624e6f20f5c65b9c427d6d15aea3610adea4e8eb2ba702572012dd3cb
MD5 035a94ffd6a18d9e867ff6c05361b2dd
BLAKE2b-256 ab67f37ae6300b600dfe8b986801f64c77765e7e81b10dc4894b64f6790038c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 190e25a90c2d43b1d6482f984b43beb98a1baf1268f54a7ccc2540616fd7c30a
MD5 6fa90024dba0f5422eaddb601ec154e4
BLAKE2b-256 5d6a31abe7ed556923bb590be2c86e25ceee1c71375faee33d4764123891be2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 29fb9baddb6addc11f0b8a99c0caa9b36a4549332dae38244c1655b473ea8dc1
MD5 e82eba98bf0077eaf35fa9073dc66235
BLAKE2b-256 8e4f6e6ff479d75330efa1ec7171ab6620bcc9b0cd65486f6dd7f481f91a9b01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 db2a29a10adf8831b00795a0e1025c4dd7a2b28d60fcb851f59d8f63630d2156
MD5 3c57bc535b30bf2d33de0761fb1b1be3
BLAKE2b-256 b1420062ee8829850f9fddd81e0d1a867d7dd6629bf814790d97ac6afed82bde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d535df08b1684d3bd996c38032068f587ff9d552492b449caadbf1e045744ccd
MD5 236e2052c16cb8405af9d171f9ffa962
BLAKE2b-256 cc05b34239f061a565ae0134cb82bae7ef7d33241c70654d7f58ddbffe022b28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 a945378508a1d0740145b94211c157158ee0db60196b4bdb552e22420dad3ef2
MD5 098dc111cc1bc10e8b82415e735c9eaa
BLAKE2b-256 c044ef28995a8e111d0a43d27e5f0bdb7fa0c4e1fb1b74a705a4aa963d032cce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b62d8e2c6a624b65cfe3f607ba0716bcd5463d2c27fd7b37f3c6ab534a2fbedf
MD5 fda122bf25ea1c2cd8634f77fa44cf1e
BLAKE2b-256 2beb68cf257ed9c172cc1bcf33145fd5f8823500660ce1ef6244579cddbf3f02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 3793e753681c7f8b642b4cbcf136e901a84ce70e49b0fc6c9da2eb39384416bf
MD5 a0bb098b8507c5793dc50405e3eb198e
BLAKE2b-256 248d939e9f510a2185e651ac899b67dce2f6ba0fbe5b0ec0c07cf1e67bd8b704

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3c638a7aaf27ab880d6a7c49e5e044ca260dc9341d3b2208dda2550c1ef56d93
MD5 016a1fdfdcf483041343ffad219383be
BLAKE2b-256 b34d77cf7df60d0a5d684bea09240cb033d899bed97d5e1bf53abbbcb8c50cbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9b6670c31642928b620396948b409c77d4021646411e15c3cadd419270fac38f
MD5 c67aa836f6d228b580f3e2cd8e2a42eb
BLAKE2b-256 f5664df92d9cd20f84b2fb4b4676a2e400e529d6cd2458f76c8af2cf3c2a144f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d409d2db0b58998f3195b192c9660e9a7a3186ac3839c009454825daede3911e
MD5 dbad3924bf898fd1312a9ad9356a2991
BLAKE2b-256 3f36a6e9b22fbd6c8d20f8ef6946151cb5ef6bf1fb1372d498466ad05a58a83d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d3a079b74d9afa27e19d4b4603bdea71a418c3f1b7339e5e9509660302f4e4d6
MD5 daaebbec0a510e71d20c718f7433b01b
BLAKE2b-256 cab171506ac5b07ce8eed41627cd52d206a80396d04d04e51411fb7849e9c941

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.3.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 246286e24e3955e3c750430cb43831385e33de764dd6587ab0b0cfcd8a606ee2
MD5 e6384f27dc9eca13d984f07d396633a6
BLAKE2b-256 5d12b042af4454f6bb5426569a2e853a27718e34b63d4fa7e5c89943ab0cb224

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