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

Uploaded Source

Built Distributions

zenroom-2.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (917.1 kB view details)

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

zenroom-2.16.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.7 kB view details)

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

zenroom-2.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.7 kB view details)

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

zenroom-2.16.0-cp311-cp311-macosx_10_9_x86_64.whl (779.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.16.0-cp311-cp311-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.11

zenroom-2.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (917.1 kB view details)

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

zenroom-2.16.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.7 kB view details)

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

zenroom-2.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.7 kB view details)

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

zenroom-2.16.0-cp310-cp310-macosx_10_9_x86_64.whl (779.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.16.0-cp310-cp310-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.10

zenroom-2.16.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (917.1 kB view details)

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

zenroom-2.16.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.7 kB view details)

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

zenroom-2.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.7 kB view details)

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

zenroom-2.16.0-cp39-cp39-macosx_10_9_x86_64.whl (779.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.16.0-cp39-cp39-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.9

zenroom-2.16.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (917.1 kB view details)

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

zenroom-2.16.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.7 kB view details)

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

zenroom-2.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.7 kB view details)

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

zenroom-2.16.0-cp38-cp38-macosx_10_9_x86_64.whl (779.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.16.0-cp38-cp38-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.16.0.tar.gz
Algorithm Hash digest
SHA256 d725cce37be282024f158b7a9e0dd87d86bccb5de6393e50dda63db2eb7b63b6
MD5 6836b3068ca0098bc425a0fb6a94dbea
BLAKE2b-256 5f6408a713b7cd1a1957385b033e3660822da0aece61aa3abf2dab68f126c83a

See more details on using hashes here.

File details

Details for the file zenroom-2.16.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.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0784457c170cc65d2644cd405d8af8e5283963cc0ac0e3be1d54a02fbd452ded
MD5 0024835bd10e832a76ca119db8c532c3
BLAKE2b-256 41481cb80332355d6c55a9aaaff55aaf52833ff43a918de7888b1407050071be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 88bcd72148e2ea65c74d8967272723abc541b25e8adec6912011039007aa3c15
MD5 966646b835bfa9a52ca39c9fe8349763
BLAKE2b-256 21e0ac9421193b21d0e734d16d3b3d642d91df1570464007048e31286b567b27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 59c2e99175fe14e7921431bd7e39852283001ed4d88bb6c11d4e793a956b92c6
MD5 d3a9ecef59847744c514727d51c40d85
BLAKE2b-256 79a4a51bea1c4c1cfdd0becfb5b99d87b5f2554d07f43970bc2ae51fa0d7f363

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3c9dcd9aad2d4f6c1056a6fb8d49b3b0ee009bb08adc7fb7a36e2cc507a14ac0
MD5 ecc13dac234045b6c47890e55bf17c1b
BLAKE2b-256 e3c7784f9fa79b78fb114239b26a22c85c28bacdbddca1ccbc6ad1521d00f576

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 f3fe0d5a51212a9c42822ee2e7a44788a15248630c340183de85e480366a9e15
MD5 a869268ade15a25c275cceead9820467
BLAKE2b-256 c2fd7a91ed294e454a6c491e7bc4ba91b2286d70ff9b250473e588e3968115d4

See more details on using hashes here.

File details

Details for the file zenroom-2.16.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.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 de843406e60280e8a1ea1e532accd2397df32e6d27f251be473435be45893968
MD5 dca0ad29db9d8a8ad5a2624fa687716c
BLAKE2b-256 ce5bc7dfa7ee30464c729d42b06a78e563d8c39f30111122b8be08773fa990c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9b196928a20a889c68dbdf9c6517241b142305b25e74fd65f73bd8d01863a225
MD5 ca663030eeeb58c8e9a30053fbce0d9d
BLAKE2b-256 9ccbce1efdffbde296f3ebfc2540fc300c63f19bccc23199837d48124e217146

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d35b74c6d803014d8ec7f70f1d34a3fd456b20191769eb112a479b7a73b74f20
MD5 13760bc3d9cde6a8a66333745286a35c
BLAKE2b-256 664784a3f2064abc0564234b2ee3143836fcd7864d85505667732fbcd067fbbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 97d3b5604685d1d98841b58d11038d17b0c982f378e0821ac40afe615484adf2
MD5 9def1ba060e5e16340e49ff3bd4af077
BLAKE2b-256 cb18945ddd6ac7f150092aa485a95b1db02630f0de7b4d9e68a2dc67b3b44b20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 7eab12a6cd6b6e7c55a891624ed103ca307eeaa9fc85732a5b478eb4c443e56c
MD5 54cad39b56a8e9c49657b6771d610d2f
BLAKE2b-256 012d7686860c264f9fec685d6793069bcea0ebe3fa9f62921957715da66a8cb6

See more details on using hashes here.

File details

Details for the file zenroom-2.16.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.16.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 18304a4fa83148dd63a6f4bea6ffd784961f3a848e41a565bc7b9f55829dc663
MD5 3fff04418f2cf4410a89c4891cf68606
BLAKE2b-256 553bdce3f08c20551d1dd311ee4397764b1f166b153099ce201b22055427fa54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 90f8654879640d9c8fbd31de7079b898ca4a7e191da050d044714bf9770a1995
MD5 2eafc6d22ac5fb5bf7d19ce68cdcc7b4
BLAKE2b-256 cbc5f6b73a0bf27a127ae7e3c82033a5ce2aab830abe39f6977cfb1701eb4d5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 4e11f2d8116cbf00c747a91667ae7931c834264e84e34fc9aba031ba0bddf2f7
MD5 d081a44d7b317705395020f3fab60773
BLAKE2b-256 12fd80afcd40a99e72c027d59421eb27bae611f3007691a4213b47a3a38c4544

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 22a04814ff0128503292e653efe24dbed43177735a25053ba00aa18d54d4b22a
MD5 b6ba88119d954da4f45bccbbf6e87d06
BLAKE2b-256 ca6a4d721d2d568ee8188fa3cde6dd0189b6500c31f73f14e10566897d640c12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 a929926918b55e5867c20d6263e8feb9c3ceb22f92ee7361ff86dab335117ee1
MD5 bce3179267c2f133ec5621f1d8de501f
BLAKE2b-256 1358ea370767cefae50afb64eee988db218aa39ba56af9f45bd377a141c19c00

See more details on using hashes here.

File details

Details for the file zenroom-2.16.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.16.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3180ca4de404ad4282050e8a92de14e30bd227e4534ceadd9fc8fd7425d24550
MD5 7fff356d9efa4cda3303be62d36c468c
BLAKE2b-256 2e0c8db88a51725cf68c121c844cfe00fe8e91af298ca709b7c45e4adba8ebcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 eb882514a257e1f51379e2d924cd0f862d38a4e5b8704e2a24a6b4ec4b94646f
MD5 b756a272a58dc255b935bfca20e623a2
BLAKE2b-256 9f495c8c16cac139c8a4b72b77225f62a6f20ab760a0c90c67239c1d09f19f90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 6b766b93fdb78ce62d60e079e828768ce971a7533d6b9eb2f030d68afd520c99
MD5 04dfe74475986255b057daae7e3b30c4
BLAKE2b-256 f6cafc0563cc5c708ec56b8cd5c94d890f3cb0b4a548df4ef9da71b3d252ff76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 88658ba461efc3409c44d6681d03f55f497b3c7b67d63f244317116de679ded0
MD5 b6e0889f28d669de6fb8d7f2a8febf0b
BLAKE2b-256 30bfff5aebd77f3b6400869a297928a3cb52a17fc7e51df9accbdef0037be00f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 dc6f2af966ed13d3ff0935efa5e09ded3f74448581fbf35fd24aa0816d5eaf3c
MD5 5508abc4e49054e5fe058306602bc5eb
BLAKE2b-256 b4a09ffaa7c8ff92b2fe89a270f1da38a4c1662eb09c0f2ba9d93f890350cb86

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