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

Uploaded Source

Built Distributions

zenroom-2.14.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.6-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.6-cp311-cp311-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.14.6-cp311-cp311-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.11

zenroom-2.14.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.6-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.6-cp310-cp310-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.14.6-cp310-cp310-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.10

zenroom-2.14.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.6-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.6-cp39-cp39-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.14.6-cp39-cp39-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.9

zenroom-2.14.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.6-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.6-cp38-cp38-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.14.6-cp38-cp38-linux_armv7l.whl (877.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.14.6.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.14.6.tar.gz
Algorithm Hash digest
SHA256 03dd78b14f28148b9b768a826dbd0e26b5c70098d7f02883c4b6ae05683e212d
MD5 270918bb5f9464fd02f1aef2a26ed2a2
BLAKE2b-256 80c638aaad44ada19cb30a829a12f5c937d9040d86496a5ec51ee978d6555ed2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0a97b885e051877465a6ab507dc0d6df18345838064a0f3ba760e6937268e0af
MD5 d74bf0abd42dc0d7419368041df229f7
BLAKE2b-256 7ebe1f81cd8e9a12c8dc07ea8bd67f5273498578c07a12cbddb15b444ecfbcb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 aae0b9950218d5bc97a4e19f23136b398ccb42c59e9e72cd205f90267965337c
MD5 9bef49ae1c56d4df3816490f01e88cf8
BLAKE2b-256 548934345ddfb642bc55d3258891937174c5d0aebdbf7a0275eb17d6c5cf222a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bce4f3a63dba3cd0cc22392b61a549fc387910861c0790bbc28762e6b14af2fa
MD5 8ed6b8b1d8e8adc54c5e22edc38559ae
BLAKE2b-256 ebc511bd652236672207c43f1951fa91eb8254f3b7e6ef0bdccad8bce2f157e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 14e31aa796830caa92b36394c647f9930d2df17d7bf091faa0ec0340d193b7a7
MD5 589bf4e84b735c2fa5e646d9051d79b0
BLAKE2b-256 80b90fa4469c7a76666942175c01507679134c874c01717f6c1a130b0149ff19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 bf5293379eb5d4b34ed385dc499ef6ab9995ca945767aedd5fbfb80b54c62fda
MD5 9d9bae4a51b614cb08f79c53da191ebf
BLAKE2b-256 64984d969a0faa526287285eb584483e17d131a97383b2a0a845717bacd7cbe8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3079ea1ef56283fbc0814fce0b8d438c0708a5b27b68fd03e5f33826b2f3da23
MD5 5190f03cc4d5780c65bf7672a5ec80a3
BLAKE2b-256 b7fa3214ab58be8617d6e57ca18ac763d08a42747333bd18d6122fac4c6d2343

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 740f49681f626d1dbec3caa04d4b61add39ff9c547ff56bb03bc7d43735f5e5f
MD5 5cce5a2a1424fe02722eadc52c84737f
BLAKE2b-256 d940d49f68b46e1a24de21dbe0e92743e8afb30fb4d6861e8f4e4fe96e887fba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c3a83098584608cbaa98cb943fef5271b61dd17cca4990219915d00f98264965
MD5 e13b9197ff86860f24c553a4dace1e08
BLAKE2b-256 7d3ab90ee6cc8fbb25b9785e109c67e153ae43e012f78a4133fbe10eb53727f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a7e8ef89c007648253ad3ff7dda27b70e12f2387bb0197a5ef37ab0731b0b89e
MD5 507fcf15e9573603d1e442da8a833702
BLAKE2b-256 25a182c620bd8a828d26d51381ba71d128c9fd9eb6e0cc863c096d69ab48f812

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 6f7293ae04b7da831163d19fab66a86f08d8ce91b3701f16cfc5b0966d109e4f
MD5 c16669b15cee470241e822f019929d6f
BLAKE2b-256 5947dd384983d7a7f6867706e2b11e494a04c2758f535b8535beb91f57d9a177

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 87e1d1a631cdc4d3fce56e897d063ccd8f7d5740d35ae070c0e7ac7f5cd63845
MD5 43fb0c97a4722b4ac26874f010a31816
BLAKE2b-256 de2176d672e1c4b9d0d4751f7a08394f7497f0abcf2eaf1833ede5c63576b2f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 bf835e9d51fe716487c6d97b7be1184e02aa3797c8ef8022c3590f85e2ac4ca2
MD5 c663e3e80cd2da1582de16a5df0a736a
BLAKE2b-256 f0d4ec3ccee8a879d7b0dfde0685c397678270ae665ed2f898e3507dab403272

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 2aa5a6ecea33a29ee93d5009a46d623afb12f3d8c606eb340986569d2c9bc523
MD5 ba72d4aa8d855ede2385a86d5dfe0d56
BLAKE2b-256 ef39a8ab640ca0b72f55ad4c886807bc982c8cc72cac87f0496a369cf255705b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0c931162c6b250ece9c6f419cd8e67eceb8a52aa9f7bfe8707ad764ab62fc980
MD5 a23fb9eaf483c22e336c3b239c0055be
BLAKE2b-256 40aadccffe557f6b7d943889b29658f3f931c0bf1df8b3c556a038de7594f4c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 a207d09f772f1892df750ae13a3a778c4ee903bbc88e1ec23e4fabcbffa3c3fb
MD5 8f4f5f9a32ae502c3ea49394dfcba61b
BLAKE2b-256 659019014169e343029811d0f669902f8547f997816dbf84e223764715f1d350

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b976e57749266af48e4caea12729d2692df28fecc0429f78d0b2603f76cd1218
MD5 107acb721e4cc3b564cc97c360499513
BLAKE2b-256 c32ec7c65a51ac2231be35d449b037eb4bffc0f9a0ca796aaefa44a35487e670

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c4642baae5508fc9bdd9c333ef7aaf203a358273943a950e8e96788e26c2ade9
MD5 178a6bc05f4b1bc7ea559d7b5528ce89
BLAKE2b-256 e68c2480f0335b8867506a01222ad8e21773375dae49b8837f9c4d8ffeb46078

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 eb10844341a025110e93a331d8de4c3eff103b173ca5452ca9b688f1f15c9c0f
MD5 f71a2d8987dbfd4b24ba9aee8e55a668
BLAKE2b-256 1e5bfd52b6378e961f5a2fd581ed54316a77f7999f33731521f86ceeed01b3b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9a87d2c84ba189021967a8bd05f85d2659f6e914f85c7b1dc24970430a896621
MD5 a3e41812691fdf4eba8733ea3295e28b
BLAKE2b-256 b5781b619dd364ce07a7cc82c40150857eba9353e6d50de82f276846a2e5e703

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.6-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 986c3de9877d570fea7e7047854f4a9d6794bd8ad029e67c2bb338d331475196
MD5 f1ca1ff3b564274f2a101963405b2b5e
BLAKE2b-256 205b8791d8dff9a8713a5e7833da19ba8516393cac920530efe2048ccd3116bd

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