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

Uploaded Source

Built Distributions

zenroom-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.0 kB view details)

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

zenroom-3.0.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.5 kB view details)

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

zenroom-3.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (738.3 kB view details)

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

zenroom-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl (647.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.0.1-cp311-cp311-linux_armv7l.whl (766.3 kB view details)

Uploaded CPython 3.11

zenroom-3.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.0 kB view details)

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

zenroom-3.0.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.5 kB view details)

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

zenroom-3.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (738.3 kB view details)

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

zenroom-3.0.1-cp310-cp310-macosx_10_9_x86_64.whl (647.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.0.1-cp310-cp310-linux_armv7l.whl (766.3 kB view details)

Uploaded CPython 3.10

zenroom-3.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.0 kB view details)

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

zenroom-3.0.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.5 kB view details)

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

zenroom-3.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (738.3 kB view details)

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

zenroom-3.0.1-cp39-cp39-macosx_10_9_x86_64.whl (647.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.0.1-cp39-cp39-linux_armv7l.whl (766.3 kB view details)

Uploaded CPython 3.9

zenroom-3.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.0 kB view details)

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

zenroom-3.0.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.5 kB view details)

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

zenroom-3.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (738.3 kB view details)

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

zenroom-3.0.1-cp38-cp38-macosx_10_9_x86_64.whl (647.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.0.1-cp38-cp38-linux_armv7l.whl (765.8 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.0.1.tar.gz
Algorithm Hash digest
SHA256 13d9abadee2d3f171a357b93c1e83d4e451aa6da1bf415039c339897a43b3dc5
MD5 83e8ff6f614251692cc835a460263459
BLAKE2b-256 30c3d880c3ea112691c27e87bdf12f702a6e073702895c4608e6dbd5efbbb58e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e69eed4f55ce4daeebd8f179001a7e251769139f9af0cc6ca906225a33d7dd07
MD5 8b440810955e6aa823c4af7ff7ea38e0
BLAKE2b-256 4e08192d567ac7993cdb8ef2e18ffda9fbc886a5a1140d02f787d7fa2ecfb53a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 47351155eb80aa6ace7919ffb235eb74128b7095c81fdb2e674a05695113ae1d
MD5 400deba6f74ed1416d979a8eaf308cd0
BLAKE2b-256 113589df804f09c8fd9e41b4b2c413567d4f17fbf56c7df6e2db7531dd50205b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 493b4bc5c31a6d393f4bab2fb2ccd4ab499f4f6edff8077c5bed97c89c5e7979
MD5 b0ff923efcafa785d078e99144f8be8e
BLAKE2b-256 963226e3dd63b94772a04f5b8064f1c284deb6e5cbae1132cbf3fb52c8eebcff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fba7a5263591987e3196438a78cc23064e16a809d5a5b000d0fe1f768cccdfa8
MD5 1baf22da8149486b0ab573213d9995e0
BLAKE2b-256 370af867ade4293199c2f0f72792c6358c81bffaca7551b128483a6eeb29961d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 1eedbe538d2726fffe5bd4798102838ad87e0855c321e6b98b4ff365822bc0b3
MD5 057673722c8109ce83f696688402b44a
BLAKE2b-256 f161c61c9807ce3ccd125f61225df65840c2ab262c5a2ceb87f20d264445513f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9234abd3089e62081e908a9f576623ac6aa028f5a39b297af4e1ebcc6f272c28
MD5 f6e853ea19451acc6a8d8955a913b9dd
BLAKE2b-256 109a5ee45d1cb4a042ad5aaa4ec5c7ccdf4a78e4ad2c6bedbf68ef842e53ba9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3b3663aeb4ebf8a1b77332418968d20737b104a2a694aaf320a39b7e97b4fb4d
MD5 96f6877da9b76d99e3974e2a2a876ae8
BLAKE2b-256 a4bbd34382291687dfa728e2a302f5f3b7a4c6348adfd273a2fb74e8a012918d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 17b3068177298effafe7e0ab30d646f1d2403e8de206ac688210565488f57475
MD5 2f279247c69276f1155917df11b58c00
BLAKE2b-256 c58838b51c1bb6ef2f0e2b5372f5363f0bb69bf0b92c6c86fbb3127259a2e433

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ed39924acd99f9a1c67ae07702765c43755f8792c89b5a068aec6fde982c1922
MD5 dca59ae808fd75d5bb9c30a8ba371990
BLAKE2b-256 de284a166d4fda87f98973b099de51b3ad1586067332a197c44eb8558fa694eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 6c5d834cc05e6e84dc7c1e49d659c622a65e689d6d44e2f9898142c49cf387f8
MD5 f2e5cff025d1873611985d9aada15832
BLAKE2b-256 866a84d6f9fde611078886f98f11367eb92be02eca5647676ae3f02e292201f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 426dce5e4519de7ad3b26b49a54d5a52f42e7f50cd9b0e79d215052912fb5560
MD5 59d199708609f1c494c0ed036955d78d
BLAKE2b-256 11c4b7be4334df89a18de730ed59bbc1d781a54f1eed31f0db373d9440401c87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f0518cad14fc4d5113629840a1b849d519d5f81acca7ce8eeecc5520e50da603
MD5 207849f25201977c732c3798865f7872
BLAKE2b-256 8556ab06bd525d26b8555bc591b2c08ba85415dca1623e6b11a9d5a0f5e6b995

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 881f1567c0040c92702486163c5aa2ff55574f5a14511e98c82394096187d9f2
MD5 7c3e79eb2dc004e7a8b7b0f80b9c2783
BLAKE2b-256 8c5ad8f823d7363d1f703c2e04eb417ec0d5525db0e75578f2e0faba85f8dcea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1ea56069bdc70d3fa9c5b52b1c00d3936328bff6b3ad1c31b992a84a7df1e333
MD5 5bfd4eba76930bc034003800d221cda0
BLAKE2b-256 e60cd09ea213115aebf4380c00f5f735bb5a46a80738050a61a0303c24a7077d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 75a0509b57f6651cedb9a3d74f4ef3a09ed757737c6d1f7dea1fdad894b9131e
MD5 8da2c6613bc0325b5c46121e7da56b50
BLAKE2b-256 2872e8f1abc064085e2aaf1e41c9f0ccc8404c9397f52b846bad6714eac8c876

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e080706a026fe0bef0ca675bed39a517e54bcad9847162ee9148774b403a6ca0
MD5 06a3832e38b34c8994f4098cd7d79004
BLAKE2b-256 f0ad6bb26b4e795b6d4ba5366553eabd611bf8d188d7c8a6de14089bcc9aecc6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c1160c5b1c2490e454a341f45b5ef00bd3354e91842ece6276c52b5545d4a52f
MD5 2a5bea662efb06dbeeb4bf6c42e80125
BLAKE2b-256 823bd8daba53d102fda0a96e465b5f2de4ab2b72f0d578b8aada01224d490404

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e900e1a0c3bbc9d227de3b2bc53c2aa87f88299defaf4f2683382747bc410931
MD5 22a57ec77cf48fcee5047a8a41c7a06d
BLAKE2b-256 955f9004bc96de8d169b03d10bc753872a4e4a2d49fd94ab7ef0aefcbc08d997

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3c05dd613d8378ba70da69a862671a3c2cb4aa378336270f67c10625d7010b21
MD5 1c19d6bd3261ffdfca29e9c05aa0b62f
BLAKE2b-256 005de4ade77709acdeb7ab703e7366271d2478564b608414d51cfce621494ad8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 b33301d5c524f35ac3ef5a99b10e0fc031ab941d42e6d328689f43869f54101a
MD5 2187c53db9a7a6e205b22f254d01035e
BLAKE2b-256 53a9c45c9941e8ead4f109818e5c7e651b95f53e2694e13100f39ca4f7e2ae91

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