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

3.3.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-3.3.1.tar.gz (25.6 MB view details)

Uploaded Source

Built Distributions

zenroom-3.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.6 kB view details)

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

zenroom-3.3.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.0 kB view details)

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

zenroom-3.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.1 kB view details)

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

zenroom-3.3.1-cp311-cp311-macosx_10_9_x86_64.whl (652.3 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.3.1-cp311-cp311-linux_armv7l.whl (775.2 kB view details)

Uploaded CPython 3.11

zenroom-3.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.0 kB view details)

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

zenroom-3.3.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.4 kB view details)

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

zenroom-3.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.1 kB view details)

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

zenroom-3.3.1-cp310-cp310-macosx_10_9_x86_64.whl (652.3 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.3.1-cp310-cp310-linux_armv7l.whl (775.2 kB view details)

Uploaded CPython 3.10

zenroom-3.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.6 kB view details)

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

zenroom-3.3.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.4 kB view details)

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

zenroom-3.3.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.1 kB view details)

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

zenroom-3.3.1-cp39-cp39-macosx_10_9_x86_64.whl (652.3 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.3.1-cp39-cp39-linux_armv7l.whl (775.2 kB view details)

Uploaded CPython 3.9

zenroom-3.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.6 kB view details)

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

zenroom-3.3.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.4 kB view details)

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

zenroom-3.3.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.1 kB view details)

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

zenroom-3.3.1-cp38-cp38-macosx_10_9_x86_64.whl (652.3 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.3.1-cp38-cp38-linux_armv7l.whl (774.7 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.3.1.tar.gz
Algorithm Hash digest
SHA256 10effb0b9f3bfbc49563d351de2a18fad9351f94ba60e1cc07a8bd2d547d49dd
MD5 2729964196b20357413708dfa38f0254
BLAKE2b-256 5e10d25909d52da88b02a84d19e09a5e664d9beadd3151992acef3f7a8b0b2ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 acf782bd78f2b4809e320020aa636607dde9c2012958cb3e49997cdc70618277
MD5 53de25600b83914154bfcb95ffeb913b
BLAKE2b-256 280034aac4fc58929a2f2241b2c5211c372a7a9aedb75cc223c81197a06aebb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 1fe1b8271917662eeea887204e31b3ebfcb5d968ff34b7c29766786423a692c5
MD5 7d35c8914464de65c2c65689049e5ea6
BLAKE2b-256 a8b380dac3a013cf11d15bb82c6f6b83f4570c56552f16cea78c06e0dbce83b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e6407be316b20dad08ac3ba3e38abbf7d61418d1418a33955d48ae03b15567b6
MD5 158083f0c331dd72e05dc587b88ee194
BLAKE2b-256 0064a55a372188758205a16d556a70b00851f8c65bb886270d6aa3aecf5b6e54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8b1a0ae0189fa6aa5babfd2de6ca4ef8982e2f7f78fa67d7eaa20494347773b7
MD5 c62d2d391ec3530bf2b1aaecb89c66b7
BLAKE2b-256 c69d271bd006fe33a28a14410b5ad8f5d632cfb7124b20bed99c792094b70652

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 a8428fa6a11b83daac4a8881e70f9bff42a8dc177e1f456fa1f05ac4d7857ff2
MD5 681368274c444e16725f106900904089
BLAKE2b-256 ee873f47e48c71d1a9d6c9c1f750e9da804cba82ffc4784fc99fbfe35fd8bb8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d5fb2a7a0c54b0c7fab8d302cdaab98440bb0b6dc2f7b3b1f920b6ebe4293a00
MD5 792bba7b41f58fb06acc01b69f71e797
BLAKE2b-256 8772792a80fef7a4d9d17d85252d0065860c56d589b486221654b556deca07f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 957c428241d57ef2721243988fd02ff923aec2f22e612ddb77c11de348f8e251
MD5 ba60ebe7990bcbab0660e462cbf53b3f
BLAKE2b-256 ade029df7674e33c333b8291f24be5e82285ed68499cdd152483b53afd8ddf08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0aeda3db9e389a29de26ce1e08e75dd7fbe66423ebc1ce9ca07c72a68aadc263
MD5 7a42cca87e01d21704a88adf02b83dc7
BLAKE2b-256 b73a7a888edcb5106bc51c6d92494d032dcce10dfbf1557aed21328c9929271b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b0ddef351aaa896fe266a42adce2766a4e1dfcc1e5e074e312284340f9e0c949
MD5 9905e81340cc841d4a240880d165468b
BLAKE2b-256 741b49eb35c4ce84ed85d9871881cb9d346e0d68e69e202f8e0368b126667360

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 718832160cc4e3d0659e4e17c9e9ef743010e0b24c50af3f1567f0d50eec1574
MD5 639518587153b9046788fac89398943f
BLAKE2b-256 ffe9359b79572b0ed0ed37b67ae41961eec17b0eb3d34c246e4c9306e61e5e34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3d8d2b728cc17abe119d26ea77398f18c84924d011baac353ea31b7c127f2056
MD5 ad845cfbbf837279c65015fc05e870a0
BLAKE2b-256 0f3d02cf3b7df2279f95a434a3538380d6800949a10b1548b4520fcd8ed809b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9899f67c45d8819a3a08fde8255c36f6753db30ef6f2fbdf81eb51c9b99df898
MD5 09f3f39578db4de2fe873258ac645c1e
BLAKE2b-256 c11d453cb855ff680def6af765a8a8f6dfa9dbe25983c4334732dedae4765fbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 651fd17967186d88debf370d098f4e73cd30e1bc8a6a142707baf7575ee37270
MD5 a1f1cd49f3974956f84e1d28f7957691
BLAKE2b-256 a0c88ff19ad739685e4cd163892432c2b9b7eddafb40ec48aee5863ef7828aa0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4c5d97b8818747f78da0530e4a48abd148301491fb04ce2d5f40d09e42c0db44
MD5 37795249cc36e7a1d5cf3c2ca2648d7f
BLAKE2b-256 36737007555448ac126908fc82fb08ffa1dd2256fbd10c3281f43537c226962a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 dfe03388cd153dcc124e5418c980fd5c143cc0df5dacd0cdcc19b7e8f93c40c3
MD5 c868e7ccc43c0b0cfd5992d6a415069c
BLAKE2b-256 7458c0e25e686b544c69a2bc1d47a3cb55e56c6ff264b5fb5937f2588148fb99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 53a32d2f89e7626a132e868465a62a1fa58e97a5bb76490b2ad7bc7c1838106f
MD5 5722f0eb4a519a18c28d40ce03c58738
BLAKE2b-256 e5a04dad2e9ba37c3c00620dd2326ec79ce48f4da1e6c0c97ad6c4794e403270

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c4a065d803e1c2a26621624b6c9a438c3e5f7cecfcd38d9c23ebe0d0a58b875e
MD5 877f3482a1b4ca9f9edb1303bd87b979
BLAKE2b-256 7683f77a9c2feb4f4fd6660fcdfa555513fec82e5ce2c97de2e9b432300db192

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 b45b99b7ba6827ab1277f699179c122d064f322f1d748880b260cfe7f1580d6d
MD5 bb575f2a687ce6c551bfc13402c4d7ea
BLAKE2b-256 298aabccdcdde4d32e421788315af64f9bffd0dc514f35edec86f1d85f8af8ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7b182bf056d852bfaf602b4d83c4b212e8888167430253998520a216be212fe5
MD5 059f0851b62ff04226225abf687ffa32
BLAKE2b-256 4908bb9a1bd82e17d8bd078f0c28e9c76b3fdfb96ecbca21f7c56eceffcd8e0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.3.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 8ae5f5070dddd074873a2a1f87d18669d152942d37d26e581e1b227eab20c24c
MD5 588fa9eb816cc26b99ca15c5dccd02c5
BLAKE2b-256 876f7e1bc941ed367a33b50606ce48d80735769ff360fc9e8908c0985b16f4f8

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