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

Uploaded Source

Built Distributions

zenroom-3.10.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.9 kB view details)

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

zenroom-3.10.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (797.0 kB view details)

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

zenroom-3.10.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.4 kB view details)

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

zenroom-3.10.2-cp311-cp311-macosx_10_9_x86_64.whl (654.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.10.2-cp311-cp311-linux_armv7l.whl (776.9 kB view details)

Uploaded CPython 3.11

zenroom-3.10.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.9 kB view details)

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

zenroom-3.10.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (797.0 kB view details)

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

zenroom-3.10.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.4 kB view details)

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

zenroom-3.10.2-cp310-cp310-macosx_10_9_x86_64.whl (654.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.10.2-cp310-cp310-linux_armv7l.whl (776.9 kB view details)

Uploaded CPython 3.10

zenroom-3.10.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.9 kB view details)

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

zenroom-3.10.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (797.0 kB view details)

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

zenroom-3.10.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.4 kB view details)

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

zenroom-3.10.2-cp39-cp39-macosx_10_9_x86_64.whl (654.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.10.2-cp39-cp39-linux_armv7l.whl (776.9 kB view details)

Uploaded CPython 3.9

zenroom-3.10.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.9 kB view details)

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

zenroom-3.10.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (797.0 kB view details)

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

zenroom-3.10.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.4 kB view details)

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

zenroom-3.10.2-cp38-cp38-macosx_10_9_x86_64.whl (654.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.10.2-cp38-cp38-linux_armv7l.whl (776.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.10.2.tar.gz
Algorithm Hash digest
SHA256 9f2e3f5d592a97b07a44f7b1acae24d1880e67ddf4c2a3b130bc197bee43ba8e
MD5 67b67f74f1e1afd65d859dccf186ba13
BLAKE2b-256 7b51e445b17fbc2a0f42152cca7be1a34baa419a04f326d344e4963043f5eb10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e43a62de0ded78ffddcba1aa05f0d85b61f7b2178a93a84cbbb8ee6841f0b9fb
MD5 a3b02d56729b745449f9d5a5aa5c704c
BLAKE2b-256 b25ac3fd2cbd31beb4caab0788de5afe8db4066ff8cf3faf42962c8b5d605e49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 447fff857582e9c5d5e71327b2830fa2b50a73f4962bd7927d990a4b096ea7b7
MD5 afd225598bf8b9cc4d522d780f31ba9e
BLAKE2b-256 be5d8b910746be149947268bd4077c39c5edc52a722ad452096a1526c24cbbb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 62b068976cd822a428968089bafadc3da69341e18ab42e0e9b55412470f4220f
MD5 f985e95e62adc8bde24ec00d2229374e
BLAKE2b-256 001bd17b3c097b0ccb240b558ad13ec711493f404831b7c2c9936f585007990b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9efc66660577f4a9ad52089ac0b539ca4bb1c1e8fca564d8c893a201a3cf5309
MD5 fd8a843f888ed463455e2b70122c64ad
BLAKE2b-256 0dc1dc90b89c2147bc3b795737bb89224eb11c6f6b01b5da5f6613bd8e6acd94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 be4c20fbbf40fa309a1f22859eb831c0c3c16653356a233f65dbffb7780082dd
MD5 c9375986e5cc5ce7bd2743223f01f2f5
BLAKE2b-256 058907ae341d59fdad58ec59084608ddbf8ae226a76972e4cb6da73265232500

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 39564f40cdf1e1d234f9db052177450dad395331e0a11acca56ac4e5414c029f
MD5 524f0d8652d3f7b209cd0dc3eb329c2a
BLAKE2b-256 b49aaf9a1cab311ee24ef775683c2641601ab5d11d479fec87152f4aafffedcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 86ccde34a6c2b4376ea14fa07e6b680baa7096670eb2bf5bb4790add0eb0ec27
MD5 8c2d9a662407b73e4336f60be7a0cecb
BLAKE2b-256 2bc311c201f2bcc0500adac9305e832a1ccd4b8de0be65177915eef78d6e2d27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 777f5e8c1ab57f06aba2e926c9801e6727d07d2a4c3d844026a506236901673c
MD5 0ded69791a8f90049d093f086f270100
BLAKE2b-256 71054899bfd2e10b9edb4fe70bd2ac7353254a1df6b5e9c5927890bd435ed7b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f974919e2320e6c4eedb6b7996d233f45f69720b09bef4a9c057cef408eb7c5e
MD5 9de57a60df6a126710d3768f176fee70
BLAKE2b-256 3bc39048704d6da1feda9bcf2446fcab1ed464be1d9dcf305234aec33d4a2655

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 bcd32f45c00158404265d6355da8e26b9a2864e8f6df5598051c9191003a9e45
MD5 33daaaf4515e76b203c191f31d91b843
BLAKE2b-256 f6d83357fed4ab9dd6b067b2b89358a33d83f3d128a98dee2e8f668b5694ec34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d08791b0688e6b74a050292fd1bc33558ebee59c80c0ee8055dc77bb1457ec92
MD5 766777e28beea84526e2bd7cacb72589
BLAKE2b-256 7a96c84d4f4b93d5eeffe96c095bba0c767b08d9a7a0016c4421a5280e4906c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 36cc6721f6c4c08cd7dc3ba5ece1ee8dcb0b08140526aec1ce4fbb53bde0bfbf
MD5 aaf864a3906cbdefd63b768bb72eb59b
BLAKE2b-256 e3cc487b7da1cbbae83f478e1d094f4eb4109dd531c0f2f9e821eb75abd7dd2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 36a9bedf1d4ce615aa6cf9a6a73685d7e66dd3a39730ad9876e0c2e826251aab
MD5 e5f2adf494e15403c556c42aff27afe8
BLAKE2b-256 ed14a762b4ed5fc65ee6590d6876f681baaf99b0d80282a87af8457858d886de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a3d4e22e068cfafc571e9b2cbc7cadff8a9d205d8a8de8d9db15df98911b236b
MD5 1a838d6a1049e8309256fa6fda6f5f88
BLAKE2b-256 78021233c8367e44ef78b3c0eb9b3060181af784e6af5afd879679a1b60ccecf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 000b5a584928dd08f9c9b0e2ff66a3986faf7abcd831e61c64520ab0a4fa9a56
MD5 ef67f6dc5eb96afd5797888d43aa93ac
BLAKE2b-256 ec15c6d0aee6a6c23dee79101cae6ef47356e88d718a888aee5891b1c5389a18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 94cbf6289c17cf1472dbf0d708c7a848d5e7dfb4ddd133e906d8437f14248e5a
MD5 0ac4794be08fba1c610e40eb51168df6
BLAKE2b-256 678fa781a25b573c33e3dd891bccab3ba1ec6e8ac3eed2dd6c041c9674f09e74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 22501d43eef62b62d03ebda3d5d400fb07c8ef671f3f9978166d5a332cd5ef08
MD5 215af6d066695e8a6a3bc649a398fa15
BLAKE2b-256 03c6726c85f369f6515c4e18c9bf1bec96c70a128b71c5ea1691b26b10e38e9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 94cd0313b7ee103bd5764ca653fde78cb8c8dd2eef7df746047d604c0048e76d
MD5 04fe4b406424080e5507a71732b739d9
BLAKE2b-256 a1d3a93b9bbb3cacb0fb9dffc2d2738a2f59a262f39ffa13ad70da8d4deb8598

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4cca70f9f9a365106e6abccd887efb126d858797eef48b254317b37da3e98027
MD5 3bed98854c390c603ad8f7a4d8d3b646
BLAKE2b-256 01017589afbdf82b3013200ab3188c4283ce9a4327bdbe73828fcfb4a441fcd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.2-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 69d2649681dc3d6257b3f220f4cc898dbc3b7a9961d4b4b37833e11b0bcf5c5c
MD5 a86263a3fc149000081dc55c7f210363
BLAKE2b-256 03e55bafc67814a9788586b12e43d8887fa6ac86c3811b148b0aaca6fc99d217

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