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

Uploaded Source

Built Distributions

zenroom-2.15.1-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.15.1-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.15.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.11

zenroom-2.15.1-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.15.1-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.15.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.10

zenroom-2.15.1-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.15.1-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.15.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.9

zenroom-2.15.1-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.15.1-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.15.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.15.1.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.15.1.tar.gz
Algorithm Hash digest
SHA256 d638cc1c0212c6d57bfcb858e8f52ef3ed298e3a68fae549ab8f6e2b60a2ce27
MD5 9ada932f72966930038cb30e8cb4667c
BLAKE2b-256 bf90a5e23709ab7159f35a05e3eb34a73c2f693628f936f69aeee629b4fa75d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 acb2f526c76454970b8bfd7744f611485696bdf71d9b083954f18a9eb86ec64b
MD5 63bd1bff63e84818847002dca4bafc93
BLAKE2b-256 e37ec0c16b4e77335e5bc12920d4b5f4839681f6e793b3c94324983994d6c799

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b2c07832699f5e76516323f070481c19b3c2d6bb67d09af4385a0a1e1b962ba4
MD5 f613c80a5ec1ec93abea345380b5d607
BLAKE2b-256 8eb254e7ecb61558f643dc17cd5741b6a197fecf99eac7c4cc9ea843c4eaf980

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d18a838dae86c32ea4ec5f32106fe9115bada2f110233fc6698e508f7fc4bc84
MD5 78f2e6d22da88212d3a9f2b7e5d70251
BLAKE2b-256 7bbb66248fa4b186a079bcbe06914d12350a2c0db26621caa6b5482500a202bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 17e7eaf9910fa8a0046b47609552d078383be00f4a6e82579025e872151899d1
MD5 bdb568ddfda2f53f17bd21359393cf45
BLAKE2b-256 1668e78416e53082c29854a0c1d708b263ec360106f401058dd0b1f14becddb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 f4b94bf815b2e4bedd7dc47c980062bbf425f1ec202ce9df75bb129772e3edb5
MD5 e7c0463d871652dfc54116a10edaf3a8
BLAKE2b-256 d663a527fbb8418f5ea8c690637fff1cb7c029cae888d546179a65a1f4cc7780

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 4d69de1a1b7f9f67c64d0858219dfe7860240b2f4f414f2f4d0e8bebcf0fc39f
MD5 2b3bac7ff999f52f76c69479f9db6efd
BLAKE2b-256 1729e2d487afdac4a3f619fb145d4ac73c0faf7a09e7905b1bd28a26a2ef16d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 271570df52f6b685d787ddae56979d3668619ce1ae5fb6cb6748fbbfd08538aa
MD5 226f3b69d11ad7c9fb413f9d7cbff25c
BLAKE2b-256 98252d8a34e071388f02dd1304568dc1fc9770d02842933353ef572b81bc2e99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 db21605a8cb63e7d0f3f6b5249958f98c79da17106dbd03a3bde41b1a93a7a80
MD5 dcd16ea63a4931877fcb1331aeb014a1
BLAKE2b-256 3e5b142ce9643d131c58d7e4caf064cb0e311a51e4d00ac0548a06883cfdbe71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d03f0787f2c40dd54a8f136a742d007320bdf1b58247025b9f96ce901e094c78
MD5 4adbb76343642d51f0a69c3017552ee0
BLAKE2b-256 34ee2fcd3cc70e7ec56248b67a6d2743d4277ca321494833ed1d5003ffbb0f74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 a979f5ea3195b9280d30b96469075ce7623380ab47f20de2d99e206010ef15f1
MD5 b060e256dab9d61c42cf7a27e9ebdf74
BLAKE2b-256 16f39912db2c239ed906ca81d26d76e8153bcec49174d34b19957636dc33ca1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 78f0cae92430de8f5c27b11a004f77799dfeef04f762a8d67209538af73602e1
MD5 6e0f24f8d44a1360e1ab642afca1bac7
BLAKE2b-256 f9da4d8dd070f44388f8098557fb8fff5bdc03ff5dd9830829ea9c672adaa0c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e57797811bd50d8d6bf68e61bb315652d239cb2981c598cf4f1a995ac8fdc31a
MD5 6401b7d9d12ecea0e88540583e521163
BLAKE2b-256 69ee0e0af025c7f65ab144434a540e420a099fcaae10c0af5ef3381be5fd0086

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 612c9e658ada6afa660bedeb75537f046de213c27a86aa4ded8610146e0190ab
MD5 34028ca7adcb2714b957397ec0c2e9fc
BLAKE2b-256 792d9ba750bcf38540f3cb8cd0f99c383cd0cbd87c26af9385a5d6dfcaf698fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5116539e8a930ddd9bbb4cdb85fde35184930fb8e0afecdad701b36a33d934e4
MD5 364f7efa993b26cd691db5f1109d0299
BLAKE2b-256 50262a89c87fe01df2381da78c97c38af4e8436bfceab62d5c0c54c09fa2d3af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 5a55281fa3d7fdc4781c121861d5fb1a9d9c2d9e41963919e898f519d1c207dd
MD5 bc5d084020fcceadcaaa94543c98d033
BLAKE2b-256 992d98a3071b14396bf360bad4eca79cc61c3e464b8f22dfe63750daadf41b30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 83cbfc8503f9f42af85a398e1166a0d639801b130616383e268b24a3324203ca
MD5 33f7d2530ee770a2811471228a15a47b
BLAKE2b-256 c4ebfac84e2a7d0e2c3e9a6622234db50434fc47082565b61db1ce61446a7366

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 44003486799894a0b8dabd7cbe1968f7b7cd6120807e5f7c69f8d41444719457
MD5 f391cccc3c17206492d5ea6e1cff76b2
BLAKE2b-256 5e41e0048e7af32c145a68a869c0650e573c62377d992e5685553b2ea9e210a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 49836f7d72d736b76add2fcfb2e8dde3dda356a3d51fb3d0824c2915cf7002f2
MD5 39dd87d83ffc2984577e4ae359d6a8b2
BLAKE2b-256 ddca6fbdbf263a1b27a33e8449984a3608f7a117cb393c3f5fbd84ef269c443f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7e5ee9471a88bf0a9a88bf98f08ee47f1b57e666e3205b6c88fb944198256785
MD5 c4fab922a9cc1bdfe5cae0d8f2a05096
BLAKE2b-256 ce4e0fb632f8975a80819bbd3e94d7f80a4be2d13478cd3c8786ebfdb52cbff5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 a708e4089f192fdb905c1a0d8d89a95908dc0af5a9587e6fe0f430b24d78c387
MD5 88c51fb8a51b221359efb5e8b55247db
BLAKE2b-256 0f187d9bf2936e8fc6836fc8a1318433994e075077db17007bc63ace98788ee9

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