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

Uploaded Source

Built Distributions

zenroom-3.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.7.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.4 kB view details)

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

zenroom-3.7.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.9 kB view details)

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

zenroom-3.7.1-cp311-cp311-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.7.1-cp311-cp311-linux_armv7l.whl (776.3 kB view details)

Uploaded CPython 3.11

zenroom-3.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.4 kB view details)

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

zenroom-3.7.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.1 kB view details)

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

zenroom-3.7.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.9 kB view details)

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

zenroom-3.7.1-cp310-cp310-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.7.1-cp310-cp310-linux_armv7l.whl (776.3 kB view details)

Uploaded CPython 3.10

zenroom-3.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.4 kB view details)

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

zenroom-3.7.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.1 kB view details)

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

zenroom-3.7.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.3 kB view details)

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

zenroom-3.7.1-cp39-cp39-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.7.1-cp39-cp39-linux_armv7l.whl (776.3 kB view details)

Uploaded CPython 3.9

zenroom-3.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.4 kB view details)

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

zenroom-3.7.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.1 kB view details)

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

zenroom-3.7.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.3 kB view details)

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

zenroom-3.7.1-cp38-cp38-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.7.1-cp38-cp38-linux_armv7l.whl (775.9 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.7.1.tar.gz
Algorithm Hash digest
SHA256 b738c00740cf76886ab5096de573ede6a214db33755dd4f7cf1f4dda2867c7df
MD5 8838b5fea49ac565ce7792a01955456d
BLAKE2b-256 794e14b9e99fd2e1cf6e0836c9058eba86b4cf88793456045b9206678ba8deaa

See more details on using hashes here.

File details

Details for the file zenroom-3.7.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.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e17a011e90e6c0d9625018895ed224bcde66859ec2bc658878751498e26cab50
MD5 1177925e449d2913541e7634e52e9f19
BLAKE2b-256 5c0c23d187f991f74d8ad241c4b0758028a15323cbbcfdf68f3863179d715205

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 062dfd523845c1090cc56992e7ccdb553800540b9d6609bb2da930c4feffd420
MD5 c56a063f5295d392aa07fac719167770
BLAKE2b-256 b1b3c99ca4ae9cf745667fac96828c9681281bad49cf075a62572d233124f77d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bccd0487c8948b062fb6d9868feb5ebcf627ad7859f5d1dd206debec3e4e5d58
MD5 718d84aebdcf7587fe14969d61be99bb
BLAKE2b-256 1eae58f420f3fcc1fa265132331e0f6b42eafd5c795993449d839aa8e5d4572c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 62686c3cb02dae99b9c096847c91e57c1de55f8cb38fe76b9e4251d38be6bb4c
MD5 6b3893cb01ce0322df851fe75b900153
BLAKE2b-256 26798dec7b8c245fc8e5f346bf0081f23d62c4afce1a8d168d59f4c0453144c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 283b3fc583fd24d46371112485cb698959cceab7479291513418f6b7340ddfcf
MD5 358e3281b2e74e0b48cdb6a45848b320
BLAKE2b-256 ef64a5a818e289c334d1aa23e306e37424a3b3e615fa65e37f71e02629c45685

See more details on using hashes here.

File details

Details for the file zenroom-3.7.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.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 df93feab07b865ff66e8ee77b3819e0f965722510623fafa444ff889b329687f
MD5 c060ed17b0ef9c6302698afcf9f9cb8d
BLAKE2b-256 c678ec6b0efe142d837eaf2d6cd177f902d697d2d84be870545e68a864ed515a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d880d6cb9d57d860185795b7d18254562de1121139ef7ab8362d7326258ee9f0
MD5 f841ca9982a1df9eb9e53fc78552cabf
BLAKE2b-256 2dece519d3e17d12efd25705726c88bd5774ceab94c598381c387d164a32b328

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 ea2d69f22c761d3482c091d49171a0d2b22ea521743ad81b0d6ae61064add060
MD5 9c99a74dc4021f3e69d0ec06b4473e0b
BLAKE2b-256 14a27231a970849106a058966dd73fa07c316c05256a065dd40098d81605594a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f75ae6920220c84326cc5272b1b56b8ff1beaad93f8a31a3663f16306c801c6f
MD5 06102a1a456f4dc95af07cd6e62e065c
BLAKE2b-256 52855dbea9b399f1ed6f80f415d041fed280e5d41baee5ef6983ed8bbbf9eeca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 f4de53c699dffeee7069dca282d3b7c91c0059783ea65745e93b93d41755c229
MD5 126a7ad7a4d71cbe36aec6ed0a18fd55
BLAKE2b-256 105655d683211d85811bd4d17c185d595e6bb641b3d88c5fc965dd7f65b96be7

See more details on using hashes here.

File details

Details for the file zenroom-3.7.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.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2089dafc6d566671094adfbffc005151d344e616c7afa22ea5871b7b63693281
MD5 0675cc44f2546fe2c0fac254d5d488bd
BLAKE2b-256 9b520484175765710144706996bda6bcc19d341c2f40c5324eb90c895dd5f6d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 14b76d0bc7dc972660b1d99b25265b272f770502a8b8d9d9d075d3a1a2e7c07a
MD5 13bdf14fb956e8611969f4f07095541e
BLAKE2b-256 2fc89948926c971190433477a56d65b847295fb9f21709bb202da4b66df0c214

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d804f1617d08fb9a76e8a3a8a5888850cd584c665e2ccb04370ef48fba08969b
MD5 a4d5c8ee2ca53658ebaf656abc16a67b
BLAKE2b-256 15d238e38dc18e5a269a99ed0cc6676e22759d291f75f2d0ad7ae26eba2f4875

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 82a900e284272ba120721ca98898aaa00a5245e44fde467edb5ec9c3412c32f7
MD5 63bf93217f4f92c4f25b2491cd057ac7
BLAKE2b-256 5f27fa8bbcde02bd88fcd5f831465fc4dc99d5dfa9440131ba4325d291fa6ab9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 68ca0c3fa5007916438b5c8caa86594945c0a91f356f04897ae76cb5a93c6f28
MD5 6eef91433f1eaaa9c58839caa0e801db
BLAKE2b-256 e6b06c0eefc07da95091861f8ccfb055d7528427dd1d43dba26938c11e3d9d80

See more details on using hashes here.

File details

Details for the file zenroom-3.7.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.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c25ee2e46778ac65639f980336b3d564b3fa91e5454d36063236a01f4de4e5f2
MD5 27f69840ef12de8c60834c2fde0af37a
BLAKE2b-256 f67eabf09dbbe25c7f89b3470b1f3f9dc18502c37f2b8fff8c44dc52428d0b1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e10f51d709844313f5870b874b9a894b17e57210b536b2b5ede79e8fc9887141
MD5 7da895bbb419937fa7849365d2c9228f
BLAKE2b-256 d63cafee4d0bb71ba1679676d4c61ad0d8a0df8a8c81e9dface58dd5c316b051

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bbe0a0bdad1f95298e1907ec90b8bacec4494b0efd4ac8a86a35d4b717698c33
MD5 90bfaaef5fc80b4c990a713d75545a99
BLAKE2b-256 6adfc96720ec569c9870dcaf9c60606c403f95893337ea6190bf2b6e9f50f640

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9bc1ef568ecccdef1d2240ca76635a5c01507fac74ff8fc7c7ff7899f2082cd7
MD5 c95d922db92ffa28a0311006ce96ebb4
BLAKE2b-256 3b0426a7882fb1681593412f96f9d34546adc1d3f9f5ddaefea6b4b36e10f041

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 6b4a1d4af310edbcfabdf3794e4ef54e9a75969545c888ea22ec8237a6e545dc
MD5 388a087d2f266fbc66630f42f39b412b
BLAKE2b-256 0e9c5b6f762164ac1a1059269735b2b534ad9fdb1474895c64c7352bba758aa9

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