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

Uploaded Source

Built Distributions

zenroom-2.22.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (939.1 kB view details)

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

zenroom-2.22.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (953.0 kB view details)

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

zenroom-2.22.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (882.2 kB view details)

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

zenroom-2.22.1-cp311-cp311-macosx_10_9_x86_64.whl (794.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.22.1-cp311-cp311-linux_armv7l.whl (900.3 kB view details)

Uploaded CPython 3.11

zenroom-2.22.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (939.1 kB view details)

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

zenroom-2.22.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (953.0 kB view details)

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

zenroom-2.22.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (882.2 kB view details)

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

zenroom-2.22.1-cp310-cp310-macosx_10_9_x86_64.whl (794.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.22.1-cp310-cp310-linux_armv7l.whl (900.3 kB view details)

Uploaded CPython 3.10

zenroom-2.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (939.1 kB view details)

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

zenroom-2.22.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (953.0 kB view details)

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

zenroom-2.22.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (882.2 kB view details)

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

zenroom-2.22.1-cp39-cp39-macosx_10_9_x86_64.whl (794.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.22.1-cp39-cp39-linux_armv7l.whl (900.3 kB view details)

Uploaded CPython 3.9

zenroom-2.22.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (939.1 kB view details)

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

zenroom-2.22.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (953.0 kB view details)

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

zenroom-2.22.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (882.2 kB view details)

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

zenroom-2.22.1-cp38-cp38-macosx_10_9_x86_64.whl (794.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.22.1-cp38-cp38-linux_armv7l.whl (899.8 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.22.1.tar.gz
Algorithm Hash digest
SHA256 b206378b89d9799402747be7a64624d8b6a77bddac913310c7796560fcc07914
MD5 c4a47df482173b1ee7eab644d2c99de2
BLAKE2b-256 50e3dc81e62f4861a27f8444b93c64dba3c2a4b8f70e74b17f4795328965f085

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 599e628c0258b08a46eb14ffa215ff1557e1c51fa3f916ca33645912f15d4476
MD5 40ab8da44926e552be4a171190a3a506
BLAKE2b-256 630763577b28767d529291d2a8d7a116a660d10178273ac0e389da7e7d150e2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f7b01471ac80ab31452e1de516fc3e35003fe47c21bd36cc6c6bdeace5e2a1d1
MD5 dfebaafb1d94e007333f58b1eb29f7a2
BLAKE2b-256 2730b8e4df1e2f241ec7c0db82ab8db50aa1f8bd7b84a32ecb303f9a602563a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d1c24c7a5a8e9ead352019ca53f6de827c1b28bfd8346acc1db3b636fd95ad75
MD5 03b4af9bfb7183240f890d4294d26b5d
BLAKE2b-256 f749c99f60f181d20e5d834bc6040d424642080fe70895960b2c0cede587b300

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7011e5ab756869b5285541b673a2c7ea270251249c7f1394aa802ee2d11e7f38
MD5 63974e258b7eafd511545423280b492f
BLAKE2b-256 1516243f16529490bf345ef0fa64e8448da606992717fe5386c31a5a338603c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 035b193fbdeec9c61dac9d0fe1413e730626fe81ae54671b411617abb8999dcb
MD5 a436e1efc369b5210cb8acb1e40d49ba
BLAKE2b-256 b917d0281c22b68ca65359d1d1c73ccb3bef3ad3a7a0a47c84beffe568b417d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0be0fa8680ea663134046323df17959a3e8b7d8b9cba0402af9d750e53611f7a
MD5 5cd67429a6531742ddc1a87033c309f2
BLAKE2b-256 0b98a95a9b0efe21db92dbd1d17d550871e2d6fbd7855d8a2bf4fbc90367ec31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d0ebc165708c5e2eb6c079e0b280cccc9f5a5e6eaafd47f9bdf6832a64ae75a7
MD5 9599b4730a702bc26de19c1b95ebb052
BLAKE2b-256 5e25e48db3ee27b5064ef1e0189e8f532e7f53f94a83a051ed4f9e752c395044

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 2bc7ee4df20d17a5b578de8b274e978c4c0511be16377a9b4b743c855c377b14
MD5 8accdf96dd2aa6d1d737b1461d5a56eb
BLAKE2b-256 8a120c1d47653f4b4ef37a8bc4862bb1c559556ebcbcb32a232675d2c5edf044

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b3390aac03489db48e79c5e0f88f9be9672de2519374c402d7ba47669c446b62
MD5 f6e1018fd5bffc466d6f922d846b752d
BLAKE2b-256 5831804c1a7595c40191819e67458bce6f4898e9a70efd1f02c568006a24a6d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 003b452f62b019ba62fe5c891f876c2380acd72d0a0fa1cfd0622429774097bb
MD5 e34d7de0ab31143864bb3456cbdba142
BLAKE2b-256 ca3efd2ffa5b99879fbb9e1350965bae4a793167838981ab32c48c18125dec3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f759fed4e088e00f249ba4fce03e792f3503b2bb8004fb2566a4410cd9724e95
MD5 33e8a4432fa908d8064af51489b7cfa6
BLAKE2b-256 2746bc846f2ab4b9367fce329df9e2d11dd771e0fbed6a7e840420f8bcca2b55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e30e01b531434108eeceb35d3a13fd84c0be570d399c7479b6a9e7e3ea1fdf6e
MD5 d195c57a8542c7c2fc89549fb7e62a34
BLAKE2b-256 598c4987f1593131c98b63d48667b56aec0ce37832da35c55429c7854953cd57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 3cb42769a475cbd08efd83d632339acf094c66436d6342aed18ca6bbe99bdbfe
MD5 2e0b97c8bbd0b2bbaf828a73636b6f01
BLAKE2b-256 5427f61b17148d86335d64a1c11a9ff5940b8f08f850211c066ac64d35d83478

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 023752fe4204ba4e19c8a6fd0f64b70a87038c762b67735e34557469b0eb5a7d
MD5 d762807dc99cbb14e0c4f773e10872a3
BLAKE2b-256 289dfed310d57395ce1aa3bef15751397cb20a0407efbc467355444de8104f39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 7e39cbf8b66cad5f1b62e29808a8343a23ef792a78f266cc4c5fb27a19f265e8
MD5 a4e8867a7b58013ad31c8922f6e2db0a
BLAKE2b-256 f0d0872f4e5f3eb192685e74b193fc485daca8671a3bb3d5f8aa6b0acb87b694

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f5cc001793240cf1a79e4d57bffe94309c2adff60ced77f28112710b398f0834
MD5 d7b3284f249fd111c0395a7f651ca964
BLAKE2b-256 a2f6170e8ff829ff8d253f4a5d9345e2a43926f0e07d145188d5057f06ca9909

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e30be4336c6f62bfd015e625ec3f3bb4c929e8942658349e80f3dc5dc73b7857
MD5 381f0b382faec076dcf302d1928d8c09
BLAKE2b-256 17a3722955c78dbd958eaab3f93773d61a429856fe3361e5516ed55d1d8f8339

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 043bbe48242a509fd8507c2114cc1e48b05d429068bd2f55003a1fbb4a16b36f
MD5 689b1d06043e0c68912d9a89b3c6044d
BLAKE2b-256 f5d4e3cab20f80efd2f3743fba31460d1ec0eb827e76a51fcc7a0bed8b1aac10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5c4c0c4109c342957bed6131e4250a50abc0f6cb123cce55c5a71dc67cd4bad3
MD5 5c5418adade9210f1fb743732ab4425b
BLAKE2b-256 e04b6937402418d1b605f24480e1d13b668788e0f0c9218c96cea50a3dce97da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.22.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 d6a9466e1dc89dff6396f94284641f33aac456a2e14dfcc42baf3084b9371e7c
MD5 0ce2bbb7c24d49f5dc678e4c18bc158a
BLAKE2b-256 934897feb43fb3d441b5147ba99c8cee28de78d77e8e2d590b7bd3739a7cb531

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