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

Uploaded Source

Built Distributions

zenroom-3.11.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.9 kB view details)

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

zenroom-3.11.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.2-cp311-cp311-macosx_10_9_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.11.2-cp311-cp311-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.11

zenroom-3.11.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.9 kB view details)

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

zenroom-3.11.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.2-cp310-cp310-macosx_10_9_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.11.2-cp310-cp310-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.10

zenroom-3.11.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.8 kB view details)

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

zenroom-3.11.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.2-cp39-cp39-macosx_10_9_x86_64.whl (654.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.11.2-cp39-cp39-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.9

zenroom-3.11.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.8 kB view details)

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

zenroom-3.11.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.2-cp38-cp38-macosx_10_9_x86_64.whl (654.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.11.2-cp38-cp38-linux_armv7l.whl (775.9 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.11.2.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.11.2.tar.gz
Algorithm Hash digest
SHA256 db09b7f02e9d7120314f100fc7b9bcc6b344a8989be3ead04fddbbaee8dca6aa
MD5 50fadc6bd42c3de4feeb37fde4ea89aa
BLAKE2b-256 d4aaa129d281048f67f2b17578088ecb954154d5c8028a88a05794d3215eee0f

See more details on using hashes here.

File details

Details for the file zenroom-3.11.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.11.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 010fb6b25392b93f1ab6ca447962475aaaf18e7c456530063a9d5096b031ac95
MD5 786365edc45353e32beb58b6e7e7db44
BLAKE2b-256 4b3ab915bf9c372c83959ff5f4bf46b1d3bfe2a397033179b33d2383e06910ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a3d4a20e693e1af70c13cabe5674d7d54555c3f718dc40fae333168192cac534
MD5 7f039f5e27d7784a24eeeffabd8557d3
BLAKE2b-256 e5781082fa5d76b57ed987dc92d35cc173848fffd4f2da1c3574b28ccb40eff7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 acc8120d6f603d62a01c1862e05d865adc1b2eb9cd537f23a3abfc693a5774bb
MD5 befa32064f38d1fda869c6a53dd576fc
BLAKE2b-256 9154aa9aed1314931d1c88b364f74865d4707d67187e7b28d1160ffcd13a6ef9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 41718251b8809d29dd5ea71f6934c6293a14ab806393d507ac2d0c0c0acd1f7c
MD5 9697bb18a0aa973fff147ce983651411
BLAKE2b-256 c16b428b7bcfcfd352f1a3db0a513fe08cab0669d58e4de6f2ecbd6268d4601d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 fee6196e2ee8953420349458913b3171919556ed64413ba1ac9306ec61289442
MD5 f35abef240bd501f8e6b838962b1dda1
BLAKE2b-256 ba3b6c08d39286bb37a96a4eb6b9dde21331403744296ed5567d02d556e5acd7

See more details on using hashes here.

File details

Details for the file zenroom-3.11.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.11.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e056cb920290f1170c5553ce71bb02fc92d4565d77d5e179f11edc0222ee65f7
MD5 4af38f087934e5abc4108889a669cdac
BLAKE2b-256 c7adfaddb76f9fa2c6c899b1098ebf2d482f64ecc5e5b34bbf15de95dc54de7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a8d8a227d0b4667bc0e3180e4e8dd1d93e322b4ae8d9130ba8e3cb9d4564de44
MD5 7624da3d1b7ce209ac3e901638d4f506
BLAKE2b-256 680c9f40809725a3d86e4af5e849b183955f394074b0dd19fce7ca877c2fef6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bca6f9a134043a40f07ef6182b5afa70c3db4f8edeed6a0e1dd273f9c5b2f864
MD5 599489d34e186462735942d7a179e163
BLAKE2b-256 23467cb8ca90e8518f59a7875cd2997dfa80ab3134ede14ae65234058cb19b31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5cf146b7f5a480c30ba01f60fea61077017b875f283cc8a83d9bf84fc9085140
MD5 d956436d6e24f95799f712643663f8f7
BLAKE2b-256 f7805be1459f8ada7f495add89c897f848f5d9a057568ddb75d76c4c74a7cb30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 6ca7d55f07f69891c68a5157e4eb5edabac63fbce5e2edf556372cf5276c2b34
MD5 d8dab814c1c8bf79268baeb093ff62d7
BLAKE2b-256 66c16fda5be4045b79783bbc9ddc953d55a7564af1786160d43796d2aeb6f803

See more details on using hashes here.

File details

Details for the file zenroom-3.11.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.11.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7bde1809ec91308b849e83fef41117ffb445eaf45693803f3d0f020599b5682a
MD5 8a64b06ff648bd5753b67325bbd659c7
BLAKE2b-256 8436ea3988ab182247651e13934055c3baecf2925b3df062fd041ee1fad610eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5d0be3ee7035f785aa28d991735d448408ee20110100c284f1e218329fa857e2
MD5 c6b9b3a05e0d84f0d7ed9400a3e4f4ef
BLAKE2b-256 ef727342924cae88768dd0dbab77d346cc98d2e89921e91c17e52679da8d137c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 5d70354b568fb1f6c2647736e8852f2f9c598fe95df7207e1b109026958eb82d
MD5 0c20da65d2798fd948aa56e6d039c7ab
BLAKE2b-256 418d401287e0d09152d15ea4e362f4335572e505d567c7f121baa6fc1a283eaa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f20f5a361fcd6543975251ea75942e9486d3c4a69eaa16db250a1354382a0212
MD5 cc063aec1b7c31960b8b7769da47db30
BLAKE2b-256 8c13ee30a0458da07b61538552241c6e07bc6ff04c28ebba87799f02c08fb577

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 a698603f5e3504fa6ae38c22175d86df2b509de0008c3a075e99c8fac757c49f
MD5 c406a8fd3372ff36e5885a44189176cd
BLAKE2b-256 ff9b3adbbfca4d03ce234270c1aa2fe3c2e543becaf23a1b266ec64ffa13cf00

See more details on using hashes here.

File details

Details for the file zenroom-3.11.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.11.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 ba6f4106cfd4184d393a24a562ee8f77ceaa6a19e861e49ce28491aea12bd859
MD5 62165e7d9826f5f7aba98486609bca1e
BLAKE2b-256 a368923efbd3a2b68bdbc93312f0315d540c08fb2a30450de11f9d4b613c45a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 635ebe4adbeeb527491bd12c1ea9ac896e707bbbe19b0b1c39dbbc65a5c17475
MD5 1fc1540e21e2eccee0d7e10966e9d4a5
BLAKE2b-256 bd54a7b2f7ec8565d98ac8e6eb16581ccbffab28b9b824eee05243a8cee583cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 400251f6a8e852f56c0e5a6a6acec5dac7906c6d7435d5d746b6997908fc8f09
MD5 91a53eeb104f046e59f9870ff6f9a732
BLAKE2b-256 b613fc08dce32a70f1e1ac165c984c05da70becc8f3b136b5b1cdcbe7bbc1492

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 30c12f449bc92e7701f7065fc8d400c98b1d02b5e13e9686071da959325552d9
MD5 ddd61529d87f82aa6d4ac04aee8d32bd
BLAKE2b-256 91bd4238507bccde243faa9e344dfee188898332eaa6061d8ce7b6937ae68d0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.2-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 a7a8d0d0f90ebb292945089de1cc8b9c3cce9b7cdee1cfde7665220124662ad0
MD5 81876c670b5eb0a8c27a0c2ea3bd3553
BLAKE2b-256 21ee61d79c44a946c95fb6ca339febdddd36a440f5c10d250b24e2b3424596eb

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