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

Uploaded Source

Built Distributions

zenroom-2.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.13.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.13.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.3 kB view details)

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

zenroom-2.13.0-cp311-cp311-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.13.0-cp311-cp311-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.11

zenroom-2.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.13.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.13.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.3 kB view details)

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

zenroom-2.13.0-cp310-cp310-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.13.0-cp310-cp310-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.10

zenroom-2.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.13.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.13.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.3 kB view details)

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

zenroom-2.13.0-cp39-cp39-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.13.0-cp39-cp39-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.9

zenroom-2.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.13.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.13.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.3 kB view details)

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

zenroom-2.13.0-cp38-cp38-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.13.0-cp38-cp38-linux_armv7l.whl (877.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.13.0.tar.gz
Algorithm Hash digest
SHA256 79035be02d11b0f8c8e0c6d4c43656c318aaf12fd8d57ce9c496d2f867ee850a
MD5 cef61bb765d71f803364c6a297e23119
BLAKE2b-256 915cda70192c6fc4c96e4be1c2e154b5c79228e59527872335b53c3577a27bcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 fa2ec4fae26fd3a886d8d5d800bd0187547ffba6ef176364c616b17fe88449dc
MD5 77f13d4777b14fe9ed3b4e65bf014284
BLAKE2b-256 bb1e5c0bd80b351623737d9591dfd2c0a18d6880fa67eef13b3e11c91cd9715d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 85012c55ee1a0a66fe245592917eb246e92153670aa33eecafaa2adc37eb89cb
MD5 1e8ef84128ba89b94a7c69fdc71e17f7
BLAKE2b-256 6fcf99b0e7708ab466f4a1a8a0f1749848293a1e950ab8af85a013ef776eb416

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 207a7dbe6b28d806356145d4b9c0d7312627267b784a4b94de68980f86623d9b
MD5 f8327ca72e4a9b94a852eec2ce5a3081
BLAKE2b-256 a87ee6994508ca14445c9810e715f180e0f6107c7f53c67dfdad2f5c66bbcf22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 15d09baa36d10b6ebd18b85a9e5df944a3303fc6c9538757b4b1d24aa02c2e92
MD5 79d5ba1b61503e25f9c6827ee8bdb925
BLAKE2b-256 b9cfe0539fa5c20f13c74c0a58ff7bb2c5a19aa09c346ec112cdf06be345fd38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 addcbe088cea550d1231bb1448d705374fef3e26bbfb3ed87685cab7e2f7102d
MD5 9e1861d7b35605d9139cdd66fa2a45b3
BLAKE2b-256 93f95aecebd45fc58e46ab009a7fba58c9f7786ea59eefba851099fb03ead215

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 415461beea65eb7d727284a658978a09525a4540094187a5a81ff6b45811b0f5
MD5 e371792a7783bb627fb607a6e36b9f3a
BLAKE2b-256 0a0a8ef02240c7a7d98a88cc3d22b78ec7e8f935c8ec9adb12047bbb614a9d5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 8c7f07f080047b00cc993d7fa85f838d60f23f6b50164c1df7ebb857e966bda9
MD5 e003a1e57136b28c39a76ed7d543f240
BLAKE2b-256 471f320859eded0f2911484b6f5fc2294a1ea516d11fcb5ca3b5efd49d4aed3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 aac4f0ce936ff500df83a83e64ec5861267733e83fca04a82f9d32c72de96b64
MD5 ac470dfd3bde34804dae0fb2ce5146e2
BLAKE2b-256 7695a12b51fc2b02b1873e8e83bc0d88c82852c044fab65b3a85c75682036d7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9e3a1c85b4a1fc1f1d744fe941c9a6368da65530d5d536645e07cbc3683756fd
MD5 c0f4bd29e16532203cb65ebb2e6017fc
BLAKE2b-256 2d68db4bd2c12e58ca7de7f47592769750789eb4e23122dcfaf34b78ec7468a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 b8ee697353605bf1b423143a7dff5abc368d2d5ca054d72eec8b8b8556a58ebb
MD5 28c88029e40cf1b4c2b62605fe7e0556
BLAKE2b-256 6e5d9b9a7bedfe24d2aa2745d31fc014f70586b8610a4057b09af9033b1949cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 15323075cbb20c84e438efb57aa2bb3710ca7a1cf89c457c1a713d5740976b76
MD5 c3baa990e4e3a70322c6c1323967b390
BLAKE2b-256 eafd040f10e5038b8c81108f165f307ea35a9770c939a9a315f5009c639a4774

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 aec8bb41561d2f7e3ef1cde703e7d260f9e013562581768cb92ee4c5e57e7ddd
MD5 aeffb338a79613c52854248da954ee26
BLAKE2b-256 f46446f1f6937de74b05cb4e536e878cdced6c09e461e0bf76ec5955acccc134

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 b105f0339ac1ec832796f4c1f9bb8ee493edb2ab509518dbc729a37d354306b4
MD5 dfb7f94f42e80950a60a44cf0f02318f
BLAKE2b-256 51e19fb6d95f1cd7714293d0a939e6bece0fadff82872f1ce4aadec2d6e1c945

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a4314b5120428f12c2fcdfccabc1edec5bdd87cf05c3b78af1490c18135d7e41
MD5 9dc27177539080740d5dd07e3f487deb
BLAKE2b-256 fdb60c4a2d896886ed62916abe0ade2d5e20a6ccd22f3fc0d5e59694364ccf11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 fa444deef2d3d343079040fe693a649fcb015b90841cfb642ba2bb457cb4a83e
MD5 418890b2014bb90701955352597e41eb
BLAKE2b-256 2feabb199d09eff83733c0cc13276c1877681270d268fade6e518d2ace1e6fd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0d150b1270b2496be617636fe9fb5cbaec7cf158cab59b5da278e3371403b71f
MD5 36afb20dbf3f8800f31f16c5d14d51b1
BLAKE2b-256 8684b43e71295b890457847c7385573b56d19bb89bff4c1727d2721cabf53c94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 fe590462579441e6bda86d0a066711c77032fe594b31abc18821163f118f4544
MD5 96e09f5d43f792d46309824f5178fd86
BLAKE2b-256 f3977fce356de990d59f04a8a9153c7f3ac87449de83c053f2f357951591b818

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 175d9ee1492ae383aef072147915fd5a40a93aef124cc7459f415e4706ddfe71
MD5 c8d20be6c7ea433fd6a62b1e08309dc7
BLAKE2b-256 c71cd3ab23efe21b750f724898f7437a6695f0fca2b460b714f42bedcb5da426

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 92bc1d136dedc5a10822807fed10cdab0dc7293a7518289ab10cf423bf0a1ab9
MD5 5bb9aebaf9d6c6dcfb2620033ec15a10
BLAKE2b-256 248aaa23fe48c65a304acf54a9ead3124e3c696b327466d701e1f80f24afa193

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 477ee71f61161d737694cf95229de2b77318a8ebff4dc1714cc3ec349cd7096e
MD5 f592b9046364a1f067e3f125628adc80
BLAKE2b-256 27a50c82019a33f5ba23e4c45ac42570aec08e4f39768a8a58868d813f61ac3e

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