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

Uploaded Source

Built Distributions

zenroom-3.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.9 kB view details)

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

zenroom-3.14.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (806.7 kB view details)

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

zenroom-3.14.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.14.0-cp311-cp311-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.14.0-cp311-cp311-linux_armv7l.whl (784.5 kB view details)

Uploaded CPython 3.11

zenroom-3.14.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.9 kB view details)

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

zenroom-3.14.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (806.7 kB view details)

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

zenroom-3.14.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.14.0-cp310-cp310-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.14.0-cp310-cp310-linux_armv7l.whl (784.5 kB view details)

Uploaded CPython 3.10

zenroom-3.14.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.9 kB view details)

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

zenroom-3.14.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (806.7 kB view details)

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

zenroom-3.14.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.14.0-cp39-cp39-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.14.0-cp39-cp39-linux_armv7l.whl (784.5 kB view details)

Uploaded CPython 3.9

zenroom-3.14.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.9 kB view details)

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

zenroom-3.14.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (806.7 kB view details)

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

zenroom-3.14.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.14.0-cp38-cp38-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.14.0-cp38-cp38-linux_armv7l.whl (784.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.14.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.14.0.tar.gz
Algorithm Hash digest
SHA256 06e5a3b3be9287a6f1b49cf859c2982315375ab95808d5c61bad75df96d4ee06
MD5 aac933cf37d23bcf48ffec22a0365dff
BLAKE2b-256 d97cc06e1b07b5c7a602ca10170edc851f22429bf6bda481e5c05bc70b9d181c

See more details on using hashes here.

File details

Details for the file zenroom-3.14.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.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3a5b905ff1f978f28e91615220af718bd8d05cae88b211d7eebad4d95742cde0
MD5 3079da77a463a22faed70995879fde9d
BLAKE2b-256 53ceb343b4fb327e0a57078f5736e9a967a9fe4d57d936790e1e48b530198f4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 1dd2200493064b6609992af5862b3baeaf0342605fa9da3caba1bff05923a104
MD5 65bb252932b7d9634f2292521f33c0d5
BLAKE2b-256 91258ad4b26aca60db06726e3f7d12949fb5e6dc0cf9790b433ead96d2f713b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 091c078d2bd51a8e440f4f556b0c166f4f4b0f5cbf99b7c8718ac32b452ee822
MD5 217b93fb131e4a624ba399ca14eba5fa
BLAKE2b-256 1bb49bd18b73975bb96424fa3c546449d566e1f8bce8970738f105f428edac7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1e621eafd751642a247032311330c79fecd8d936c36137592ba1d7fff60cec0f
MD5 4da28a9c515fc1a96753c7208db2808c
BLAKE2b-256 a928bd12776e1a2973561baefbdd6eb6b93b81a2f1ef0b65efbfa66afc7c93d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 1a492d4dfcab0efeb2049e8cd991caf1803b616162cd0bb5200a9bc41a59a900
MD5 1c8a46c55ef363f62d4c208c04e2b5e2
BLAKE2b-256 93f23d5bf0e1618305688b6cbcf68d48be4953c079b17e9121d66b65e8396d81

See more details on using hashes here.

File details

Details for the file zenroom-3.14.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.14.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 57134a69754924aa52f8117ea2712d97fd62bcff0881d590ef47e8a9b6ea3072
MD5 ebb6c7c9f7cd7dc838355fe8f04ff435
BLAKE2b-256 78e7fd65d37e8d370617135c42263211b5025e178714eee7d249dd50d6b12242

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 556f07179a068a80966e4ad52384d45a40ac1d749c6fecb1f318843522295124
MD5 d8a20319235acc10fc52dec797d8d78c
BLAKE2b-256 cb9f8f9d9aaf5396587dea204ade473b7fa534648788b2fa9945839d8e784bd0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 753b12b0520107c85ff263dd2ea134acdca4e54cf81873db65d73253fd1a9ea3
MD5 4c99ba237074689f84c791cc8a6c042f
BLAKE2b-256 75fa6a8c7f3642028443cf4ecc664ccfa5a397381d07378e4a9be24687162682

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 75168ef9cec96be81c0fe645e26f0188cfb58dfd6e4199990acc283564e178db
MD5 cc9be7c9e11a38006841880290a9959a
BLAKE2b-256 b60666091003da45090e6d315528ca311fa10b54374ad2208ba52a80981f09ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 df9b63e9c92edd7195a812a05fc5ecbe87e489d5aad2fee3ad20eeddd6e0488b
MD5 a9e62a50d654fa4c08af4c983a7d68f2
BLAKE2b-256 af4dd6df974cecea2b552f5d14772160a5286441bd85cb57f350eeb1700a0756

See more details on using hashes here.

File details

Details for the file zenroom-3.14.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.14.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 6e71f10d0cd834aa712608abb1bd46691a61d198773b90a844c685c76a679202
MD5 e997c608f50e06f55757d69e39dba7c0
BLAKE2b-256 1c9a3e560b9c4795fffd8a3a57b0d33aaebde474cd7bcc88659780c5ccde9a8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 0b78b57951cf92f42f590a77de8b1cc68bddd3127c62d425f39c6f6fb88e5b90
MD5 16153553dfb690a18148ca8d5155a283
BLAKE2b-256 c6c49a20d8c27465a6ef8e2ffa25bc8257ee687d2f9e7ed78bcc57cdb5fb486e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 31612d68e1ccf46bd4dd479bb82e57dd8eedd1fd91f94d87eab33d447e03855e
MD5 2c3c450614801ab3cf68c45697c22378
BLAKE2b-256 9a659f53a4c592868dfa9627337fa53d394d01309e4750f6115550e21d831b98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a044635dd283032d4e8ceb37c518887931013673218e93dcd801899eb16297f6
MD5 a9bbc840d699ffd9f788f551e782d2a6
BLAKE2b-256 10bbaf43b959b69c29d23c393a6e9fc70afdde1cc4268efbf9376df6314a767f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 94033704a7461e31734ef2504cc0d4eecb3febbbfa38069199dcc7e9ffb8edcd
MD5 74ce3f8721dfa854d72c18074ad77559
BLAKE2b-256 28da7cd382d80e983fdd2c09a18fe9a68d726f09f16e896bd02f4934e64b0194

See more details on using hashes here.

File details

Details for the file zenroom-3.14.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.14.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 05aae8a78c8332868fa8495686b0a0d1167b0eb6af32dae1c57ec1550d0a600a
MD5 b40d410758fb870a316fea6e07a22eaf
BLAKE2b-256 14002332988df8505c726cd3b4b1716bff04dfec0dd628ebb6ac8a9f0bdcb822

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ec70fb1fa79a3ee92786b41a2b6d587ec3ed0f61868fd1501eb50ceaf0c2365d
MD5 e40f009ac7193ec3b88f4dc2f5cda12f
BLAKE2b-256 7230be132b7c73cb2e8f8d17fe4574ab1f3900d2ea9836945b1caab21b1b2647

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 7527f91a4e27a649a42ab8a04c40e347e7c724119ec325f8d719ea232bbb868e
MD5 581c4bf6adb46a08c9f39becfbe19994
BLAKE2b-256 d6cec9ce8cdbc708a0c17ef38878866cd7e84283f31da3d634b79b523c80a53d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a7bba0c64feda521268baf77a5702e9be8e9e58a73b1550bfb6daf1fa08e68a2
MD5 1ba37b9a44d78116cad00be466f248f4
BLAKE2b-256 74464d0c1189b31a15b3204f23db103dc876541f9504fe6e8a05e9b143120a18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 7bbd1ca25c359b00cdb545ad4d3d96e4d4bf6e6cd1bbc3ed621bde9a4d4b9536
MD5 04f484324f7b52676ba8ef3d88a2a967
BLAKE2b-256 4ce86db9c847a577e829807cb72a95353037ded1d54972f10626cd3d6e318cc6

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