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

Uploaded Source

Built Distributions

zenroom-3.14.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.0 kB view details)

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

zenroom-3.14.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (804.5 kB view details)

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

zenroom-3.14.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.14.1-cp311-cp311-macosx_10_9_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.14.1-cp311-cp311-linux_armv7l.whl (784.5 kB view details)

Uploaded CPython 3.11

zenroom-3.14.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.9 kB view details)

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

zenroom-3.14.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (804.5 kB view details)

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

zenroom-3.14.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.14.1-cp310-cp310-macosx_10_9_x86_64.whl (661.2 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.14.1-cp310-cp310-linux_armv7l.whl (784.5 kB view details)

Uploaded CPython 3.10

zenroom-3.14.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.0 kB view details)

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

zenroom-3.14.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (806.6 kB view details)

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

zenroom-3.14.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.14.1-cp39-cp39-macosx_10_9_x86_64.whl (661.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.14.1-cp39-cp39-linux_armv7l.whl (784.5 kB view details)

Uploaded CPython 3.9

zenroom-3.14.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.9 kB view details)

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

zenroom-3.14.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (806.6 kB view details)

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

zenroom-3.14.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.14.1-cp38-cp38-macosx_10_9_x86_64.whl (661.2 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.14.1-cp38-cp38-linux_armv7l.whl (784.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.14.1.tar.gz
Algorithm Hash digest
SHA256 fa911bb513569a620ff02c909fd6c2000917591dcf490c0b8d545ab50753e398
MD5 d01518823b15fdab8a21ee66f68596be
BLAKE2b-256 2852cfbe5d9f7d12103fb4cb91b4b531f7c4c66b7074c2b808f08f966cfb8a9e

See more details on using hashes here.

File details

Details for the file zenroom-3.14.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.14.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b6f98bf856f2177a5a645e0a3f3b8a72dff1b341bc6ec5ed866327c05fc88b57
MD5 3dd94b813a128df25556e6a47d6f8352
BLAKE2b-256 9e3f508d3fa6c3d2b9b7304cfeb4c35f1d658fdb9c277b16c436a3a75f06ff0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 09fd33838ff94d6661aeb9d461fa8149c174f64d3b76208f4d12a57e7a36bdeb
MD5 061036358b540363eb1e53ef311c06e2
BLAKE2b-256 86cda85bce4a485a045b9b117fbc6283a5f56b1e1bc12ef089275a078aec7aa4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0d821b384ab241b59b0f8b9b5dc244f45712818786094b056249c0d11040be58
MD5 15171acebded876a93ed5218fe4e9f80
BLAKE2b-256 c1c259fbfe78a8917f5d3f51fa67006774730f1723f25ed103b669f49fd4b0f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 71ac7dfdc1a248e3d1b684ea1281ffbc51bbd6af0d301a8e4f3219c4b824ef39
MD5 79695a4f3be2a3507da912020bba61c5
BLAKE2b-256 05d903b04a7dc3f3bd57a9dc546c09cb04448e2a985521f04f4612b80ecb23d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 e4ace58c05ce6b214b4bf97ef6c8b98b5b362686d4c0b036f56763cceceea112
MD5 633d34fd8c6c86fe5ce7e913e492a49d
BLAKE2b-256 b6d3baec9dad6f95b230e216d7befb266e39dd2b5dc441e05c363b7d5585d88d

See more details on using hashes here.

File details

Details for the file zenroom-3.14.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.14.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 388e2957bc44986ee5570aea357b9f08eaaa09dcd9b017689d3f90803a284ad3
MD5 2e3944fd4c236521abc77ea8c0d696dc
BLAKE2b-256 8f6fb6f5fb43c78f5c7f222c468249b2e667cf2a37051d83b69035aa11199fdc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 091252c7acaf0139dbfefde686f7cd17b725e4aa56c71c12f526bf6d5c4bdb89
MD5 5e57167a208120e781ed5711e1ff8256
BLAKE2b-256 d55186a7af3a89016714b390418663b1254cc3ab0f8046f205dd53dbb56d103d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 3dbaabe8f2bc7f48524b9525652cd89735f9768009901876ff6eb32755e38e8c
MD5 9b66445f6e35a4dfa95fda9e04a96c8a
BLAKE2b-256 4791b9fed88618383a593b68b3262d861de0980d989697f2efdb4e5313dd41a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 73e2dc0c6eb3b135855097a14ed1cf79ce07e7ee366270ec5bb8cb4fe6186964
MD5 40cc8104771063e5d07ecbc1a77342f3
BLAKE2b-256 5357a304c7575f4f637d5a7231a735aebf566710a45e218b2ff1394c34668bbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 018aa8baf2902bdfcf3d7278f72bf3d2565693be3fc34527d514283ca4010e22
MD5 6af72ada2512edc5c313acca8d8abc58
BLAKE2b-256 aa406e7a575cef8790093425aac664d5ee5fa49a0db9a2f60e2d0c9a040b7f13

See more details on using hashes here.

File details

Details for the file zenroom-3.14.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.14.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 662834f7f62cdaf52f14afd7dc1721f7179a22183c97683bcecc21cb6f0fca61
MD5 1110a3365063a91b892d277331ccd104
BLAKE2b-256 a9ace284081fe0e2e9a5ec91f20f36407dec096cf2cc210583842b4fdef9a6d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ede2b853b7163e099a1d8241f6c48602e07cbf826ce13e7d041cd7e4a3ff6580
MD5 bcf9e09a3e22b207969034ad9327281b
BLAKE2b-256 ffca76d568cc1a0a9617ac9798d6e5883924344b2db08c198990f23d8f6ce955

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8ddb66a623070850e44292d11bbb3833474449bcfecc9c60a90027d322ddf219
MD5 9921e611aedd9a13417d9a8eb3c0f75c
BLAKE2b-256 6e1810c3d7adcdec4ab8963760fd8cc9bfc19244f4173399544e83687ad2fd81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 54ab2afa70fc8b9d6bc1b395bb3d7fa55c541e7e40c0a41645857f7c62e2860a
MD5 3deda5f5681840c178efc3f79e7c6210
BLAKE2b-256 46b5f5abb1822e8b2d8eceefc2633b9238024d90061bad7957a4e01b6a6e153b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 9c40d55cef8d934f29bef993154f095b988f78a6641fca4b26909231c4dfbc44
MD5 348ac5439e7ae6f1ff3c78aa51c87d10
BLAKE2b-256 7112bbcea268868219daf93841063fec3c3b378cf2ba1f12a27fb4f504e1239a

See more details on using hashes here.

File details

Details for the file zenroom-3.14.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.14.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 fdba087b35cdc041a3c52d484bc12164ddd7c04cd4a0d4e9d68a5fac9f8a14a6
MD5 c0939a8f8670c87941eefc006227c68e
BLAKE2b-256 15e1c0c618e38a81602ffd2cc6a76dcb65f500e588bbc4fd037d81f3e6b4fd95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 94f017bb88f489876651ed1d9e006fb5ac5c8ec01c9e5e0e5e2cdf647b2fc1c1
MD5 0d006aa0e027299b6410622f43a1f8e5
BLAKE2b-256 93637d4d509758986e281a7316d921f94425d706c6d24ccb96474922f00b354f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 fab83296b07b5ae11cbe0fdf3ad05223b132b776d00d6f78b0a6d63bbfe5b5db
MD5 7ac792c251ffc6275a4784a5712fe1f9
BLAKE2b-256 d039673736fbf172ec153097695868fe576bfb1674e9093cdd1d30cbe9ef951b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 887d50468e325f47f9bcd4c9837fb4cae316e9b58d68dc9131735c3d3bccd2dd
MD5 2abd98f2d93fc74349cfd948eabefa26
BLAKE2b-256 69d4782e57ba0fce6c4b4f75ba2cc3dde7f2f6732d4f54a3d14c18cea77cbf3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.14.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 7b8b378773bb6c080274783928bcbe87540b996a927389928a02e3d2a7f14f05
MD5 97e479a8b1aa33074ab01bda07672f72
BLAKE2b-256 eb88e3927da51f4d21777a761c332cfa12c0c27e0a912a4a7870eb116d281233

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