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

Uploaded Source

Built Distributions

zenroom-2.20.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.20.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.4 kB view details)

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

zenroom-2.20.1-cp311-cp311-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.20.1-cp311-cp311-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.11

zenroom-2.20.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.20.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.4 kB view details)

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

zenroom-2.20.1-cp310-cp310-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.20.1-cp310-cp310-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.10

zenroom-2.20.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.20.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.4 kB view details)

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

zenroom-2.20.1-cp39-cp39-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.20.1-cp39-cp39-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.9

zenroom-2.20.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.20.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.4 kB view details)

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

zenroom-2.20.1-cp38-cp38-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.20.1-cp38-cp38-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.20.1.tar.gz
Algorithm Hash digest
SHA256 52074616c9c45699f1d7ee216d9c59b3880b22b784b75aa34c8ed06a85f931e9
MD5 c5eb8b22cf632c0a6468f63c2e8e9d9a
BLAKE2b-256 3ef57a2cbd9f3768e9e39b171c64c06efcc7094150ec05778fe2ff4f27c61f85

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0c868d3cb6611a65afff1f493ab7ebe2be313fe71973fc7e8ffdb3fa02ae9edb
MD5 6ca1afac6b1047579301dde62d6f928b
BLAKE2b-256 4d5e0b3d5e8eb59b5c6f0868d5bd957f66341b0dfe53cf100216facb6d79a095

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 72c623572f44ee4b790a395a0afcba441944816d6558313547ce11f7c527716b
MD5 0e5f8a9705e6e9eaa6665c676b4154b2
BLAKE2b-256 7a971861983468bc96f188eaf25ff0887eb9fa47d61bd7ed52ad3d0f2cfca3c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 7fabcf663771d04f09bc3ead76e246bbbd8ea6e0847e377d38586e6737831a92
MD5 890223dad923b491d8d3369c96bb5397
BLAKE2b-256 d08ca35cab7e8823b6c3fd9e6b36ad754a797e86333868473e5c2c094cd81618

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bc647a9011f04a52108afb06d8e7d871fd0f7a83b7356b1db1c879730cc1bb49
MD5 64a6d10753dcd82c9a42448e2755e1c6
BLAKE2b-256 ec3c1c6d89663e8900d59837425c0334e27d430d741cc79e61ab201674beee37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 2c70850e0445830c3e02ca8c1b356714cb57611d440e40b442e709ffbb990a53
MD5 9dd0b19a1a63594145281444ffa0e3fb
BLAKE2b-256 7907a81e123422458122b5d5e00cdb7f81253086e2a59a2958116d36499f43f4

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b5489ba9ab280e38c63b47fea816ae818ee8e5c5f8175b83e162031282e3eb68
MD5 c466e7947bdacc8d969f9c73f5a77aa0
BLAKE2b-256 049014ff58409240bd685ffb3517052a03bd25e78a1b25abbdaf0e6266414a65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f47492bc485322f7a67ec9b09ab0aacaafa109e2455c9e7556f9719b1b673059
MD5 c85ad9142632c97d41a026790633afe3
BLAKE2b-256 82195993cef70912a62ab363338d9d4086a8d29ebccafa526804c84623372fd7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e251a12e69b887e7adfb15d0cbd21f60cf40309010035f6b225b3901312508e9
MD5 43cc2975107a764d77a0d551cd75bac2
BLAKE2b-256 5f84b22c2311247285ee8bac088c73040563bd8716d595b9f8a8bb49bda4a4c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e12c52d917b81ccd0e14ca63f4aef7a3fa637640fbbf476fb77534d2c6ee4897
MD5 8dff23773446a1209f2cfe5222ac48d8
BLAKE2b-256 3f7de569c712d26374e3aedc64fb879eedb35a0d4311f7f03a046b5809ea739f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 ae509eb4cf94524ea87db01b4680f5cc5829d0b71b3af70078a0a50be2ec3311
MD5 01e08d0ff7dee922f24a4e1d4d9211b2
BLAKE2b-256 48ad96771613fda536d8f03fb7fbf3aed372c757711d68d3bce64311216ba5b0

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 a1113097fc0278d4c879451a1565e8a248440551eee596e5935316b9559e8fff
MD5 eff2090ed0c24ed85f7cb8ecf3fef0c1
BLAKE2b-256 2ae87210738eb48c0bc457f8b04a8a53554f81d8fe6d0b82dad8c3e3d2ae23f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3005e68c7767558e0670e55a463d5acc5fa190f85445804dd9d499b2d617d543
MD5 c6bff342436f857261ebabc6b9da41c4
BLAKE2b-256 1feb6ae931cd29a2a8374381ac2d9287230e063e074998d143c1fae4790718c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 4ead3f8afd0e6d069086e03a4ec4ae45917352818314ee781b206e1d22a75040
MD5 65ff75d8cd9ab633ec8b4f491dbd5407
BLAKE2b-256 ae41dc960ba684cee09f9c815dd52c3eae9a40c895df5ff54991ff83e705d536

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f62b371d5de7d0c2fd08ae6782a606943345f009ea860d3e6000e9b9a7f20b7b
MD5 a9c65fa27f132ecb86926dbcdfac23b6
BLAKE2b-256 36cad2445e0c1b01251095b4069395ca0e28387fb0744f2bed22e530a2aae3dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 cf182113ce3c7f4f0d15af4ec64d0edfac68a6536eaaad2d8de291d7542f15c2
MD5 027ed54a1477436340a1a329df88bffb
BLAKE2b-256 1740b2e4f3d9a07ffc184325732e71d0d38aad6b07f0688bdf58ea6e612472a9

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 6137afbf5c36e474564fa15e3d97bbac6b642be52ab8a66334baaeaa11615e04
MD5 7c87792e3fb4038ed5c81b1777ba3478
BLAKE2b-256 1b4ddd28a0e2071ae81fe46780a8ac61e5a57e8960b3deaf54726a36816f7949

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 948d9909796fe209c0a8047b573ad65de47026a84e1f952b2bd0f59592aad974
MD5 30adaebf592ce3b8b0da1d3148d91cc0
BLAKE2b-256 d5021a0974635ff95ef263268747f1244b35ee52b5ca97a5ab97e5e441bd994d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 9316384b8297c0a75ccbc190ce125e32e8f6bde93cf01a7ddf09db4c2193903d
MD5 40e931b19fe042275cc819d9a68b156f
BLAKE2b-256 16c7689c2abb0f08bc7bed4224cad02cb5c6add84f12939dbc411787c5e1f548

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5ce813aa00918636b3f0c14e13507b22360270444d494e483d0dde1b0247eff3
MD5 ba2314c323b2c02d68aa8c5a2fdb821e
BLAKE2b-256 66da368806fbe54667b04c9b62285228391f706afc03519168a460d8a7e7b103

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 f1ac2aa202196583d278a8f12d27cfc6699de2304595bc69bec2d8aca2b013c1
MD5 f75f85de9dcc5e373219ea04d9c26852
BLAKE2b-256 2d74b1e95ee53969362ce9fb76c0f34fab4b68a2b4c70d575e3126834655a7a5

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