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

Uploaded Source

Built Distributions

zenroom-3.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (819.9 kB view details)

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

zenroom-3.16.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (828.9 kB view details)

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

zenroom-3.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (777.2 kB view details)

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

zenroom-3.16.0-cp311-cp311-macosx_10_9_x86_64.whl (689.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.16.0-cp311-cp311-linux_armv7l.whl (803.7 kB view details)

Uploaded CPython 3.11

zenroom-3.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (819.9 kB view details)

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

zenroom-3.16.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (828.9 kB view details)

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

zenroom-3.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (777.2 kB view details)

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

zenroom-3.16.0-cp310-cp310-macosx_10_9_x86_64.whl (689.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.16.0-cp310-cp310-linux_armv7l.whl (803.7 kB view details)

Uploaded CPython 3.10

zenroom-3.16.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (819.9 kB view details)

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

zenroom-3.16.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (828.9 kB view details)

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

zenroom-3.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (777.2 kB view details)

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

zenroom-3.16.0-cp39-cp39-macosx_10_9_x86_64.whl (689.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.16.0-cp39-cp39-linux_armv7l.whl (803.7 kB view details)

Uploaded CPython 3.9

zenroom-3.16.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (819.9 kB view details)

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

zenroom-3.16.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (828.9 kB view details)

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

zenroom-3.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (777.2 kB view details)

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

zenroom-3.16.0-cp38-cp38-macosx_10_9_x86_64.whl (689.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.16.0-cp38-cp38-linux_armv7l.whl (803.4 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.16.0.tar.gz
Algorithm Hash digest
SHA256 acd858eeda5f238874e58247bc879548853505c9d527c7f29501db6c37ede15f
MD5 dd619a759b3bd7dfa6dd26e50da62965
BLAKE2b-256 f04ae8214460399f845c5bd9805f2e2f94f43863a44598ba9024ac943ed15abb

See more details on using hashes here.

File details

Details for the file zenroom-3.16.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.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 db19ae98958da92e42acfc6008224ed1127a189de7ff03860dc57c86241c8925
MD5 34d14f8908d7c3f5456451c56715ccab
BLAKE2b-256 eee00960b61046a1392fb8de0cd5c2345ab9f907fedf85e824107cd36cd1350f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 4ae0d37632bddf9761997a4bf6c9f9e41a7ece522eb0fe00bea5e1cd8157bdcc
MD5 fb42aae02defa2ae4611b593f441c6f6
BLAKE2b-256 3c5242ed304356fd92656604c158e20cb2580c524ae87a45731178cde489e0dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 cfdbdf275829523f910f7c6a357c6ba60d44608b7ac91032b83abcfe9b368977
MD5 b80d96d4442210ec4ba223c8ce3dae83
BLAKE2b-256 f4dd396fda39979905e255fc46bb70c5f713eac637b7d65311a785346f3a7517

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6c94bf5c2e2d3b046813f2f22d33183584d0b434d85cc6a447273e8672c4aac2
MD5 1d5f5df9e7775a80bd45c067ec0d40eb
BLAKE2b-256 20d59e6ae3b1cede445e8f45faf2b4de73a193627c950a85ddef971b7eba09ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 339630c7521bc9fd3a59fa3b51ede5e5257bf355bed0a479c49c13e729153164
MD5 3554b010e75abcc3ad23ba894fc2049a
BLAKE2b-256 b13aee794be8f26f666e5a868f518ed1722cc9e96c944d6561ce4e8502210b23

See more details on using hashes here.

File details

Details for the file zenroom-3.16.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.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 02818479a0373e6feddc4d4635417310f05aeba2d631666db8bcc02b9c9f2b46
MD5 a9a56631f4fc3885c987960fb15c6ca9
BLAKE2b-256 1e6d50ebca5810a09476a374351147d0df7697bcc2107e41aed08e83d6448712

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 6c886ab06274ce242c82baf851de8165f3b221d07c0c21274af0f6af14f295fd
MD5 36f4028c6a1f02906274fa07f9d95b16
BLAKE2b-256 2a16f11c35218a02cc2d7d1df2c506cd8485568347423a7f2635d732027dfa35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 f3fbe97c3eb2d27c73fbe72a48fe83ab8df2655decc3f0a08fcf396ffc42708e
MD5 280381ee816cdc3fdb49bed14306548c
BLAKE2b-256 1f59b66e835e675ae9f1f581153dd6448be5f498e45819ed1abc91328ae09191

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3bc7b2e4077e588d5168c07b27397de2c10c3e106890e428ab80cf6dc076d5ab
MD5 ce2162a2110e47485dd78cfba7e2d7e4
BLAKE2b-256 a7a2e6a5a9ab04a65fcbcd0f8a22b67c0401204822dbf158ba03375dd2e741fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 5dac2822132717fad04c155c7f1eee840517402e285d9b6bd0304a7552ee221c
MD5 82ec41d8d6e80bbb19e231f62654923c
BLAKE2b-256 19d8d5ff16436ac6ada6600c1b8d358f2ee2219ff01d5af31a3e9f57fe8c294d

See more details on using hashes here.

File details

Details for the file zenroom-3.16.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.16.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 8f4459272ff08bb81bb09e0396581c613895a08cea64a615ea4c89857fb67b78
MD5 fe8a63271d03ee0210060cb7735f7d40
BLAKE2b-256 49727c3e361fb49422c75b465b3265dfd62d2c1a0c9cf6e594262483016efb4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 95616f6ea26d8b3c0c5071eecc298ddcdd196422673415879a35ad95efa5cd2d
MD5 d30c34502c0c21fb233917e1d66d2f82
BLAKE2b-256 704a554091618b6276ea0c13d0cf700128068cf64f11a9c2ee32e0de68718c5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 dbd2901556b280508fcb38e3d2a1dfbdd510fdae82a184ac73f985812163d9a5
MD5 43d4e6dbac69958caf321e510cf4ebf2
BLAKE2b-256 0f1bec1eb48d438c2a1a46fe7514d6f8f206ced9b297c5741ba9fb776434f8da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4d153900894a99f9846d90c1876e31e625b388a63dbb689293f48353e89931e9
MD5 24e7fda3c3b5c08433cabe60f2aa667f
BLAKE2b-256 279d302dd04fc147d6b3e7c5a9e7e4ecc757666e8fb5e9a846dbb1b071ef0592

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 56d7a619221549a6ace818de4f08781bb08a95f5977361b7a26f664db53b6824
MD5 a2b8513cb4ff0f7a5a21cc0e52f49209
BLAKE2b-256 a0deed9a008a76963a0902b92287826b79878d43b2ad4212d882865dd048e078

See more details on using hashes here.

File details

Details for the file zenroom-3.16.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.16.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 de977ac530b546f114e50cfb8db7591047b6918dae43fd6385610d25071d3fb6
MD5 5b24b3fdfeadc40a69b9ec2b1de8454b
BLAKE2b-256 7a695cf32012d20edc491651b2d52e3b178a3228e8516d0591023ad64f5ee275

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e7216dfdea345cd52a1f8335b96edeb679342cd88e86cb5d16d7a2fe9b6dd2ec
MD5 87ec552476297d78bea295d4d8ef1203
BLAKE2b-256 01c285f3865f919a8b365cf7a43dffa3f85f0389310056a3576245af6a2ef45f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d9d77f7206d0d9ba65e4048bd248ca22c14813a5514cb5e082c5e8a3fc45eb6e
MD5 e3af6fcd8d8d8071dd11b19c2b377b99
BLAKE2b-256 e72d1a31094cd8c63becfee05a965471d4916b6b77e14a4a51abfe0271eb9cd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6513e8fdf13d29d3a6039fce027659fc588864a4dbaa942887a0d6eb328ca3de
MD5 231770670a2eaf675d67375311837f8f
BLAKE2b-256 9dd7a5ca425cf81a26040efe83803565d0971cc2656ed15401b24ac9bcf19a0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 f8844fdf1f94d7fef36da6a9ace9b241832a642a482ebfc53e4a72917d75a74f
MD5 112006a6698c5eb156783415e4332b5a
BLAKE2b-256 1e27f5c99ef698f922e57414f6a62c1f20eb9d420c585227a5c3e5e3af2f7f73

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