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

Uploaded Source

Built Distributions

zenroom-2.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.7 kB view details)

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

zenroom-2.8.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.0 kB view details)

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

zenroom-2.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.9 kB view details)

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

zenroom-2.8.0-cp311-cp311-macosx_10_9_x86_64.whl (777.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.8.0-cp311-cp311-linux_armv7l.whl (876.5 kB view details)

Uploaded CPython 3.11

zenroom-2.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.7 kB view details)

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

zenroom-2.8.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.0 kB view details)

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

zenroom-2.8.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.9 kB view details)

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

zenroom-2.8.0-cp310-cp310-macosx_10_9_x86_64.whl (777.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.8.0-cp310-cp310-linux_armv7l.whl (876.5 kB view details)

Uploaded CPython 3.10

zenroom-2.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.7 kB view details)

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

zenroom-2.8.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.0 kB view details)

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

zenroom-2.8.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.9 kB view details)

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

zenroom-2.8.0-cp39-cp39-macosx_10_9_x86_64.whl (777.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.8.0-cp39-cp39-linux_armv7l.whl (876.5 kB view details)

Uploaded CPython 3.9

zenroom-2.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.7 kB view details)

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

zenroom-2.8.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.0 kB view details)

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

zenroom-2.8.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.9 kB view details)

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

zenroom-2.8.0-cp38-cp38-macosx_10_9_x86_64.whl (777.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.8.0-cp38-cp38-linux_armv7l.whl (876.0 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.8.0.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.8.0.tar.gz
Algorithm Hash digest
SHA256 ae0c1331688a65eaa208880934c64f1fbcbbe8e6f36bc58e94d2f9cb70e162b7
MD5 3450197e5ea24910144ebc2e80cec9f7
BLAKE2b-256 89bd1cd3c603c7ddc38cc18c52a21e95f896c00667c1910a7c3470e6212eaccc

See more details on using hashes here.

File details

Details for the file zenroom-2.8.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.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7a4cea6a43fb7500bedcbb96140cffa73e4b82e31c3a27ba0f4d2677c221f94d
MD5 dd66e1d31c8694b64f729d7d9fd2977e
BLAKE2b-256 684e48cfe28f2e580f574ab0fae2852915b4ee05de9e4fab9a58c94961496031

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 7a1553b44b8885ce9995f0379fef39897bc0c71c86671d0a4aea5e4af3e10de8
MD5 8d92b11330727317f55153d4a2514273
BLAKE2b-256 f1435b58ecbff0bfd4ba62e97f3651ac7a72eabdcb3f7b12c9d2636ff1e9684a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 9f8dde4bcee7950207eaf7c6309e3c3be92e58d4d009de87017df16c50eb4c10
MD5 31afd5d14c1647b8d13ecf8db7cfdd4d
BLAKE2b-256 03ed58c2cd7a033cb1d4fc957bfa30836690c7cb50556d28943f9d9f154887c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e29988964d2a5dc5efe2d63bb3ea75eb00f0360b120c26daf2de97fa6bd48260
MD5 587a9c9a47d7c7bba09df0ed50b1e766
BLAKE2b-256 14c61b851949cc3c9771fa1ddeb6eaae4991f7ec3f84e086dc80f9618ea7f690

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 66c254d8ccfa65bc0d3279b10f9ca122bae108a07d622d2e3ee108fa57bee33d
MD5 0581f295c23cf6301e6b0dbc35cbb8aa
BLAKE2b-256 c0bef5e08072fa1764a7665bbd6d6a33cf4332591885c52b5767a6da0b4824b2

See more details on using hashes here.

File details

Details for the file zenroom-2.8.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.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 fae7ed689704bc1eb73fe36d9f9622be7812308abf59831467c283f4d7a9e7d7
MD5 38a1638f75a17030dd7f805b196cad88
BLAKE2b-256 69e4e1dfabc5aad40e7660e262fd66dc6dd568f4d84e295487c5b7bc63d337aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e18b13edb1004b8ae4784c8d6fcb68c0a17db1452f35b33c2cdb15216637d8ff
MD5 02b42ca4188e1bfd359b88644c0b474b
BLAKE2b-256 4aa32e9e00eecda992857624a0ff197815474b1edba57d7a185173bf943ad2a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 f3b6364e2b3d97110863ed2d9eb7ea72f92de5b7fad100346a403d34fc99867a
MD5 e9fc213cfcd54e358b6510cfdbde7e24
BLAKE2b-256 833b0ce009458a9f8a70fdd7b378a420f910a0b6a5653296d6f447c27fce7b42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9db6773793fe8fcf1b731c8a847d46eaed3cb659dbd97e904deea28d4c234f5c
MD5 cae5d7739356d96d23f116f021a3afdf
BLAKE2b-256 278e732b82c8b308739edbe8ff9cebe0e4083aca2d6c77a83178e32daf8e9338

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 cf8757dfef174b89cbedff242462ed20b734e838dd0e92b4ffdae7195e27ebf9
MD5 086876a94033336a4bff235ddd690954
BLAKE2b-256 0562c2539840f27adce9f16574e9d774b4bd4fc26019a4de3c6c35f4cceff71c

See more details on using hashes here.

File details

Details for the file zenroom-2.8.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.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7376e57a3b522c88f45c468be35b65eedb49cc80fc4b4d4099af29275109de10
MD5 436fbdbaad5121abaffe123ebc4b04e3
BLAKE2b-256 757c5310b830d936b67113a844f142736c9f5eb5ef34f20e2591cac14f5f5753

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 17e9a8b75d4aad500aff3f3c0a13d85435d79619f5b8b7da80546dd79ce57beb
MD5 664780f65739c5c98122d4d74d6f1cfc
BLAKE2b-256 7170bac554d282e363541b1ce70650a4cbabf8b03f05d6c4df356c05a6705c2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e8f3e73e97d975b41718eaac9637559a7daa18d3f8d8d09c19a65f2edae0aa3f
MD5 c304cdca856c8b58a9729f9ab6e5ac91
BLAKE2b-256 d0f422c0995eda04373a0afa50ae30e92648d511d865462b70f156efa02bdb4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a07258c5816740b477b71077e9313e4c37bac66a5423b587923c99cf37677960
MD5 9c9ff536f2d09cbc822f885de505eaa0
BLAKE2b-256 0f7108e2a113fb954e62a81406570c0f3aadb4025e75de6c657124e833aea83c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 26f03947f9bb1a2e2dfea887fd094460feee26e281b47fbb4d6d3a7e6f9fd91d
MD5 de200f37715c471453d83fc2926ed02e
BLAKE2b-256 15bd6946e7867a342ee74ee7f4c78b167bb052810ddfce57b4e91b0fba38bec8

See more details on using hashes here.

File details

Details for the file zenroom-2.8.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.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 688a3fb84fc4b41f24dce5f0fdad51ee6ef8e08b0d61351ca8724c3c97ae2442
MD5 67edc2c75738d70cc28476bf8099320c
BLAKE2b-256 2027a1a0176f51900e8fa4768564885b78b63f97cd9c14c881610ba1b22e8527

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a5409c7cc9c9e5601b93dab5b9b69089ae38dc42406879f1c1cf268dc1669000
MD5 10c1e1efc15b01d7701a2af0706fa4e7
BLAKE2b-256 083de5524c321ed036eaa8fd6578866fe1d22cffbbf922fbecc5ec2535d65f70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0a2a4791d3e5e572d1fe6bd9c5dae1a691b9e673d66911cdf1e1a4c105f6d838
MD5 e5ac0cd276794336fc787c569d8ce755
BLAKE2b-256 711b4c77a25ac47ddc0ba4effb690df964a9bfb821519f50fdee65a90e3bceac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6a18983d0596ac8d97a7b91cbcf2c87de1161c08bf5e48ff6b5d1ddeef18e9d5
MD5 4ee359f542a6ad918ea1caf4bd5bf953
BLAKE2b-256 8d13d2da999f21d392ac14bd0bd6e6c91f239a59bbb34b8fc58dcb125e39700b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 99a5ad8c2c7478dd559dfcac47b4ea08a998834885fac9f5cfd059d715e54b38
MD5 043f7e61993b93db6f85c5f8456e3a06
BLAKE2b-256 56a3e4ea27ef1a5fb1b0ad5fdba7093e46411f140030e6aba6d43b5452c5db7d

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