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

Uploaded Source

Built Distributions

zenroom-3.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.4.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.4 kB view details)

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

zenroom-3.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.1 kB view details)

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

zenroom-3.4.0-cp311-cp311-macosx_10_9_x86_64.whl (652.4 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.4.0-cp311-cp311-linux_armv7l.whl (775.3 kB view details)

Uploaded CPython 3.11

zenroom-3.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.4.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.4 kB view details)

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

zenroom-3.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.1 kB view details)

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

zenroom-3.4.0-cp310-cp310-macosx_10_9_x86_64.whl (652.4 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.4.0-cp310-cp310-linux_armv7l.whl (775.3 kB view details)

Uploaded CPython 3.10

zenroom-3.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.4.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.0 kB view details)

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

zenroom-3.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (746.8 kB view details)

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

zenroom-3.4.0-cp39-cp39-macosx_10_9_x86_64.whl (652.3 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.4.0-cp39-cp39-linux_armv7l.whl (775.3 kB view details)

Uploaded CPython 3.9

zenroom-3.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.4.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.4 kB view details)

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

zenroom-3.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.1 kB view details)

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

zenroom-3.4.0-cp38-cp38-macosx_10_9_x86_64.whl (652.3 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.4.0-cp38-cp38-linux_armv7l.whl (774.8 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.4.0.tar.gz
Algorithm Hash digest
SHA256 8c281360f62f5a8caa451270a8b867ac131fdd14830f8320bd010b4380955741
MD5 97633d21bd60be84f63ce0034893fa7e
BLAKE2b-256 6123196d3cf62da1ff7f834425eb1b5da252bde8b1dbeb03bce72000929e4954

See more details on using hashes here.

File details

Details for the file zenroom-3.4.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.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f17a9d285a62e3b73fa0541b00eee9f3b244f0a7b94609b1927cd03447409619
MD5 17a5a89e167e03334f0432074f85c8a7
BLAKE2b-256 4a5c5cca60d6213a6eb8de7edde805f0b9a21cda5754b5384562f144f0a58380

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b2a4d826d5c197b133fd988716ad162cfa3826aae462d70d74f14805da669b3c
MD5 bfe0c497bcfeda87b0cb012f3b90b9e0
BLAKE2b-256 f89a201661bd1dae123463deea6c231fc0f976ef4ca43b11f72585056002becd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 96e126342b35ac7203a2e3883fbedb2cb617a5a93d48207661df5b60d766a26a
MD5 00ba572867c271bf4d0145e87a8942e4
BLAKE2b-256 77fabc8fa18bc7663dbf717b795485af63de85bb1f4fb29717758c27ff5eb749

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 179db2da2d352e1191c511d3c9e044ca7ed2fb50028117019c3b087c9454cdde
MD5 e58be42e344fad4ab8b3a9bef4077607
BLAKE2b-256 b7059ba607c90b12b3f367100901013f90a8687d36893fcb7f24d5042604fe69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 5045f46251b420a22fdce983fbac538cf806bf30f5a1edda78d92fd0e68e7882
MD5 35c95c37a86f062b823427c447ef3b98
BLAKE2b-256 330d443ec315ea3b9bf1678448fd2038d9276a040e1e9fa4a3446bf414f1d990

See more details on using hashes here.

File details

Details for the file zenroom-3.4.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.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e7f9772813d46c23da905677b58f81d6c3090f13f719a5306352cdf2c955e4a0
MD5 868a2c9163b6a889ba6c51353b969f2c
BLAKE2b-256 a9011224adac27912ae97172d5d83d9aafb06268d8ba1eadf8f8b20b26ecf1ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 944097c86653ec72aa75abae219e4364ace570fe7c0a615891205f32a130e3d0
MD5 106c6184d714b180ed60a3a314f618d9
BLAKE2b-256 a03429a1e6821e0007377e3603111fd41080af607ce2e2fac7780dda24bf22f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 cfdc9c791eb5c24df93635e4cfdc94d7a5a56da128545681a03d0d30433cc108
MD5 343691b4d81ee51397487b67f397bf7a
BLAKE2b-256 9e680a6fde0d591aa3db2f70676283377ec0f16a8aa7d11e217634fd11c88b43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8b49b362568b74eba41a55ee217008c58301244dc1aa5c81996f354fd0626f05
MD5 2abcce781f6d09acae28812982106f53
BLAKE2b-256 891b6ef9956a475ec038bcfb6b663e14bae946b3c77460d5bae66fd1c34daf5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 79a20ca54c72d1ad5b22fd855c66fd565879fb44caded9123530b4bf90629557
MD5 596bc768c9ed508d0286c60f52b45803
BLAKE2b-256 39ad2cb359f9f5104c18469b2908654351e520c203d6b07c2717362abfd9daee

See more details on using hashes here.

File details

Details for the file zenroom-3.4.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.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b4f93f92aec5a40cfa8dfb440339391e62430a02e75077659d18e5884ea20e03
MD5 39075e034592d79ee6e961df5d131488
BLAKE2b-256 53ba820c041c5f9f784f42e1a1d323b556a95a4e790ec305b7e1d121015ec0a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2b4105201f8d13d9f25543e954e36dfb66933975b237dc2e7c819b4fce0edf5e
MD5 6b6f6b2bcfaa7132a6808db86950e38f
BLAKE2b-256 90d260221d10f12886bd7181cdd78377960f720e438a0c8dcc43c6b93455ffd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 15a2142193fd504eef8171c65641ba9b1a7ef157d5b337184a8a34ee7963f2ec
MD5 3ad867b14a44fa0c8f151055ea9ccaaa
BLAKE2b-256 c2600d092cc775337df892a581b53689dbdf745e967593774724901966410253

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1b0199fc08b9298c3bff8ea13c878233e4f828df3adb21dfcd972e4b4c026273
MD5 1614be6d9056bbe5654d06e611a3a11f
BLAKE2b-256 af896fa9c2aea3be48b773044646971252064b0031ec536d226a781f160f4e6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 d7c70cad521ad51c28a014054342393c1b5fbf307fee0c4e182f24598a9d09e3
MD5 062cb900c73ab4a05c14a93fd7c51288
BLAKE2b-256 c2609d7f2930697204e208b3977d54ccf7be8678ed69abe6b1318c67f25ef672

See more details on using hashes here.

File details

Details for the file zenroom-3.4.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.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 8ca2616102f341581acf0e8fb4a907ead3c2085690ad2e0a0e73e306ea64777a
MD5 6ad8bffb71190a750bd99be7beedf834
BLAKE2b-256 60ef2c0355ea1c3391a3bdf2a940ceb2e98596fc6753b633d045df7ee27d309e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5e65c6f8b0d93e0ea4874241e65b430cef20fe4590a33391fe5892516db33ffe
MD5 9188fa97676030f863ac59b84f3354bb
BLAKE2b-256 32713b924549c3c7692c0074e86ffd2f1e2878acd6e2260d4fa315345e0f9e59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 950792c1f7d11cf78531a8cdf339a58a12ae9b72f70eb9d86bbd6a9e90bbd5f5
MD5 3a80fa2b30fe985b508c6658af7c4f12
BLAKE2b-256 b6ae675a35564f63701b0349644b0ddedf0fcff5fb419b117b958cf948633fe5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5aa5a3c422dec5a21718a95081b044fb670b89f38cc43bb029ca04b1caedc992
MD5 d122c77527c36f13697b317bbc09eef2
BLAKE2b-256 1ca4e1bd420a95c780706ecb0f728b357572683d9b36ec43b15839ee5a812de3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.4.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 5e864f414206d9617bbb513b33a096fe0cd050e92b2e94b0df3172518f347254
MD5 51db4fe64e5088da15948d7759316a97
BLAKE2b-256 404657c89ffed4574a3b4dffec7a2afc497ae567a63154926028a0ed65b3ce0a

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