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

Uploaded Source

Built Distributions

zenroom-2.19.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.4 kB view details)

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

zenroom-2.19.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.0 kB view details)

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

zenroom-2.19.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.0 kB view details)

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

zenroom-2.19.0-cp311-cp311-macosx_10_9_x86_64.whl (778.5 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.19.0-cp311-cp311-linux_armv7l.whl (878.5 kB view details)

Uploaded CPython 3.11

zenroom-2.19.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.8 kB view details)

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

zenroom-2.19.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.7 kB view details)

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

zenroom-2.19.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.0 kB view details)

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

zenroom-2.19.0-cp310-cp310-macosx_10_9_x86_64.whl (778.5 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.19.0-cp310-cp310-linux_armv7l.whl (878.5 kB view details)

Uploaded CPython 3.10

zenroom-2.19.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.8 kB view details)

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

zenroom-2.19.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.0 kB view details)

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

zenroom-2.19.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.3 kB view details)

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

zenroom-2.19.0-cp39-cp39-macosx_10_9_x86_64.whl (778.5 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.19.0-cp39-cp39-linux_armv7l.whl (878.5 kB view details)

Uploaded CPython 3.9

zenroom-2.19.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.4 kB view details)

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

zenroom-2.19.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.0 kB view details)

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

zenroom-2.19.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.0 kB view details)

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

zenroom-2.19.0-cp38-cp38-macosx_10_9_x86_64.whl (778.5 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.19.0-cp38-cp38-linux_armv7l.whl (877.6 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.19.0.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.19.0.tar.gz
Algorithm Hash digest
SHA256 fa9b4f728a69af10d736a26a4fcc934aa68697bf6df1e094eb28d3b79be94601
MD5 0ec941c1ac5c6058816bcc81fa24d85b
BLAKE2b-256 08e4a1988c010255c4ab2ea0954ed9727356f7efd73fb8045a2c79399f04313b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2b274d02cff1f4cf6c10947e6884022d1659250d4d64ce728367ef7f3000a8fd
MD5 59189aa4ae14e58a1a31824b0213f6ec
BLAKE2b-256 94ebe2b723492366b6d9274fba082a06042673d242dbb0afa10281be92fc6cd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c3ca3a6f84a48792d325c21687b90b820b953c0c19ef1ae26dc520349ad2bcc8
MD5 4ae6a3348142e71bbc0165b0e10e87be
BLAKE2b-256 8509851777a2dd27577b251264e5b374ceb2f761171c75b9334902215bc95407

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 08aee74b28a30aba84e4c5592f068ab469eb42b25a31217ce65e2eb6e2c247e6
MD5 650aed083a0f7f0f773b43eab04728cc
BLAKE2b-256 1f55812659426e3497270139575fe3397e33b5f1070fe5d628ef1c48f54acc95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d6d0da28ce14accd69174d51e1b6334d55fd7feadf4e85e2846ecda2f9a3557f
MD5 ac5af627ecdd6eecadc4daa9ee8da12f
BLAKE2b-256 515384db657c9740766f129587fc6cda96c4e7eefd9d2a3d19b1e885b783cf51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 3a7257389d0fa9a9ee15a5461874da19849cd733a673a5eb0aaae740d4a55d72
MD5 21a9ea54c2cf2ce2d4bb4b9090769346
BLAKE2b-256 245cbce278a9c270a10607ac0e7a2f5e0e408bb2b44b7824ca05a6076a7a500e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 54fbb43c8234452913678fab55ca7d054016ed3cd23e91c92415f3a4875f5acd
MD5 4dc499527fc1fec77e3e35049e6b31d8
BLAKE2b-256 c2753bc5a5ac80e84fa03f3f98e634c2e9e7c6ac74ecec6c6c98a815bc3a9765

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 6e0f0a1fef5cf2dcf781337d2e2d78ed96a5bb40ba1e37f0bdd5a2bf201e1fde
MD5 481ce1353e6e76455caf3ab71b02e40b
BLAKE2b-256 91ebe3125c69c7565dbb326c37799703cc5e64a2deef531d2d73f27a9de1afa3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e4753b938d4102838801af68e314b7ea803dd4cd0495c30be917945924759686
MD5 0e0ff81f23e443397ecc49b9f54ee3a7
BLAKE2b-256 418fd1e6f493068643bb74ba2976a80584384fef00994e9fd806df95de571dc4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c5d093724e2ea5d66622f2f8a320618b946badebad69a5ce9a8cab170039b5dd
MD5 1477bad012b8e7086676acb1946c3654
BLAKE2b-256 8b2eff4ee03424d93d10074c099efd2ce5fafa5a9d1154508a9ba47cfec9fc7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 3f902eb4e31f7c9364d49dc57a2ce51f8ead6fdb22b3da32d1e93cfc7adfa96f
MD5 d8058869c17ebfe29249d6b232aba038
BLAKE2b-256 561f48a10ac2454886c8fb82bc18595b32e36545d7c0e7649b8bb8a2ab087ee3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 fffa22fa2c783b95de02b5ea2310ab0eb7b0b18e08c3fd0845ea49045aca8707
MD5 7c45c1bee05787c5612d97ac56e6da95
BLAKE2b-256 1f18d54ceb548e78a8f137f466d51b27cea6e836045023ae86b089da37b68023

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 fb2a5f34fca70bee2eb60928ba47cec33e1a1456d5910782b0f895747417375a
MD5 57066d569c7d575b2b53f90621bb4eb6
BLAKE2b-256 d0551bbd24fd9eb6a1f13f98633cee483d14f2d0f5248a07a34baf346e58d466

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 84ee5f03066bebfeb3b879db7ceb825d7d99bdd02858ab119a46b858806fe85c
MD5 eaaf81d8bef78f7eff801e72feecc638
BLAKE2b-256 a389fc6e3d91a1f78f4db91b45dd681a8cee60cb1139d4f4fc7e470531bc6066

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 65c7027571a7b0975ebfda4d985f86b06a143617320b356df75c2c8bfce6419f
MD5 5d0892949b344f429ecf59f8aa5d86ac
BLAKE2b-256 4e882a4c77473cd46cdd0c162f82ae84f8bff178c7c6f16c6847f89066a3bbf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 092f81e423811ea69128c73aa76e4b1fc5d1bdbfc1e153f143d1af6bf2cc2b49
MD5 090beb48e1165a556f1a10f4e191c1b9
BLAKE2b-256 92186f1397fbd0a41b9ab79e0c830c513ce35362488f76fe3f18592ed7b832af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 1184539373405f7a70a2a01d9f55fd9d804e73bf897d524290815a7964926979
MD5 7b7a7f9b9719e4b44a28c8435c58a4b9
BLAKE2b-256 4b189e69c9163ab0b15f9ae77ffc423cd6684ed18c8888d3347d48fcd3a60968

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d6d267b61b61cbe5fa663f283e005cff2e6c17c4bbfcda0cec4eb48ab9cf733e
MD5 81606afc8b603b5106d4b3a7fa0c53eb
BLAKE2b-256 fe9bce17becbfefe3bb1ac06c58b007fc389c19fc5021454d6f227f6e76b80b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8d5596cf427b1c97be2e7b25870017c5f5b2a56236e2591a2aeeb419bdb55ae5
MD5 22be93949d74da119341ad30f3d44abe
BLAKE2b-256 928069b449ba59397b505c5792a45d9600dd33f1d91f061387b3c2a1c4759ecd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 13a262f94e9b56df5bcd2c33378b3b40d493fee6d8467388219bf0d37e4c4042
MD5 c983d8957656497fee3909151126b2ef
BLAKE2b-256 3c2003e4a3cbdff3be11907d3b4bd49c50f600837adfbe2a77b21e465d4a6b72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.19.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 bd54217ac98d162a50a3c3fe1da4029b8380bcf6fa996e8b707e0039f1abf3f2
MD5 864ad2c806c2c408179e729d6bd466a5
BLAKE2b-256 07d2cc3d37280896a90da0397ffc8443f0ca830c51427013a075a6b3889e2c85

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