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

Uploaded Source

Built Distributions

zenroom-2.20.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.6 kB view details)

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

zenroom-2.20.4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.9 kB view details)

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

zenroom-2.20.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.6 kB view details)

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

zenroom-2.20.4-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.4-cp311-cp311-linux_armv7l.whl (878.2 kB view details)

Uploaded CPython 3.11

zenroom-2.20.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.6 kB view details)

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

zenroom-2.20.4-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.9 kB view details)

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

zenroom-2.20.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.6 kB view details)

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

zenroom-2.20.4-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.4-cp310-cp310-linux_armv7l.whl (878.2 kB view details)

Uploaded CPython 3.10

zenroom-2.20.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.6 kB view details)

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

zenroom-2.20.4-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.9 kB view details)

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

zenroom-2.20.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.6 kB view details)

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

zenroom-2.20.4-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.4-cp39-cp39-linux_armv7l.whl (878.2 kB view details)

Uploaded CPython 3.9

zenroom-2.20.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.6 kB view details)

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

zenroom-2.20.4-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.9 kB view details)

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

zenroom-2.20.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.6 kB view details)

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

zenroom-2.20.4-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.4-cp38-cp38-linux_armv7l.whl (877.8 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.20.4.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.4.tar.gz
Algorithm Hash digest
SHA256 a0046e61c6fc73005f17b0b7a9020f7d185580238fea758d8dff11aaecd3c85c
MD5 f06d813cec063c4bf18707d1c700f911
BLAKE2b-256 45803ee4890257be3fb043f491ae08a1a112f4a532f01925fa214fdf3653e43a

See more details on using hashes here.

File details

Details for the file zenroom-2.20.4-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.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 47c7ed0900250e9ee3ab49e609807283413c2cb5f3a73fa2cca5c9ed4fb635bc
MD5 a134ebb9229bcce0af537f1cc1a22dcf
BLAKE2b-256 7d93e106325658a84e1f17b84d9dd16202beee1acb5104e74f4ee87ac1597de7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ac65f02057bd129dbacc3df724c30bc5543c419f1b7d53dff019ea41b8be0302
MD5 dc52a348ec9c8e962eecacb4591bb8fe
BLAKE2b-256 5563a61d03a3e5f9b814fea44a64db6a1eaad6342c91a0fc7bee5c967308c15d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e1a9ed886e3331a5a56776d1a0f0f99c6b6a0d278bad90cab0060541c925e101
MD5 cdce0cdecdc37e4410960d0bca7f4083
BLAKE2b-256 71136ce9f79e56c731376f5cdf6cc1032d306729b77636a2d4c01640d030dd52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c92baa6ffa3c7331f8be4fa3b279fddb9a4f7a453a6bbd628ee8548a9ddbe536
MD5 0c4c0930f8956e08d3059725093acaa8
BLAKE2b-256 bf3fffc353e5ff4e467188cd09d8c7ab126e9c7effa3bcf47c82f0c8d577b9a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 4765c91b24b02aab03851cd8c5aee0ab2b43c91718c2de7bc86b022a407e2ee6
MD5 d579ee750528b4d746cd4e0a642b8200
BLAKE2b-256 3ddbad76b736c2ae4848fd1d34d6cd970e319db306feda984449414aea345756

See more details on using hashes here.

File details

Details for the file zenroom-2.20.4-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.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 674a336b366d1cdbdb448de6a5d58a927080b1f5070246eb0461cf74ec0d5c4b
MD5 3f122730433c2086b3d1b5ad67c75b6c
BLAKE2b-256 bce5d248d8de0bedb26d830e75001b42422eb8cadc084f8c8906ff6c5b0e157e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 dac55f1336be179c68a9e114b00919592a02b37e62dd94ebe21a81396e1dbba6
MD5 ea159057d56336f51313833e28d27f36
BLAKE2b-256 cc69d0686e09588b27748942d79075b9cb165c677d6cd070bdcb5a0e2fb0cb2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 aff3375c9f1b282102ec4b38317864eec74028e6f340f4607ecc62e208e91d15
MD5 783bac872b7311eb9163f4ab553beef1
BLAKE2b-256 4118ec455e4d80206755d2ad10e786353d79e2fbcbaa70340f45ca3a301f5c78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ee2fa343a46d390bb1e1e9c5fb9fdbdc8ad5bc1cde62c41dc1ae0bb740cdb781
MD5 49c7bdeb31538cd7203bc55c85c70e3d
BLAKE2b-256 9113164d677c94862bd7c5b6467287b01facd4014c1928b363e9f5398fec64a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 9c7e7a71f69b4e99019519ff034fb0a97f8b0e156c4413c03c3c35e2642f865b
MD5 43a18519491b3971f4873fbaa4931298
BLAKE2b-256 a0f98915e64a942af685caa2a12f1629ad93ae883b64595d2daada80d220ef0a

See more details on using hashes here.

File details

Details for the file zenroom-2.20.4-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.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c29cb8ca9e522e73eefccc21ea776e83ddf032346c9755c2a715fb198a6adc36
MD5 2b7cb8386d5aed6a7650c6928cff8369
BLAKE2b-256 84dbcee68a85f9fba1e40bf3a1ea1da0d0f0780449d30fe79ef3eeea8c8a6523

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e1f55f401acaef740856e3dc0daa9506888346759c8b0b8882e7c534ec6384e4
MD5 7ae4fe0835e688d06a7a6271800581bd
BLAKE2b-256 ef72e5135cfb309f26b6356ac9270786584d24dd8fae5199c4db5f64d2c4e518

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 926a93bf8420be46059fd8a27bc37f4d8eaca86daeeff609aab4523600163bfb
MD5 74e4bcee1dc6a7a36ef4a9fe0c50f7b6
BLAKE2b-256 1ff63df7a367b53a5f70eaf0f43fbdc25adc701543e8f536cc4401c5d8ef0d08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4227cecea222acb8c8b52550d40955c9ee845c7f656da1ff275cdefc92597954
MD5 f97f8bf88e18b75e72b782bda24da0ac
BLAKE2b-256 b636452b31c6dc9122c10b6828830ef18b453973fa9ebf72a5c8bc0793b2cc07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 d96e610da294b92322cd5fe3960449b622a8ddd96d175e2e971b966ac2b551f4
MD5 bb4cd6d426394e99a7c844d349c85943
BLAKE2b-256 ba2d650fda26165df4f426854aab0ba46a2618cffbc87351831c6f5f4fa3c1af

See more details on using hashes here.

File details

Details for the file zenroom-2.20.4-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.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 eb64f908692e91c9cc9b9d2f16cf7669ac5368c465f027818a953355829228e1
MD5 7579323c7416af98c0771165a30f65f3
BLAKE2b-256 1cbad73641ea937a9dacc86799374dee1a23a09865295efd3cd1d665b172bdf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a4d0e13b49b0705f53e16cd1dda1e2eab7304abb812d3261aced8cd37841dd84
MD5 c8902b2209a5c0a021bb3da91fcd8116
BLAKE2b-256 59b94016830b9bbc13e130a1e9b2367dc9cf469961f119e893a947105e87216e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 88df5d986a00830d035c073ab22004a1951f101fc5be9f78452719af00fc030b
MD5 3bd5ec084b2fd12c9a652961fb5fd81c
BLAKE2b-256 a11a295e5ae184df104ddd2a6e9982e41e5362b22506a7a8f4baae78cb7b8952

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aa0d56064fdc20f1dc8d8ec9ce20c83fe778dd1e6ab03c15f1d347335929faff
MD5 5b3a009e94e5f2897d4ca912e72374f9
BLAKE2b-256 4e934d7d8a3f081fa69158da3c6e74de6fc1bf213cadb9b0689fdde14a6d6a59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.4-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 8f3d117f9586610724b549ca32962682e5e0b25d01ff60149b2fd24b1fd16417
MD5 f54cde556ad3d307331a1a6694cdbef6
BLAKE2b-256 26e6a8dd9790089f601afae3c24db7ccd8ff13ca002b3e3ba22b33d4076a8c67

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