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

Uploaded Source

Built Distributions

zenroom-3.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.8 kB view details)

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

zenroom-3.8.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.5 kB view details)

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

zenroom-3.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.3 kB view details)

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

zenroom-3.8.0-cp311-cp311-macosx_10_9_x86_64.whl (653.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.8.0-cp311-cp311-linux_armv7l.whl (776.7 kB view details)

Uploaded CPython 3.11

zenroom-3.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.8 kB view details)

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

zenroom-3.8.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.5 kB view details)

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

zenroom-3.8.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.3 kB view details)

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

zenroom-3.8.0-cp310-cp310-macosx_10_9_x86_64.whl (653.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.8.0-cp310-cp310-linux_armv7l.whl (776.7 kB view details)

Uploaded CPython 3.10

zenroom-3.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.8 kB view details)

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

zenroom-3.8.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.5 kB view details)

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

zenroom-3.8.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.3 kB view details)

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

zenroom-3.8.0-cp39-cp39-macosx_10_9_x86_64.whl (653.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.8.0-cp39-cp39-linux_armv7l.whl (776.6 kB view details)

Uploaded CPython 3.9

zenroom-3.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.8 kB view details)

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

zenroom-3.8.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.5 kB view details)

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

zenroom-3.8.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.3 kB view details)

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

zenroom-3.8.0-cp38-cp38-macosx_10_9_x86_64.whl (653.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.8.0-cp38-cp38-linux_armv7l.whl (776.0 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.8.0.tar.gz
Algorithm Hash digest
SHA256 329b0cbd72187be56b1c78afb8ddddab4efa3bd18176950b4a0dd10d47c37571
MD5 c5adcf22038e33ff7760f816671c89ef
BLAKE2b-256 f39a338abeb4a3c4ac5e251366dea7d38d8c492fee014147c2239dc1fe4f21fa

See more details on using hashes here.

File details

Details for the file zenroom-3.8.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.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 ab3e3571a78d0b76f0de64fb037e1b9d1ca238723655552b2c50642b79e3edb1
MD5 ec90af01a6ac9330d82455ff28fc58c6
BLAKE2b-256 04585544b18992be31f67300d769c4783d165b686bbc2ed3d5ca44ee26a2bb5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 8fdb878382572ea617f1eeea1b3606c6a89f3cd73ddd25884cababad662bd4f8
MD5 b86eddb5b93b1b5397c9a458b2c28aab
BLAKE2b-256 0f16f0b3b205fdad80b2fbe7f695defb8e183c1d697b026c548703fc9d04a483

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bd39c6471071f9a0adcbbbbf13eeba66249c0998131cc3f25cf10898c8708192
MD5 674cc6cd79dc180a80dea04f1bc743a0
BLAKE2b-256 3f04e978fc1ca47c8300946a17d820ec1faacee553f68ac01194eab6a0e21086

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8b3676da9bc405b783870d297a0c7fab751b243cb10c78a5dce62493859336e5
MD5 f8a84350e1771ef8d0d59b8a7f67b627
BLAKE2b-256 af0ffd3c386626bb5c75d4ee7e155680aaf75ffafbed6521183113020219d0e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 29ec9b5661bc44d6c9928fa67f84ba17d6dfad2db5e5a595d6a9371369083794
MD5 b6ef520be9ea7da7287c47b64ee2d30d
BLAKE2b-256 9aad79f6e4928506d11fcdf7672dd0cc160e05a61947e003a0906acb26983b5c

See more details on using hashes here.

File details

Details for the file zenroom-3.8.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.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b3c618ef8f631947d9de4aa08fc46d2ef79d71b8fa9568ce46bc605bf2d03a92
MD5 3092f93d50561e93a15fe9375a9e0af6
BLAKE2b-256 513061e07fcaad5821e4b0f9768fcf951416fe575149a0ee72dd6807e2af8751

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 8f8a22283cd9fca9c378dcf8a423179ad94b178511530dea053c9d10c6cb4089
MD5 e8259ae6f34cefa1cf8048de33c6659d
BLAKE2b-256 117376acc2ed7d34e3d519e9ee2f39cc28f04c0d4045a77905bb3f1abed86fa3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 454f02f482e116a9ad615f05701f0c74305006f45da684c12df05759293d6b6b
MD5 d8485e6c93dd0cf46e24c0c7c6a41896
BLAKE2b-256 1860cf76157e245c9f86acf78fe040ea1ae295e8c9239d51be5d15a5f9e6b029

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5203275dcabd3bd41d8a94f2ad0e0d7654dc81a03d7a0ed26be0cc7651082e5e
MD5 2045339e21e14ca2d936432b8567a0c2
BLAKE2b-256 839bcbfedac6e9e0d54a1dda8666e517f802bb4bf1163deedc260db4c6e9289f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 00f5991704419d62727b1fd32e9d4e2a2ff9cfb086b2d2752c2c01f66a6d6672
MD5 266c0a7c87da595644df4d0d4ddfc7fe
BLAKE2b-256 d0a7f4cd006cd71f5bd320cedeae8c18e6b4409b508ce4bdb7f8966b45903fbd

See more details on using hashes here.

File details

Details for the file zenroom-3.8.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.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 a0b603852a9cd1f396d80c59b938b35f794f575eb9fb1fedbb6bc11fb0525f79
MD5 b8e01dfb435ac48506c8383adcb261d8
BLAKE2b-256 609945bde3c955fedd299ce44d4a49f15847bfec9ab4a28a38412230f7c967af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b0ee1960677a6f17abac08c2c1680fefefae25492561675a6a0c68415b9ad0ff
MD5 7472e455b2507c03d571d6c5271efaa2
BLAKE2b-256 460c977496d0b43f50c2bd60a583e2916e4de5d205414e9d6a43c2b2852f9d4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8f5ad912b8c6086c901bdaa82a30c91806bf828a26400e6d95b8a33f96f8992b
MD5 3d89f95d838d08e27b1659ee76d76459
BLAKE2b-256 3f4ef5820867ec1222e099173f454ded72c1e50b081f2cb2a29ce5fbb4dc01e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0829ab9ae74076c68f9e40790bffac6faaad6fb059be1736505f37fac109e36b
MD5 91bb900421325ddbf9536b24154005da
BLAKE2b-256 d535775de173e498cd4d25ac5b5c17b9e341bf5934325f16d52b8ae1699e334c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 a9fd5929d8444f53454398605e16fbf4c24ca0b8fe3c79ce284cf8446a715881
MD5 de744a44d822176070573db059510ab9
BLAKE2b-256 d50b53070ea30d0200f281b365c0591a3c948fe7f55d4ed14c8cd80533fa5b30

See more details on using hashes here.

File details

Details for the file zenroom-3.8.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.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2d6a2ad23ed59ece800d1f468d24374be1bbb3654698659374be5ad0a5a30e9c
MD5 025681e8726852c266c73a9af1b8f570
BLAKE2b-256 8eaf72c6bc01413ec1ffb4259de0c7e6546471e319650f160fe3bc936b70641e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a936e646398d9cc6bd8990ea7441b97f7ac6fc2ff2a9b4c9a2fed669f190054e
MD5 e941a4b1fc2158e5d1bc61b1d5067359
BLAKE2b-256 1ad08aa3cc9de93702429972fd7893637a027ddc1e87db38b59d329fa88b1ffd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 551f5c3d537d864f97d1135d2ab964a50fcbb8828c79f69760b3c46e9c4bb609
MD5 190fd0faa65b94e505dbe6bb8c6b3dc7
BLAKE2b-256 dd0e1097b88adee80f993a577af75780ed1e997a31581a802be1d4296b543214

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c7a4c04f3e6142b47327eb812bb8ff947bfa902a4b56953127a414f52f4890f1
MD5 674c9dfe4a8eee042687f844f526d23d
BLAKE2b-256 d4bcf632a10a9b08260c180a7559495196fdeba98073a5e86a42d43c1aaeb2f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.8.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 8a1e45b5b435290880ce887056308503ecd669ef9509abc70a5f4446e61ea419
MD5 f9efcaf53461b50f2b03815b65f3ab69
BLAKE2b-256 498806588d64c79db74c5c9ed7383f85dfeab8aafa2b532df5e8fc0ed4486f6d

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