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

This version

3.2.0

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

Uploaded Source

Built Distributions

zenroom-3.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (786.4 kB view details)

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

zenroom-3.2.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (794.5 kB view details)

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

zenroom-3.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (746.1 kB view details)

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

zenroom-3.2.0-cp311-cp311-macosx_10_9_x86_64.whl (651.4 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.2.0-cp311-cp311-linux_armv7l.whl (774.1 kB view details)

Uploaded CPython 3.11

zenroom-3.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (786.4 kB view details)

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

zenroom-3.2.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (794.5 kB view details)

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

zenroom-3.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (746.1 kB view details)

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

zenroom-3.2.0-cp310-cp310-macosx_10_9_x86_64.whl (651.4 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.2.0-cp310-cp310-linux_armv7l.whl (774.1 kB view details)

Uploaded CPython 3.10

zenroom-3.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (786.4 kB view details)

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

zenroom-3.2.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (794.5 kB view details)

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

zenroom-3.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (746.1 kB view details)

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

zenroom-3.2.0-cp39-cp39-macosx_10_9_x86_64.whl (651.3 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.2.0-cp39-cp39-linux_armv7l.whl (774.1 kB view details)

Uploaded CPython 3.9

zenroom-3.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (785.7 kB view details)

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

zenroom-3.2.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (794.5 kB view details)

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

zenroom-3.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (745.6 kB view details)

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

zenroom-3.2.0-cp38-cp38-macosx_10_9_x86_64.whl (651.3 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.2.0-cp38-cp38-linux_armv7l.whl (773.6 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.2.0.tar.gz
Algorithm Hash digest
SHA256 cd5c23bfcc03aef1ad34d02083b2a305227fecd4acbef096602f7a5df5256280
MD5 501b04bc6986044d831dcf3645bc1b17
BLAKE2b-256 08948acf50b7ef552393ab6a7431f7c87c33b415476155aedcbc68089e68e2f1

See more details on using hashes here.

File details

Details for the file zenroom-3.2.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.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 cdef0cc6b3f597e8bbcda3d063b46e871f06a6abd076f91683053cbde1d05bc8
MD5 580004fef19e7c9dfeb5bd5b6885d377
BLAKE2b-256 89f4c14df528903f43ee0ce749786bda62fd055444a8ac61aaa43ca30b36876a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 6a50416588ca12c3ad7e4f9186e0c47709489e3358dec6f60366e3c33dc03f33
MD5 5173d6e39e8656e8a679638fb9825a27
BLAKE2b-256 625c452be87604c3de1c2a8c2a705ee53930d54e155c70bf51b3dc0e761de0a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d50626f415d2768cff2cce6b73f15f363714536136dc1125df933a3881394ddd
MD5 bd89bb0d84e498596b09fbc644955b2b
BLAKE2b-256 3131471e96209b3cc504040b44f5fff406975e8e6e4bf8ab3d24b8c464ae822f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 44551ee9671eb4641c80a97e0685b37524bb4423c5b9f9cb33d0e4365ab1dc63
MD5 076887d640cd068f03c8d5e2fb942df4
BLAKE2b-256 7bc30d1eb2b92a0facab4bbdf389c4bb4449eb959f2c44bf6c56057a5775f00a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 b225738a0295291f30077db52693939fb3ce68b085762a8c6b2ab17f15b5097f
MD5 a048a8fe5805a3d4eb10cac0c4e600cc
BLAKE2b-256 15141e9bcd303cfdf7c38839160514144e322657f0e6f3fc034f8b7e0fa1ef61

See more details on using hashes here.

File details

Details for the file zenroom-3.2.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.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 feb622294f1d6155737460bcedf88f456d474b7f12e76300b57ffb7348535a7c
MD5 0407dfab427fcde6d51e3f54f6976a96
BLAKE2b-256 55e3d010da8fb34b2dc1098f058e36052042f0745a873724a20c7c1192554ae0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a06309bc00c77d208df72aac0c00a6d01d2a11f465ae3735710c9a615d9a0b22
MD5 adce259550e34bbe5e5ae7669d026361
BLAKE2b-256 6059458e77c3b6b5b6afa10dfc013b6fcf589a4b00099c27927474718f0f23e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 256bda1e5a186694fcfbbac9abf75a0041c132b260b32258b43b18e4a486cfce
MD5 0d4a8c282323b92040e946c7f2398dd8
BLAKE2b-256 d927ca145038e169f0454abebef94fd146dd0f678a46870a00b2bfeac41b4742

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 08ac2b8fe0d8d802c7d26a97e7fcb2ef0b3cf3ab4276f7e179a2e04c0fe3b94c
MD5 85c870005c485f4611f97aa12abb503a
BLAKE2b-256 5cf213daf3d236e11f5ad74ea2a3fc230da44fb5c96dabc25f0acab49576e96a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 79a7ec896c268d1b75e9cf9dccdf8eeb0126eb5b008984782edd9e8ff9b359e3
MD5 54214beeba72b49449fbfb6c53683eb4
BLAKE2b-256 afa238f9ccbb75a92960c2387a38342fd567067649034880008351eb3108c6d2

See more details on using hashes here.

File details

Details for the file zenroom-3.2.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.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 98f296a951bb065358dcdff0755917962529d4d84f0786dd79c1f25b561f003e
MD5 dd239cb509fca03f966fa98df150f15b
BLAKE2b-256 6be8aec0aea7f4e4e426ba08e4ea6041fc8da16c8c9f551fa3fbd85702832931

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d2fa6e19b24ac0ea2964b7dde6c9822dbb35812fe82d7b73bd4dcc9cf7644b77
MD5 2caf2da49ff7d6a33fd5c832fd74dcf9
BLAKE2b-256 61ef634a97af48321fb76a4e6b247c0b615dc60b962ad29f7fd2c2d89b9bec29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 ef5f078b7c59203a70f6898b349d9e1b027fb073db9e5571be039ab2c80ae796
MD5 73dbb2ebce1bf6c9ab43363994595fd5
BLAKE2b-256 9411ae1c2142cebe18de91b4a06445a41b6da20964987beb18d42d4baf4aea7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 771b23757bdc700f08ec19becaca3a53b0a8a4afe349d7eb536182897914d0ee
MD5 255c44f5eb76668ccdeb7fc91c8ac820
BLAKE2b-256 be65071f2bc41aee2bf58711a2e87bf19ebab296d2cff76e0b5831c46351da8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 02f1360c751a44533b799312fe93e72e12c104457b968efd61b35e18ebf8ccb4
MD5 4a9dae3493d9063514aac7c94411c26b
BLAKE2b-256 4beda928e2c3f5dc9f827fba8f4868a8d7bcc9b6d9fe9365614cd572f6d8341f

See more details on using hashes here.

File details

Details for the file zenroom-3.2.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.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0b7f4e3bc8e4fff12522f67cb204aac24a721d8724e7bab824c37b040513bb03
MD5 f184a8edc1b61ccf1007e99cf97080a1
BLAKE2b-256 9a3938c8371e7d474d3607c9c0547eed9c071157e47846ce0a4e9ad140f8e7b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 edf14ded2a2e1e51f671f56d170c0a76e3e2efb896d2322cd35e11021a916013
MD5 c21c02fe86af39586e43fc5ecc86f14d
BLAKE2b-256 eeca218c1babb835d0579ad343cd25f128bb8dc6503096520062cc35da068295

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 b428fa8c08d7c7dec4dca6a84f29bafd489540d382344f11856ba3f0da2e4b86
MD5 0a208454553c289630ea064881d90af6
BLAKE2b-256 63af7ee7d56801f8a012097b343260fdcdad1b075ca97a957186ff9eef399745

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 72eceedaaceb93d8b4ffd4bb3265d1e0be745909e34f00e6534ee628aa740a47
MD5 1619a701a1557f6925abed8e9a1b57a9
BLAKE2b-256 34bbdd11d5099c067bb1a009bd6943af83c329cd3cdbd5c63086b50241af5c63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.2.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 2bcb1e1b059d5e16d8d18092c12dede53bf0d369c1875d1ab00f383f98306560
MD5 84f5e627735c5c4faf2493ad2f4dd154
BLAKE2b-256 e968521785289ed15304e60e778e4a7c46de3a7dfc23cacef2a66b1af995178c

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