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

Uploaded Source

Built Distributions

zenroom-2.14.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.3-cp311-cp311-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.14.3-cp311-cp311-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.11

zenroom-2.14.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.3-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.3-cp310-cp310-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.14.3-cp310-cp310-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.10

zenroom-2.14.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.3-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.3-cp39-cp39-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.14.3-cp39-cp39-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.9

zenroom-2.14.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.3-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.3-cp38-cp38-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.14.3-cp38-cp38-linux_armv7l.whl (877.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.14.3.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.14.3.tar.gz
Algorithm Hash digest
SHA256 466458c2be1347eeabf4e224ebc3e552580d4791265f003cad6308611130cfb3
MD5 3d03dc8a8726d0bb67e3997c4c51405d
BLAKE2b-256 987223c08cea24758af27a1edff1037487d9ac7ea8f773358ec28895c3bbb3dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 43784c78e3e854d6c24022118b6737cee033070e4aa8cae62b44c83690deba02
MD5 fc04e113d49226d9461fc0f179fb7b16
BLAKE2b-256 b40536e48bf190786bb1c524bffafb1d582ad2a49c6fa49a091193bd98228b21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 89e1cb3d960ff3e4ddbbbc116b3935b4f8f886b52e90292aeae038929b691773
MD5 332c11ddabe8cb24cfce2b5b7ffda696
BLAKE2b-256 7401e87fc295d437ece2b7c873f2cc4e8d36860c8be8bc7d74999fdccc3d80a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0eced2436b95bed48006a3ae3d4d2a0503205949b7f2e6b0715acd4cd83ec8c8
MD5 ca933a874bff1a7000445233a8de4ab1
BLAKE2b-256 18d0d4f5dd912414d346ed292183bbb36ea2d52bf0cb26289e9c01a2b2bc6d97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d01f951ab7ea87070fd1431cc5f7e07022c6d43ad55c2dd6978bb21886cd10fa
MD5 f1ea7504e9e3fabac5594b7b0e200299
BLAKE2b-256 9fde34150f0ac98a8a67f3cd9018b6cffc156986d3c5670003a8e2979d00217a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 e49aea6ae2a662eeb3af3ffcedcd88f42f3a4d49e587cebde475036f67a4e6e4
MD5 2db9a96e23956b3f3761d763d5cde6a0
BLAKE2b-256 a015a750cae2b9bc243606641201fcfb6645d5d222b3021af9deb624a94c1af0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 65d1bf779f93e02a7757cc45bd6aa7c77a40b174f5d750f19c78a8faf587266f
MD5 83eefc3763dc554122f6e70a30f29a3b
BLAKE2b-256 f1791ba8b123ea48699cea42c0fad40eb784e9b7b02dfd22fe3f03e4779d49d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5a7795464b5a811b3364c8ca57f6b8ff60875672c577a21aa2b354306a787a06
MD5 c4d01d71bf75a8b60808d704120230e0
BLAKE2b-256 4e4d425c557a5a5b0e6f66200815f8581b98dac19073548d4e19acdfe6a623e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bcf632cca998fc678c796da8342dac9d20953351e95bcad56d265fe13f9cd0ce
MD5 90c31b1214f01e745b98f2c1baabedb7
BLAKE2b-256 6bb0765242da7d7c7f468d24689640def9b17b25199e8359fae7ead6f2b6e288

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3c041689a3a2f4871fc381a15d1e078c79e84d4160cceb8abbabc34c6c7cee32
MD5 e53abd7095f56b64a90878889987afd2
BLAKE2b-256 1d8250042fbf858ceae43b19f004de417f671b2f63bf7c0459da147886b6f8c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 d61c6d73f2ed89d428a3797ef1cad85b85a217bcb93db6f4155084fd98446f1a
MD5 02e3ecc8a8e933ab8b81797d52b30370
BLAKE2b-256 33b718ed9b47f45dcfe2bd2118b05b75f232e681529ff5977d04ce94b5114c4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 425818f481c0954628a195f00e25e6c943ec736eb18fed25716c8411a09961ca
MD5 73d5340ded8bed97bd8647733c8a065d
BLAKE2b-256 38dd0c8ec5d5a4baeceb13ba774ec324e096cce7e3cbd79c99074c94c9a5adcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ea58129b00748df407b17cc6f690a4b74e11c6b7f9733bd2085896289b7b9cd9
MD5 652be7abc9bcd4e8389d87204dd0e7e1
BLAKE2b-256 b03858c7184c3e5b306733f9da920dacee99296cce0a45e9c5cb902e30666879

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 87167145c11455dd224176d4ad15cbb7e9b68b741612e13fd7b9f19d004c62aa
MD5 b8c6b29adfe4474de1f68a3bf342762a
BLAKE2b-256 d46ffc204d831924caaa4464832237097a53c7d88f61e0f6d00b08155edb638a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9c3ed11593c5be28d1dc297857133a8c852380ea22d6cf7a3b4978030a0a6a22
MD5 8f3aa490f6425ab9a1c44b1193a5eb18
BLAKE2b-256 a7bb0f90a9bbcfdf17a29888fa60e05691c677442f751dc7c668c2d3b4ed2b42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 f05f08c858ccd02b4360da468bca6a9efbebc95c935c4992e259090f6f53c3c4
MD5 a15315539d498d4eb46ba471ff1cdf5b
BLAKE2b-256 78dd60bff78bb3026aff0b0999bb383aa71b0fd748eb08b97dc66ec51316c6b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 84b8e8c564e1183798c57e3cbd66e1df31bab66e1d44d0e8278410ba0440eee7
MD5 d0f78bf4fb4acfa27eee0449d919f994
BLAKE2b-256 32dbf6983054e88d69264e7e1eff62a2fd31a7be5a3d499aaf7c06288da76311

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 fd32251b9de128d120c91bc799471aa6534f69a5a437f842b4eebb4a25566573
MD5 56af05095ffe571fdf9516532fd5b305
BLAKE2b-256 3735ab06c1d67299a11c0214186010ee95f4b23d14f57ff7c223f61d8303f82d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 45ef07de6baf16f181797212adf970c43b2a1ecb92877ed5a3b48da5873c1034
MD5 f3c899f0ac95139235e2a170092eee6c
BLAKE2b-256 90f9bf39192dea8be819ef1491250d5667ec10d7588649bcef7cd878c1a77d13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8b0875c5137c49e4abe8fcbd845845711f4728aca44911d4890784fd5c6f8f1e
MD5 857f62a58752d5b21d62d0fff7ea3b9f
BLAKE2b-256 ff649d51a45123bfded6e02de6733ea6c70a3d5b6645ef45b6510cfe5c3987ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.3-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 3f3ec974cf3d612eb117805710ac8bc8d725e6bd8973fe1102641d61cb7c32d2
MD5 b37ac6baad047ecba7087f873b2bf6de
BLAKE2b-256 b2accd35bace7cc6808ff7145e89f7497ff30f328679524d1253560910353148

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