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

Uploaded Source

Built Distributions

zenroom-2.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.1 kB view details)

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

zenroom-2.10.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.6 kB view details)

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

zenroom-2.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.3 kB view details)

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

zenroom-2.10.0-cp311-cp311-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.10.0-cp311-cp311-linux_armv7l.whl (877.1 kB view details)

Uploaded CPython 3.11

zenroom-2.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.2 kB view details)

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

zenroom-2.10.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.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.3 kB view details)

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

zenroom-2.10.0-cp310-cp310-macosx_10_9_x86_64.whl (778.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.10.0-cp310-cp310-linux_armv7l.whl (877.1 kB view details)

Uploaded CPython 3.10

zenroom-2.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.1 kB view details)

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

zenroom-2.10.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.6 kB view details)

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

zenroom-2.10.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.3 kB view details)

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

zenroom-2.10.0-cp39-cp39-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.10.0-cp39-cp39-linux_armv7l.whl (877.1 kB view details)

Uploaded CPython 3.9

zenroom-2.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.1 kB view details)

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

zenroom-2.10.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.6 kB view details)

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

zenroom-2.10.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.3 kB view details)

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

zenroom-2.10.0-cp38-cp38-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.10.0-cp38-cp38-linux_armv7l.whl (876.6 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.10.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.10.0.tar.gz
Algorithm Hash digest
SHA256 e7b3046498ee3629c1c428a5a1ee4c3d71328a7758b526b5c992ddaa269a0edc
MD5 da3fdf992edca9fc689dc301c10ae1eb
BLAKE2b-256 0c1ee0223cd7e0d76a1d4e61b65c9a5113cb58267117de3777b214df24017003

See more details on using hashes here.

File details

Details for the file zenroom-2.10.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.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c4bd4093fbe014e28a6ab79e229d2fe14520a648469ab44f346203b6f25caa4f
MD5 d6f542957b33187e1f05a82c2d5ee4b8
BLAKE2b-256 693353fe770209e6f6cd1c26d81a934c3489d47bccb83a7f0a72af97489e20a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a94f79b28269dc5f551a9b69db9e8490451ca1d515f5fd72daaec9ae6df8e89c
MD5 092f49f57ed3de0e090bffd90e97e689
BLAKE2b-256 a4b05ec7bc6b744b1d3f0ff28001bcce839a7d2329635cd8071395b25e9a2580

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 15bcd6e7391bf745c5269262b9cb4bd95f8d9db4c862c2d35e2e22f28d73bab4
MD5 6db65a8bea2fb019a1478ed176e0a5f1
BLAKE2b-256 da51b4b344e19008f193c7bff8599249eccd288904742499f969a43396ed8254

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 56f8c263c395cf79adb2cf620f0cce40fefc59d57f83277d22c649339effcc20
MD5 5cb7a6b1c1827e09fe328292ee2d3a88
BLAKE2b-256 ec5c7cf22243183aa576abcb229fdb7162504b0576b7f13316c3015465fcda10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 fcaf570f7a27472b6586936b3d44420bfcba8332e0b501c16e5687fd1baa9c54
MD5 1042ff5b5d0f114d565037915476f2f1
BLAKE2b-256 1de89d48e959b9c072877800c3bc003747bd7f8454f6012238e6f51b6a3012ae

See more details on using hashes here.

File details

Details for the file zenroom-2.10.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.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 87c16be51bbab6198612c05aadf7e75b0941975988338a7ffca653597c4c7706
MD5 7b3883e650c24c30bb9d8bac4070280f
BLAKE2b-256 992bb1729a7f7d3aa397aa8d8915fbe23ec05b332b1a57ef0b7a246aa880c1f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2b92b634b8a0b9ca0309e2f99a7b3075160884c41918d9a36cc2adaa78546e53
MD5 adc7962a79ef4b619e902325d4984e63
BLAKE2b-256 e29954b268cc273adcffd26ce99be60dd01832d757516cba05c6e17853c300cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8dcf15facde5616872cb4e4254eb0dbc6a99e3b23ca361793bfa978d055c83b3
MD5 c540ac0b4fd0f2b42400eb93c947fb1b
BLAKE2b-256 5fc7ef5f7e187a18c887fc9bfdfeb58b1aab2ae7f60a39d137e61ff877b9f442

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 119031ec31ac31282825036db2ee9f3a97438d968988b23479dd737679758673
MD5 96b31e805f05fb9cdf0bfbb42761b051
BLAKE2b-256 f97ca73701a1015fa24e4442ac056d956db92007e2c3c444d7c417bd401ec526

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 1ff47c1a2d3a9de0bd2b6992ac8c4541949df4dd8b5c2dcc4380f3109c5a446d
MD5 07836c1075533b59e2f20f82e10ecc3d
BLAKE2b-256 a223f828b67350f9b173e5047a53e7d1965963607a10bbdd94f420185484ef1f

See more details on using hashes here.

File details

Details for the file zenroom-2.10.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.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 50fe24726e341cfc390c95b793967b464dd245f360f405a8d87ee7782f5f7297
MD5 28c0fa7c9d348059d79b43fdcd2139c9
BLAKE2b-256 8014a1b9509f33eb9661d4e36480ae3f7d374331cc70f54455bd86b087aef371

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 009635b57a45891d77c9b3781b46548bfb583c33f3b40034e89429a2159895b3
MD5 a2d1fd5a44f0b8737cfa37ce4db9df21
BLAKE2b-256 475001f41ada6fc8b20a2f11903c68a9a1146d4a725b5fcf17d26d7f72e1f364

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 35175792b2b3fee13ba34e20ac0888ccd54b06084612a014c11ab0408db50e39
MD5 f24eca4c4b61374c07098922bab8de05
BLAKE2b-256 109b34822c2b195c7375d9eddc139b3a380ddea8e1382f2f6d9205b349a8f9cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d9af5c87e0a0eaf05c095aab74df09a6e47fe4ef093709576e1641c64ccf10b5
MD5 a43577386793ca37519614f30577e10a
BLAKE2b-256 9eabc7aca4c36e0c15265550d4ec757ea0588a2d32bb23a4a40d05572aacaf1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 ac8cf566f7525c830ac152a9dea51631938b89863deb369a46f9400eb539270e
MD5 abcab20bd0dad119728250a440a37de8
BLAKE2b-256 06567d6ddc2f4b9947a67386e4b917c8d17a1ab7fbf8ea25836efae83de92ab0

See more details on using hashes here.

File details

Details for the file zenroom-2.10.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.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e7b9f9f577fa1e8af5a2cf8cfea63841e9685d8b83336629c52ceaf320f1f78f
MD5 89870cc0f6f020ee543953e3e6d1b1a4
BLAKE2b-256 d9c5c2ca07090c3c584391e354beb0c3cb0dd8deb43bc71a800b9aeb1b16036e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 6fcd1b97d10801cb970e83a12d18132f591899607943bc5766546993fb0a0dc2
MD5 28d35802ee9b0aa14da14e30a7308856
BLAKE2b-256 5882bf0b73ee15707af9b5930723b860bdd881558bdb43685e1b633e4976314c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e24f42e8f241d63d230ed9ae887dbeb229d04a371a86817ab641f089002afc9d
MD5 4db61377820f708eeb530158cfd5e947
BLAKE2b-256 3c848c47b1eba9550edb31009f5da61879ed4536697f872be0ef91f649ae7c7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5e29994c0e16c0b9d331e6f9dc436078c30f20a2ca3ea27f7580398648e7e6c8
MD5 ae8904d4a7885f3e3eac81c965cacd10
BLAKE2b-256 33254ba730f4675fee206a864906c28f4eb33a68ee724c731df778b7b4c43a76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.10.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 ff199cc658977c17440ab3fecbd063ec5070c5b15db7fe50070dd493d71e4e1c
MD5 42605b12ccca27965c335665675e738a
BLAKE2b-256 aacd8b2991231d9f944159f2423ebd90b6385d36600422cf0a1d225606d005df

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