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

Uploaded Source

Built Distributions

zenroom-3.13.1-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.13.1-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.13.1-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.13.1-cp311-cp311-macosx_10_9_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.11

zenroom-3.13.1-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.13.1-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.13.1-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.13.1-cp310-cp310-macosx_10_9_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.10

zenroom-3.13.1-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.13.1-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.13.1-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.13.1-cp39-cp39-macosx_10_9_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.9

zenroom-3.13.1-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.13.1-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.13.1-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.13.1-cp38-cp38-macosx_10_9_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.13.1-cp38-cp38-linux_armv7l.whl (784.2 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.13.1.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.13.1.tar.gz
Algorithm Hash digest
SHA256 c274158a44c4ff75d5b4e29ee7481cb59a89fa3b64a0a32b5f62677edc722299
MD5 ab218866666c0cecfca2dc28bc31a19a
BLAKE2b-256 9869a5b7ab41941c80c36aedc2f81ead28656bf1895bc02b5f99a5e85e8cf468

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 dce9e95bf7c2c32111e3cb6a63e27bb98c5000d029f011d0cd62d408d1bb6d67
MD5 f1f9cd58a94887fed52e53eb5897328d
BLAKE2b-256 ed80b27e209219aa2498f5201384e60589b12d899b0868a8d30404145a7b60d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a892533e7fd325ffb6065d298336ec15a9c3f084ca94cb789d85ea6dbce82cbd
MD5 b93e02021687acffe25430188c1053e2
BLAKE2b-256 89f2dcd3ee89d6549a2d8dbd6f96161e23f42bbc40e0193ba3d43be970ffbbac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bd1b0bf089ff176a2f016cf41d234bcea37cb6fcba21cde9e2c2c31ef2f585c7
MD5 f95e692203485aab24e016f7b14078ef
BLAKE2b-256 f3aacfab2448ad464b0d94a8f30ba2f37c9c2e7898b3e2abfaed1caeeb4c3cc8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 525866c23093aa2686b7103e55900f1133e01d31c91f4772d2a50b44ec15244b
MD5 193c21dbe54977dfc4c11b3b4aae5f26
BLAKE2b-256 64547a82f7aa6aae45f4ead70eb5107eb6763d9bb21156240f7294ab6e322949

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 1d71c62ea0fb5d8cebaf4dcd76d38c76afc73f4b239bbace4f014568d32e1dae
MD5 ef7028ce2409a03e525f4c44e3913287
BLAKE2b-256 9c010f4afbbcee4a227b8ae377dfbf12dcf221c608d1bd032fb80607765e2d4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 29110cdc1f8f41ff64f7f8f1d5afe1d39c6afc7a71cc2463b075618603a019d2
MD5 76902fb7be51dbd0e0fd98cbd1f79f29
BLAKE2b-256 e9c291d68f896d4078bba9f80fc138f814774364ce0a2514702bc1bb531bf155

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d5f36b8ac80b20bb816b8721064e1de4d017050eea72c1f672891f59721f96af
MD5 8d0ce7f936eb79568154ab6407484b76
BLAKE2b-256 7c92b1f3eb85ddddda9df8c18e7d6c360438a1a614959f6979906311b3f249d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 1207de065a39185fcba8c0444967a41477c00413881ca8d5ec7d4dc0083addaa
MD5 80323e99303f0e5a755359cb42cbec4e
BLAKE2b-256 d4e3bdcb00965b5ae03085b2049be040d3341f46524ed90de2d83870869e3160

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4cc45c2d91199e32b4b15711b7822d972bc09dd27b9c41406892abbae3a81079
MD5 8c6743d3dd0d3c908f1dfc60d84aab69
BLAKE2b-256 3a264479807428b4261f7667e3d1ebf534031f6296ac0dd31d2e6fa386707032

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 2e7aba9a75213648fe07582dd49c9c560e1e2ee05c18f9dafcdcbdafdffdf64d
MD5 ee60aae45870e8680d9ea322d07660eb
BLAKE2b-256 ab5291367c60d3b3984e18f106e623855bf85d874553715db8aeff32bc5fc386

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 408214290816405d5a30434da2df8479721e750a1b92ddeeb7eb93d2961cee23
MD5 8625cbffa3724f3a0e5e5c8d5680bfe6
BLAKE2b-256 52a8d19a8aab055d4b7c4dbf336874f1a7f99a285f696a41eb5e3fa22c146fdd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d44d67bc3b822d968c68cec009ebc513898fdd9baa4a342ad0891837148ab313
MD5 adfeef23338272e358e89a80dc07ebf6
BLAKE2b-256 16f563f498c63f50274a484084bc2f4c05cae77603381df21378c19fc622865a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 9170cb879595776cd47f6ee7952be4cc70fd6cc899bfb61bd05f1d03ccedea7a
MD5 9d94cc5b597a15d0f4793b247fe700e5
BLAKE2b-256 18d71527b49352b68fce792b85ef962eaf7394685a155a77cc41accb94a4249f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e45d506c834f2ab9c1580ea469a7d035c2c1afbfa4e15ee3a14e6e2c6f6d16ee
MD5 5808466014ae4c5074502232d7fc44e1
BLAKE2b-256 c20c32e631fed2b03ab0b2fc128bc2450458baf2f6df195592a48305dd2def8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 31a5724f8659f25144644598e85454fe7b8b8dd95c13c7b4f4ee301551d37785
MD5 f8a706e32e0eee31f8cfb29e8d8ce09b
BLAKE2b-256 ae027e2da920e7d257419f6869e5fb6ad6c6051f37a6793d2821e1bac420ee5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7657b4ba8ce1b4bc5f3863a191a9507c364f4cf01114f1c137a60ba427917862
MD5 d833a6ff21bdc8f0f247afeb9f4f21e5
BLAKE2b-256 8385dad974c2d7dbab4bdbecfd1ae322d9677536f636a088a7214636d6d55802

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 00f41621fd9ded982aba12d09861a18e771e07351c25fea1adaf23991e1c1416
MD5 7c4b09ce56bd4a3a736c4fe9bba7568c
BLAKE2b-256 ba7cd19e4aecdb26a0a9d453c3d8e301da754213908248e359598b50c5ceb629

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e8173fac0db1ac946db489aba9bbecedbf52f36e59af1f39241798925df056e9
MD5 b9d61d516a8b9307fc64c70a79ff4c96
BLAKE2b-256 5d0fd31ee1171933c81c1f5b3ce5d146d8f11719d27eeaeb36c36047eba09248

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c004612d31e292880fef4b63d09b4dbacc14f39df5320d7363dc30947079b06d
MD5 a13385e04549abd7a8e155aed38f4110
BLAKE2b-256 be36cd4b02d21ca2878480ec8c5ef062b0c0e9f22151f2fa14ad5215356ac31e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 46e4dd155f7017ebe5c82ff2411e32a4dcf7fcf195b902e96188526183c3781c
MD5 09fe6e46defcbf5cf20cfe2f12749473
BLAKE2b-256 7cd5b5ed5a338f8a1f590f2d6a3bbf9abcdf3166cf5b9bf0bc47eeb83a99915e

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