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

This version

2.7.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zenroom-2.7.1.tar.gz (82.6 MB view details)

Uploaded Source

Built Distributions

zenroom-2.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.4 kB view details)

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

zenroom-2.7.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.8 kB view details)

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

zenroom-2.7.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.5 kB view details)

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

zenroom-2.7.1-cp311-cp311-macosx_10_9_x86_64.whl (777.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.7.1-cp311-cp311-linux_armv7l.whl (876.0 kB view details)

Uploaded CPython 3.11

zenroom-2.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.4 kB view details)

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

zenroom-2.7.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.8 kB view details)

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

zenroom-2.7.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.5 kB view details)

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

zenroom-2.7.1-cp310-cp310-macosx_10_9_x86_64.whl (777.2 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.7.1-cp310-cp310-linux_armv7l.whl (876.0 kB view details)

Uploaded CPython 3.10

zenroom-2.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.4 kB view details)

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

zenroom-2.7.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.8 kB view details)

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

zenroom-2.7.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.5 kB view details)

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

zenroom-2.7.1-cp39-cp39-macosx_10_9_x86_64.whl (777.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.7.1-cp39-cp39-linux_armv7l.whl (876.0 kB view details)

Uploaded CPython 3.9

zenroom-2.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.4 kB view details)

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

zenroom-2.7.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.8 kB view details)

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

zenroom-2.7.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.5 kB view details)

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

zenroom-2.7.1-cp38-cp38-macosx_10_9_x86_64.whl (777.2 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.7.1-cp38-cp38-linux_armv7l.whl (875.7 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.7.1.tar.gz
Algorithm Hash digest
SHA256 1db15e7fe7bfd4d29bd431f6c41e9d222be612d3c44cd0246eebb6fa562bd98d
MD5 8583d687d9a12ac810cf34560635c6be
BLAKE2b-256 91a9d40a3c24f08ecfb4db8c23a003685c988dad8d0c9a8a9d0427929f69915f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d2d01c7ae22530363f2a6fd925fa44b5389f23b28758034f517dcb63c4fe1bdc
MD5 8a7a47f04888375c0c3d5e04618c1657
BLAKE2b-256 bf84517e37424a30a2baf8692231ed09e8865baad84ebf2654b7fc90babeae83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 55da9c8ee40f5ce9030a40d0a4a6a66b7c20748db5e607962c5b54fcbc590672
MD5 1474f3ead3ebc597b67fa5048c0132d1
BLAKE2b-256 d9df9b71449a32665e3539c5588ebe6d9fb979e42868d5b3a03c69d93eee3ae5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 9bdff9062035719fbfd65092c0d5b180b9723634bcdee9c40aa7fe39fc3bdcb6
MD5 9344912cc8afece62d24f9394fd52791
BLAKE2b-256 52d6d97b94afa349e01f377fcbeeaddf24ff7fb24daed70284d8d2bffa94977a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3c205033c6dad51e680f03281aae767411783ea2038c5b20a1d9d032c246df4f
MD5 b42c404bcfc484c1c71d2aea6cda14db
BLAKE2b-256 63945ab93800a77ded5476f782222eb8b1383aad646065235c16d41e6be114fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 e2d37e2f96c2949ebf2124e3b2fcbeff7358b23b29d3cb2ae968bfb8ded49861
MD5 ec94f22e652fb4b547cfb91a4e3344e1
BLAKE2b-256 a54a5a706763a9bc172beaf9f5dab6fc1ad169ada974b421d8ceea0fae7008ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 97e56274ffca2e3e8032628fba920d13b673e9bad627982e292f898de495a430
MD5 ee47134464491474588acdd43b1f9a6f
BLAKE2b-256 98605c808115f11e7ee72d43e6a22d2b57c44af5b01d1b54ec5a0046017ce4a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 6a345e36554d343ab003e9887f70ec0de25ad6ec2a45134908c751cee908f20a
MD5 235cf8d25436f9e2dd9a047a3450c569
BLAKE2b-256 092284e8edd7683a81d61c89697e3a03354d614026fd631eaf41037b106d5883

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 a4581ce918339370c331fcd9d86dc78b72885173f9dbea31fd9cbc18dc2f5870
MD5 1597bca5e78d4b0ce8fde3a3206ea601
BLAKE2b-256 ede205fc98242b5f45008fc499f8665bfc5e13cdafa897299a4a37bed10011a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5cb1a59f2952fe3f38c4f8c6a52383d28542264d0216e1111a1f8ec96e760127
MD5 1f01b9546743333ae495edeecb801419
BLAKE2b-256 8a0939196f04e340ce1c12a618584faf43c1ba5ed39e813714e5cf5bdaa03397

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 150c86b80834af4937e2289706086f80e0d8d9e6d733185843cd43db6e0a2f92
MD5 ba2208dc9d85ee8e0cfc95532395765b
BLAKE2b-256 bc630798d6dfeb1b3eae1a67a46cf6033b93caa21b411a1af87e4dd2ff686358

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 8cac3e52e095da6e7b570c8661915e7cf781653937847a0b8c8511bfbd0e658c
MD5 57d91f8bef5bf736cd3be9c25f952371
BLAKE2b-256 a08aae9038c9970aa76fcf34cd965001d42d67634d67011f1204b3ac559a62ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5a7c2b872f698b790e9bc295628bfa4d2b1d4beb19ff987f52fb932244f7a3de
MD5 cc5b0bc24649d0d656a6f39536811dbc
BLAKE2b-256 a6acbf20dcab817e06dca2022c4b71758d1d58f61292996cf00cfe9b7b7ccd8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 433960c7e1ca1adbef45666da5b1a0921bedb96773f0758c61a6ae15c52f54f8
MD5 5c101b608d5ef3f4906d7b0ac91ede7e
BLAKE2b-256 2278013d615384840dd72faafae5c8f4505eada07097213938d5ee4a95235af6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 489748b3eb01fb2a0e91ff7a13b0766840e8b434f1855518ca79e1ca006cfad1
MD5 8d3ac2ad6f72cc7ced58fc95861f9e61
BLAKE2b-256 008fc4a3ffb7279bbdb7ebea92fb1a1f9916928209bc6dfc28005bd4f456be7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 e01ca335b753023e4c60f7ac569cc543a1e2d33476deeaa79f080c497f6b886b
MD5 721b8dc957e38bf997cd0969210f064f
BLAKE2b-256 2ba66edf33ca439c42fe3562376c582305c59e6e9e607f55f28fe5ad3c3c0df1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 17c15e6947c3028d8c46bd116196496c22404cb18dfc1264da5779c35eafdc62
MD5 2b60c747364fdb97eb5f96bcd51d37b9
BLAKE2b-256 758166d80c35363921109ee36819b6dc5032b551ebabee2f8ae4ebb42c88c385

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 4b2c771ec9de1967f68963a38eec8aae42ba5ee9797967e6e7e9a01183e32ef9
MD5 61fa28212f681eb03e736b8a20408550
BLAKE2b-256 fb8d3221d29f66633be4c5a6546d2691af1d073a1679b6e2811e082543ffaf76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 df236395752888f3aac14f737718fb26f8854b7fad362bdd882dd6909f23c471
MD5 ee12873d2c8e1c79de35cc8506ae522b
BLAKE2b-256 f2878c87dc7c5c609c55a20e1b27083f3e1b40a7a60b5e229aa694c265cb4cd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 820bec4c20400e27dc76fa2f7b975902a1d78a8954475c25cca9efe92562e594
MD5 a627ee0eda6655b4203dc668681ee41e
BLAKE2b-256 dd0f9190fd20e58527dd767364023a3abed37c9661a2780ceec32dd8180d9a6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 6c39ff349daff8dd872ffcd636e5510fc8f9e5db76b13751a3a7c924ab86be78
MD5 822030f0bc793a5e35e6b035d2c8f3c1
BLAKE2b-256 37b62eb811957ae6325b749792cc11b522557dc086a340b1fbba9a273221733c

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