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

Uploaded Source

Built Distributions

zenroom-3.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.7.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.4 kB view details)

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

zenroom-3.7.2-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.7.2-cp311-cp311-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.7.2-cp311-cp311-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.11

zenroom-3.7.2-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.7.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.4 kB view details)

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

zenroom-3.7.2-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.7.2-cp310-cp310-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.7.2-cp310-cp310-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.10

zenroom-3.7.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.7.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.4 kB view details)

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

zenroom-3.7.2-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.7.2-cp39-cp39-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.7.2-cp39-cp39-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.9

zenroom-3.7.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.7.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.4 kB view details)

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

zenroom-3.7.2-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.7.2-cp38-cp38-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.7.2-cp38-cp38-linux_armv7l.whl (775.9 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.7.2.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.7.2.tar.gz
Algorithm Hash digest
SHA256 f74ce713411550ae3d25d7b30befdd13f3e7b81de9f7a7f3f4eed7aa7ab79f85
MD5 6224a695c78a67fd4e921eb4396674c3
BLAKE2b-256 4434db41567c625079ff2df10f4116f7fc95c041a88e92d6690a2b3376d2db0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f5fb425d33907453d60bb99de9fe7e74c15e441d47ef87289e9a9cd71036ee7c
MD5 76ee703f5be813b561e7aec1752b3e6f
BLAKE2b-256 33dd9ed962c366fb5b9cdd22e7fc6af211b71669a07f68b9fb1463e198220709

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 4f7c2159b07242025f0cf2ade6c719bc20557091021e6fdefb6eaccee61bbd6a
MD5 93acec5d5251e59a5745ac35eaf36c84
BLAKE2b-256 c0d81cb249ddfcdfb50f8482c6700095b448a66b7b74c4f497dc24435193ae4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 067739ab4c39e321236da113e1cf072113f86ddfff351101ce9cad440cb42c1b
MD5 cc0ecdeab59630dbd666e51aab36acb9
BLAKE2b-256 b8ed9fd7c82773d3fc75397f03429e68a40469b3671408c0f9c3d9c51c8a614f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f5979c37d5b2f8e32eeb7b7dc36cef0a8f956d0afaea8e69d0c00942386b2dae
MD5 71088a330fd3858c401aea000e80bef2
BLAKE2b-256 0542974953b2c92b721c826a580c8d23c931061809faeaf5e28ed845ffab5d80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 f78c8f2894f16bf4cf3895b0763438fac4173f397068544ae341fc867ac68228
MD5 b9b273a113be5458811c3ce4fabcc69c
BLAKE2b-256 4144d93df953b3c515cbf85829ecb7286075fddb1173bf537913e0ccee4e3d7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b21124f0de8ef6a17913609d07923db21197582902cca710544ec5a8ff990ef6
MD5 8d15b31e7b240fbc6d623087ee206aee
BLAKE2b-256 72bd6c37d7b0acb818a4f3700b7bcd13a67514f90d7a5c5bc22c6832016180f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 958bac32eb5a51089363e4f351cc8e1d426e2e8224b2c7f5a95d1be31b6e2093
MD5 314d1aa3316eccf1f31ebb346286ede4
BLAKE2b-256 3fb8201bb955f12965dabfa9fa83b4a0053ac64e0daa2f2fac7dc7237eb07ed7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 970743028a1f68d51b592045a5fbe42a50b5e1fc574cabb53923379f7faa773b
MD5 558bf277a479373af3e919240d19fd0b
BLAKE2b-256 2f2dc8fb0acde4020ea1248f49398b3ccbf906e13fe3db7f6cea811f57b7c6a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 884eab12edc616f0de09b45ac699ae0dc18cbd1c8a084ebf390c6b11504b5ade
MD5 e6dae90f317dec3533c1d9256fbc0e18
BLAKE2b-256 fe33b3354c0b88c758f926a8aa51e112aa09b00837ee4c88019c3a1a00f69686

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 ae69b47fb76e4b1fb2b4d54a82b26da4a8d422a560d0eb7ddb58e21beef9d548
MD5 cad3a84e5ac4b5bb2021350235e7fd29
BLAKE2b-256 1a5d7d3761a269d23b11dcd9ead7ba2874b518b144f71d8c6d8b71f9e9acd61c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 12878bdb9f3920eb05cdcc4e93cf2923dac8fa3986d056cda237452ee3e1b14e
MD5 e2e29b3ff41dab36c6f22d29b332ad88
BLAKE2b-256 e0853a8ae17e8169f92d71a7255c1ceb03fafefae8007ce5fa0f68c271323d65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 28dbf7453abc1f5a20b1f97e3387cc3def49a0974ff58e171688dca719e0728d
MD5 9f66af145a3eb67be8ae64b9d925bf81
BLAKE2b-256 19b5defb4e67681a50923dd0d3bed53a7f703492e5ac3782ff76b88171dc4d13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bbc8c98b27517cfb90e1c1d060da763e3c11eded628713372ffa717f3ab8c269
MD5 8f8aa4f95e1beb60262a576e55ea57c2
BLAKE2b-256 4dc9ea28ec30ffb1242e4bf1bdaf75e0165329b77356097dd13518e6a1bf6c8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 780fb5c8e7dc12d5775306967b465ee5a164f19e31bafa31adda1f8fbcd286eb
MD5 b064806c06124c863bf5be17af6f7dea
BLAKE2b-256 0fcef7d70fd5ebe76f9019867f2de9519dcd82312d148b11457c3cd67a0e86e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 ec6bfc1561f6193aac73efff51ef927c14429f03d65e98c899503f1f1c0ce029
MD5 bac80d5bd5136efd2069070826c2802b
BLAKE2b-256 1e4e312a5bb217cd13d3857f1614c1723b46330a1144e2a92170099138c63728

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 743cc2dc90ab546a335377dbf62411e37c1d11f7e86d108b7538625e64b16a59
MD5 1f1a3fb9b830527d5c40ce5c8f7a6a29
BLAKE2b-256 59488ad96c546c8de6b0d202d1d63b479139fb13fb8818701fc6be354fa3993e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 7fcb7e6a6ed5ff75623432c71b75a5abea72bbb5f7cb7b885c8e4f600893dfd2
MD5 ea5948024067aa19a4cb03d6470c2464
BLAKE2b-256 224725089251583c315b268da5fd97259e9fa63f42c8f3fde108340f17ced28e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 2317f98c490ab23927e98531bcd69dbe6fb9dcbd75240ba28260040a7f4a252c
MD5 9e2040412248fdc95235e167b4489890
BLAKE2b-256 2c1aa931fe37974ec726e76700eb426d84e6bafa9dada97f1a81da4e64efb494

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 832ff307dde0ff6852b77898758382a747fddfe511061cf0481bd8ea621170a5
MD5 6b6c04d446861a93309a242dbeb2aaab
BLAKE2b-256 c67dbe512ee510700758421604532483afffe37d9b948bc7be13e72edfe00cc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.2-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 91bc9835868488a37fb0cd95155e1c06e4af329e5dfbfaca6e4ed810f0616dcb
MD5 cbebf220536aed4eb8c33263c8374470
BLAKE2b-256 314cf74865536d36eeeb12804e82a2d17f3c4b1940ff19408df5a00f0b19a820

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