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

Uploaded Source

Built Distributions

zenroom-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (778.2 kB view details)

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

zenroom-3.0.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (788.7 kB view details)

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

zenroom-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (740.0 kB view details)

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

zenroom-3.0.2-cp311-cp311-macosx_10_9_x86_64.whl (649.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.0.2-cp311-cp311-linux_armv7l.whl (767.6 kB view details)

Uploaded CPython 3.11

zenroom-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (778.2 kB view details)

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

zenroom-3.0.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (788.7 kB view details)

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

zenroom-3.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (740.0 kB view details)

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

zenroom-3.0.2-cp310-cp310-macosx_10_9_x86_64.whl (649.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.0.2-cp310-cp310-linux_armv7l.whl (767.6 kB view details)

Uploaded CPython 3.10

zenroom-3.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (778.2 kB view details)

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

zenroom-3.0.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (788.6 kB view details)

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

zenroom-3.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (740.0 kB view details)

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

zenroom-3.0.2-cp39-cp39-macosx_10_9_x86_64.whl (649.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.0.2-cp39-cp39-linux_armv7l.whl (767.6 kB view details)

Uploaded CPython 3.9

zenroom-3.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (778.2 kB view details)

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

zenroom-3.0.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (788.6 kB view details)

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

zenroom-3.0.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (740.0 kB view details)

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

zenroom-3.0.2-cp38-cp38-macosx_10_9_x86_64.whl (649.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.0.2-cp38-cp38-linux_armv7l.whl (767.1 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 a0af3c4b692ef14b85394c6210d2e66b7b4ce08a12abd567bf4e071afe39642c
MD5 5491e82246c3ff3b52e1f1545a3b9f35
BLAKE2b-256 12832ea7126d088c1371c9dda8edf419f3f54e05835e5b61d936218135da3c6f

See more details on using hashes here.

File details

Details for the file zenroom-3.0.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.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 ca16a0bdc781c153cb7c89898b3011c23bae12eefad185df67a10f8b388a523d
MD5 e99dd725635752623e6be24488066ff1
BLAKE2b-256 d57895dbd8c7a891e09e189de2b97342067181b0695df2d5cfd8f47e06fc8ec5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3b0e799ccc0b072001d33965ba745a04978893f5e11f29057631dc69eb94e966
MD5 0f9b4093e30f1c1b5d0e384a3798775d
BLAKE2b-256 211a5da960973b7f8307ee5ede37bd1078bf14ca07f17f7a9dbe7dfdfc40212e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8a763cef28e8c6c640673affaed1478b671846f2bfd055b4f5c92c5e57aa4447
MD5 3b20506f51b2a007dd321fd26829187f
BLAKE2b-256 6278b69ed4e52b56eddd560ff0afe6b90dc9747be73cf88395c3c01a0d6b9ed5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e4ef6b63215fdcab88a7a1e4dfea9d9377c0ff5a65d959fc4d85a86282be9df9
MD5 716c14ccd300cbbb4ea458724d4756ee
BLAKE2b-256 0ad0ed583e88f20e3f5bf951f001a0ffdce70efe538e3f76377a09061d03d3d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 60a49b4bdf08f3612da5435fe16c866afb114edc03f72dd569ddb23a58491c63
MD5 c964e1a1b7ae268434a787097fdce005
BLAKE2b-256 6b6a35a244547f50759c2bdb9cf588db5c3ad8155ec20b11ca535d585c774120

See more details on using hashes here.

File details

Details for the file zenroom-3.0.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.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 64326f412472e6a91c89dc56129b31043e4a34f9feff0ba31f3b64e7a35ff6bf
MD5 a4fa29c38abcfcf2f0a4b1f3faa31040
BLAKE2b-256 5c92ce49eb1537e4be174b8584f0ada1b985463cf8d825fb974414794b2db348

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 cefb2826d4a6815797791c7641308906527a3cc27bb8d9be5ff5c9fc49d13865
MD5 b01b2c1565b99da795453731245a4f21
BLAKE2b-256 463a9b0f443095dcd2e569c708f9db0892a7c884638094031ab9c117cba7a723

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 5c7f49a082b65be024da2314f67bd1bb1fbb5c686073576ddff6f9ba8ad643f0
MD5 cbaa3e65c0685538cbe37aeb5f5e9d3e
BLAKE2b-256 95a4d19e5374700f373a34b96e984084bc80bf09a7889e33a03f2e1a5ff9acb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9d8267dc5f17bca6bf0d654472f4aa82a325117ba75077d8cde4657927b24764
MD5 9be457512cfb8bae7d85b4fa7b6b8995
BLAKE2b-256 7d0ff4b3dbe9e93197c9e64bb3fa442644f61bb0247b24bdfccbc6cef2f9c3b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 f0b92af1e38c21d94e68685b606ba2606d2e28cb5f045970c8ae69f5b2629265
MD5 32ffb9b630da7fc6311048118c841ed8
BLAKE2b-256 54662b7eb512dab4c5815b4e5bc52cdbfc91b985f2cd0ae866c61a710e25e954

See more details on using hashes here.

File details

Details for the file zenroom-3.0.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.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 14918e2e135cb6dc1cf43d4dd17bada52273e8c3c47e10a2124bb08a59ab68c3
MD5 853631b91b0a677408c78a19719c43ce
BLAKE2b-256 4ad824514af5828d2a91abf6eb4d4bc9dd2817e2682571c226050764e1aa7e5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2df61dc461566c6b77f08583319fa8be3392f89f25bde50a41f39aeb4a1e509b
MD5 a9813b98ad5390dfd1a7181f724d6261
BLAKE2b-256 c2098967511355b1615cfea02a00a3ec659d45c794e1ec155dade15a6ee8c5ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 685c6315326a899abed0cdc4e9123b5745ca5f3851b4b09d8790f4d1c460c4ce
MD5 bb1bffde09cf40a9ece6949615358bd2
BLAKE2b-256 b8380e49b82cf45abd5ba07641be446a44000961fa006bf46ba0ae7b183945ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 14233cc212874c85206433c74b420f9ab43b99f86aa1889a76710d29354af8a0
MD5 3726323d8a03633e6744088d152700d9
BLAKE2b-256 6cf8931a585fa6fe19b1d2aebebaa5d09091259399fcdb39fb6eb13d7918268a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 5eb58b931430022180f9db2449319430431e4c86a34caf732fcf3867d3a56952
MD5 d240dd2405935fd6f71adf923e5aeeff
BLAKE2b-256 263a05b9ed43b00877b99aca79f8723ab4e4c45618c5bb8ace551fd808f3aaaf

See more details on using hashes here.

File details

Details for the file zenroom-3.0.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.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e427b1f4c8e2c15182a0472569b978adef3281a74f2583edc2c7e7608157ef7f
MD5 d6ccaee2470f31face6cf51d616995e6
BLAKE2b-256 45d47df06750ac292e6f433bedada8cf69414bcbfc7d57dbf20800390529a868

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 725c001024d76d59fc5bbac8faceb9caf0b7bf8825688979ae51ad0739b6ae53
MD5 02449cb208cba3caf0062190df2b5f3e
BLAKE2b-256 74a0b090ba65c548f372132d16d24a2d7a277009e705d379ca97e96103336da6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 eef08cfcb32b9a1a7a56908aeeb93a942cbdd9eda333e145aa2bea4d88300402
MD5 beefe453250551574788ff588fdcf09e
BLAKE2b-256 d442e6f9bc0c82120b4a6fcb26bee149c91b5b4e48bdff82eba80f5c42719374

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 50a318cd7a80d738a6780e5c29859a376177c8c793db216dcb19647eb21f2e28
MD5 363e2d711ab4cf21fecdf996fe4b3165
BLAKE2b-256 73b9f7d9d000ef2ef23edb974e4a23c9d0b161d65869936d3d48e546af20d3c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.2-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 dd94fc3c001d620a2bdeb5ac6b2dbe46e879afd3ff0d86aa3e747fc93536a3bf
MD5 0b2468f8e0e52b8c7ad5f70ab0df6654
BLAKE2b-256 46db7ac5f5d68d7ac2d760155ec77b8e2ee30cdfde720a0ea62a221b1c140c04

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