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

Uploaded Source

Built Distributions

zenroom-3.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (797.3 kB view details)

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

zenroom-3.13.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (807.6 kB view details)

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

zenroom-3.13.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.8 kB view details)

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

zenroom-3.13.0-cp311-cp311-macosx_10_9_x86_64.whl (661.5 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.13.0-cp311-cp311-linux_armv7l.whl (785.4 kB view details)

Uploaded CPython 3.11

zenroom-3.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (797.3 kB view details)

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

zenroom-3.13.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (807.6 kB view details)

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

zenroom-3.13.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.8 kB view details)

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

zenroom-3.13.0-cp310-cp310-macosx_10_9_x86_64.whl (661.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.13.0-cp310-cp310-linux_armv7l.whl (785.4 kB view details)

Uploaded CPython 3.10

zenroom-3.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (797.3 kB view details)

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

zenroom-3.13.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (807.6 kB view details)

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

zenroom-3.13.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.7 kB view details)

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

zenroom-3.13.0-cp39-cp39-macosx_10_9_x86_64.whl (661.5 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.13.0-cp39-cp39-linux_armv7l.whl (785.4 kB view details)

Uploaded CPython 3.9

zenroom-3.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (797.3 kB view details)

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

zenroom-3.13.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (807.6 kB view details)

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

zenroom-3.13.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.7 kB view details)

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

zenroom-3.13.0-cp38-cp38-macosx_10_9_x86_64.whl (661.5 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.13.0-cp38-cp38-linux_armv7l.whl (785.2 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.13.0.tar.gz
Algorithm Hash digest
SHA256 13ece806d4a0c036ff5b4e6d11f902ce1a5e8d117a64dacd6ce4227697b093c6
MD5 f687e7dd585807a4c5f6c3df142d9a86
BLAKE2b-256 84359ac8fde40ead9185144f03586425f72a8fcd43ee20163c34587c4e7b633e

See more details on using hashes here.

File details

Details for the file zenroom-3.13.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.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e3f144d9a8d5815c53ea10d3031a04cc465e5b2f823bc38d164eb79f37c44998
MD5 f35e03e997519ae0276446996b1e333d
BLAKE2b-256 3a618b48512bc880c3e82acc5e2ae2104e477fb6f4a8f5e6cd3d4c22180961e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 37017838731affddd7931e0027753a30f3069b3553987e5460790beb99a0cba9
MD5 a6e25cc255d70a29d41c874b68601b17
BLAKE2b-256 e13aa1ae302607b478178c2606f47e9aa10cdc07067b7cdc6b5b254da419cfc8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 b60d612802a151d2e4e13db4225028c1754e80ffa8deff013893c77d56d7b7d7
MD5 0c5bec3255b8c8f9d3ee873306202f1a
BLAKE2b-256 ca51c4ed591b7d6eb5a62d9cad52166ad3ad7c3b872784c06a6d17240f866eb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1c0d95618231177e15868b78199edcd29bdf5e9eb54292f5def27d19158a81fe
MD5 5dabed2db9a9004d909f6099af7ec790
BLAKE2b-256 0542e82136e83b7b1a9c4b43644f4a760ca3183611d2f12ad676c94feb56993f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 a90568f99ddc8b22980115245a1d6a90874098468a1682c1afcd9cdc219fe50a
MD5 7359bcfa886a11b14924f2b00d47e908
BLAKE2b-256 b29ff429894a3027ce2039e5d3a034a3fcf3c6de836b9bf5557d13d7047d0dff

See more details on using hashes here.

File details

Details for the file zenroom-3.13.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.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 a339c2848afa2a2754be7aca932a95e10a3bc49f23153531c133f84a13d2608d
MD5 a2afba0cb9f7508ff2fc720f2dc6f789
BLAKE2b-256 735398cf3714c45c17e83c0b30ae05e7f19275e216ffe1a5b24998c52d9ed3cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ebce3a12c067b60f2692d612dcb7a5f07e09e5336e2a313e94fdcc1d4505310e
MD5 1215532b2056a5b296f20c0f4da9481c
BLAKE2b-256 c2c958b5647bc5042c5dab001b2c33c9aba688424c24e16e29816c8dc1d9ab4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 ca9c6db76a7df729168ce80399252fffca2514e681e738e34311c3421f5bb8fd
MD5 2a39bb82b6272b0d56610f499271246e
BLAKE2b-256 43afce593153a73e7c1c9db1f3f1887c489ce0ef507bb46a2e7012ecb4829c2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 27de1c154791e88ad519a0a9d107ed42b9cce2dade8266157771534998a39acc
MD5 32717844b3a46c81a7d70a9135fa0eeb
BLAKE2b-256 47cb18388f0e3bd8fedef6c3f88a27cb02b0b6e4540c415e1075894854b334aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 8d58aaba484a6e1aabff779c9c4abe5fd523facaf24e3bc8859c86da0744f8e9
MD5 3f506494cfef41c245cf83eba5a40793
BLAKE2b-256 b9dfe86fb664b76bd1ec0effa1ce690b3b55ab2fd3305a8bac1f1556192fd642

See more details on using hashes here.

File details

Details for the file zenroom-3.13.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.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 280842fa3ccc523070a95854da867dbb7d8a0014093dec4e4a81b8bf2e42b45e
MD5 f6b3e8ca1b8c799a1511a28a31a62007
BLAKE2b-256 03f13c7947bbc5cd80a36c0162b234b5c67f173ff39d922374c2f46334851ee5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ce377cfceeffa67908573d8eb4e2d72e62f7ef13227c0e9a4f0942e1f006a0fa
MD5 9ba04e89b6aebc7a42aaef4d7fe95fa8
BLAKE2b-256 675234eea80259df5c8b5292872032da6425173ab8209778829669600d9e7e59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 01a795da64c59929830ec2e3ae93d88eeda65d6d00358555a6faf80035e228e7
MD5 3b5424c42385c7195b11706782df30a0
BLAKE2b-256 abaf055a7c7b1edd50c1ce65e828458608a7f7298adbc908d7cbd7daf3afad49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0bea8196610a2a26e90b79f097c4e6e7e0c81d988ff38f44c08599e8dbe305fb
MD5 336914a415d522af64e2474186b243cc
BLAKE2b-256 dc3831fa725d13c0fd079660c44e2edc65efede2d35a9d39eefe975d19b2fd3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 1b8ec4002f93fb8417861b319683e632c64bfba01fbedc32b08293d31b733893
MD5 a1a573bc90e07413db11a05b8923dc23
BLAKE2b-256 890c3f903d87435ba8f71d211ffd62b81ca276d405b19a3d777a6bef3f1be2d4

See more details on using hashes here.

File details

Details for the file zenroom-3.13.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.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e7c925bca3b99b16696bef37fb7591469b8185f0afe3ce27a1ad8238f8d6adac
MD5 96885681d681f6a8dc59233b8559c58c
BLAKE2b-256 982c221a877af85dc8ba3636a87e64e3a3deec02c48dc9bcafb6b902523d52e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d476f267f42cc9a8c83116deb05f4244bfa7d4c39e11135136959a8d632b78d9
MD5 9c5f39aaa0d296463feedcd54f1e4b54
BLAKE2b-256 088f75c4a872aaebf6f5097e8ad18b4060c717770c1f98a238d0c10fd62db05e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 ce31ee984a7230e2fd03f856f790e41f8c820fcdb9a7c792a5854e1e8beebd71
MD5 00e3989e7120fca4ba106cc1f2f6f0de
BLAKE2b-256 16b1d8904e2638b0a107a4c4a1070cb425863e62853c93152626f5dd50a56042

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ef45bce5b03f971e1731940347dee5e60a04e0277e53847f26eab2ad42ff39b4
MD5 56c9c1e59e29437a6696eef6a485dd59
BLAKE2b-256 428dab1909a0f4bc6772229797b6e3f8b0c52c3adb120d5bd90af0d5b58f7d70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 414ac13b35becc0d9ef01ccea3becaea5b1765c6212f9c5c32f4ea8a5286e5b4
MD5 8c4657b4a31eb3d492599af2b535c717
BLAKE2b-256 473af1e5592cb0bdfa8f4c6c27a347171ef76ed02f48cfb6f0ff0201b5c14ec9

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