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

Uploaded Source

Built Distributions

zenroom-2.15.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.15.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.15.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.15.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.15.3-cp311-cp311-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.11

zenroom-2.15.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.15.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.15.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.15.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.15.3-cp310-cp310-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.10

zenroom-2.15.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.15.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.15.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.15.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.15.3-cp39-cp39-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.9

zenroom-2.15.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.15.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.15.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.15.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.15.3-cp38-cp38-linux_armv7l.whl (877.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.15.3.tar.gz
Algorithm Hash digest
SHA256 b1a84e8f13ebd08cf46c39acafb8aa7d7c174ce84687c1ec0bfbdc51f09db9a6
MD5 581fe32459460694e855003566d23410
BLAKE2b-256 d871fe577b5d743bbf19a4e328bdbe8b9c81b1e94b67d93156f092ecb2608f15

See more details on using hashes here.

File details

Details for the file zenroom-2.15.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.15.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 819e631ae2703b245f4ec9e59ce7f9f5cad8b42eb1abc04bdd835201623c5069
MD5 c77b7e6c2826324867a377e986698233
BLAKE2b-256 bc2b110cbda94255221abfa520c92697f6a36c783dba66f300ab9f6647f741cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 8e60c27f7298c60b4e5f8e97a855bb1dc2f7cd54adb374ad489c4e524091e79b
MD5 ce934776fc973eacde02ede7a0121877
BLAKE2b-256 9b17c4968093b8d99b5c11ec3ae8e1c9dbc5dff1c73384e555269ebdc3685965

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 67ea68fbb05d52527ddedcc3308d50e145e7b473e0e4189a8399ffae53cf6e50
MD5 75ba4be0320627a27c15a38f1b1f2548
BLAKE2b-256 b9af8225df09f9ca2986e25e411a36336a8ff0e12a45c2a51e3481a8cd326fa2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b367ec651a8b2070d66ae6c3f680db5bd980573edd134abfece0ce7c235f316d
MD5 8ddbba708aaef43f32a51a1b41904c83
BLAKE2b-256 df18637bc113d8309c402d6caebf4857d5a53888bbbde8950e7216c9ebb72b79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 26a1183c8de2230a80ea89990666e4c07a052af382848624b20e188db672572b
MD5 608e79496601e3853e6683a9c75022a3
BLAKE2b-256 03191bd8b030961eee0e8ef052891d3d81a974495bb79ea18c3bb6a5f52d726b

See more details on using hashes here.

File details

Details for the file zenroom-2.15.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.15.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d565fefc14af12544945403556eba2f9ac1ec0256b4c15b6dd33911f15b3810f
MD5 6af00fc138e73c635ed5b2a5fcc6b0a2
BLAKE2b-256 998e9d2dcb68747162b2a07046b1b4cc6b33e8e3c6f4d5fb6717773fa673b2dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 fc34f72a579a6f241e9861115cd4400df2bb09f93061c9069f094bffd2ef769e
MD5 b1c30daaee81c030a5176efb8d3a909f
BLAKE2b-256 5415f9f094b126acde698eb0561b9c7c046f606a75011e196ff4ea3e7b0e28a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c11c9b1fe18985d2d395bd81247572863f6a66122c0e495718bf07b275021c5f
MD5 80a33368917d8a230f6bdad76e73b33b
BLAKE2b-256 f20f06cfbf7fc2709b03c4e38dade027e780c61b64fc366495af71bed53cf53c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 234e7747d1155a466e1ac29f14b460db404b2d746d97f48bf7e8f609f0a0aee0
MD5 a0ad55a6f8e32921525cedd811eb1280
BLAKE2b-256 843548bfe2dbc89136622c0261649cae188c790e4efb86aaa73f090c23230bfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 6d4b2a6fc5bfa181c21fabdbd891d901a936ce7c1de31859ae30c866337dd264
MD5 c8daae0fe6bc01b2929275ccc6373fed
BLAKE2b-256 1c6192ef7952a9a5d3df496f47734493f9ee14d23a4d5f7a7b3d00bffef163d0

See more details on using hashes here.

File details

Details for the file zenroom-2.15.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.15.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 70257740f63f3f0b0114987ef3973a5fcf0c6f8eec31c71504d77757decd887b
MD5 a93f318695e53981c9657ca66e90ee4d
BLAKE2b-256 be9dc1913d3c100f581da9d6af175e7b0923174604eaab88522440b5b91155ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 4edd02122161fac820f1beab5937dfccbba689e3e636565801d4cbb073e404b3
MD5 21baa84c74b58f02209e58be2f8bbf4a
BLAKE2b-256 48e779a6fed0a891e80bcf8e201fcb146c55325ac3d8169d6a4cab29a84f62b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 7678d3985fc0197b7f91a50133f0815b6679d86a04c3261332002e9456ea3e33
MD5 c1276d4b6a15d047a090d3e57dbae5c7
BLAKE2b-256 82cc082fdebd4655f9f24e7ab656b2d9674b26ab19155b4d034743114a0204fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ca9c987e777bdf52e9cb7797f3f409a0b0d61da8039d8c6a19ce6c6861220d63
MD5 3adf325f4f106560cb0501d18ded2ca0
BLAKE2b-256 4c80e8707137846927f311564c4138fcd4c085a2c8569c2b7e2abbf4316be221

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 d16d687b14349c4f3258791e5b35ee869fc81de66cb8113fed2858628ff36f47
MD5 276aec199aaf1d53b0c5fe282739a5c2
BLAKE2b-256 7a5f9e6ed55e47a781ed8a5771db9958ecfa76fab34bc522b0ebef7eab9399e2

See more details on using hashes here.

File details

Details for the file zenroom-2.15.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.15.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 ef233d9bb966efcaaa348d287ecb9bac80d40194d20f27e3cdf59a504db24b41
MD5 79d07c5fd6b634874ee8341b95bc2dc3
BLAKE2b-256 0b7072ac44fac60b2a17592702e6c9be83932600b42b77192f0033484f981b67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 836eff35e254f9915022fbb81f78220b17776a0ca3e12063da23d8602c67c2af
MD5 b569e002498932c77af0f2709bf7a0a6
BLAKE2b-256 0a88c0a6676f7bd70e1fb896e88f4075b9d53745cf9b692825df362f6a8615da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 cbc0999249dfb1f8e883a14b56d52036b79ae9bb356c55705868ac6f9c412982
MD5 a7924c3d6d40a4fdd005edf780cfc391
BLAKE2b-256 08f17c71c2abe1ceb24fc1af3bbf50e5e449c02764e6721b060ac133a26d0e55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a532245be5012a3185d372cfbfadf32c4b5c6c3ef529a96f1fb5bef619cf5c7c
MD5 7918b663c5fdbe6e7088438dc471bd80
BLAKE2b-256 82a181e20a58cf252b6267be1032a8a21056b7c61f975ed9a14c1847a48feade

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.3-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 1b8e49e07678f39e9faa1290ce4cc986b3ddc784c36430585d276ca2fb5decd6
MD5 f4962d87076d9fdf5fb15977fd30471c
BLAKE2b-256 ee153ef5fdae7945317c54de3dde662b8e0b9627e9331cc905fb5c68373bac3a

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