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

Uploaded Source

Built Distributions

zenroom-2.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (904.8 kB view details)

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

zenroom-2.4.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (915.0 kB view details)

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

zenroom-2.4.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (847.3 kB view details)

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

zenroom-2.4.2-cp311-cp311-macosx_10_9_x86_64.whl (764.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.4.2-cp311-cp311-linux_armv7l.whl (855.3 kB view details)

Uploaded CPython 3.11

zenroom-2.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (904.8 kB view details)

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

zenroom-2.4.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (915.0 kB view details)

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

zenroom-2.4.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (847.3 kB view details)

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

zenroom-2.4.2-cp310-cp310-macosx_10_9_x86_64.whl (764.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.4.2-cp310-cp310-linux_armv7l.whl (855.3 kB view details)

Uploaded CPython 3.10

zenroom-2.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (904.8 kB view details)

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

zenroom-2.4.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (915.0 kB view details)

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

zenroom-2.4.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (847.3 kB view details)

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

zenroom-2.4.2-cp39-cp39-macosx_10_9_x86_64.whl (764.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.4.2-cp39-cp39-linux_armv7l.whl (855.3 kB view details)

Uploaded CPython 3.9

zenroom-2.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (904.8 kB view details)

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

zenroom-2.4.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (915.0 kB view details)

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

zenroom-2.4.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (847.3 kB view details)

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

zenroom-2.4.2-cp38-cp38-macosx_10_9_x86_64.whl (764.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.4.2-cp38-cp38-linux_armv7l.whl (855.0 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.4.2.tar.gz
Algorithm Hash digest
SHA256 0290f0644976e17bcffd696520997e506c47fb6ef1e425cdd3e06c54aa165815
MD5 2cfca035d5b97dbac109d72b4bc7a0db
BLAKE2b-256 702d054b85df51059f1001140d47387b34f4281cf004e0455f9f3aa671ffcb40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9b5f435247c4ac1df9d3aae0b68a4f4ef87ca76ba7ab352586071536b5f605d3
MD5 d481905c7c312cebd0c96127ae463643
BLAKE2b-256 f0647984a7749c2490f10b593462c919f7eafed3bb394c4e228d1b0abb7bac4b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 1fa9ba3c81ce653860a1b1756b14356acb442d9ff9c181832d9ef43c361c036f
MD5 37dd160c1bd5ac8b3f25ea1d21c202b5
BLAKE2b-256 90c00d4e6c6cf4bf98ec941c902bc4e5f613b3ef1d70bc8a2a99d821c5176a72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 5c86e8719329eccebb418ac679fe81b3a19601e3e2b5b93e58d56dbc96732fea
MD5 b1dd3e43edb3adb9df05e1c6c4d874d6
BLAKE2b-256 1808b39f15c28dc2e467225a978dd53fc02460d0eb96ecb525206607b870f51c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d0ff069c011c0d2cb6a42299b8c1650a5cde48ca9e86a2fcc998477e78351f2b
MD5 fc4e33c4f649898dbcf85e2a93b26c0f
BLAKE2b-256 1458bd9d0454b21889ebcdc62d81ad86f676cbe4905b25f7ae688f12e16a725c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 875b03b96b7a621fbc9393ef2eeb8cf822bc7f7b1ddc3d8f298123cac49ed9da
MD5 ab395afc16bfcf6a2d6b64ea6d1e6a78
BLAKE2b-256 c83e6a9d9d5f8e8d199b64701a64040dbbf560bd79a43919102c8e870db12949

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2b558e7a714272412a7ae18c112d70356d36b33e898f63f02c5ad5138e2f0ed6
MD5 4b4c4ee2549b97353d02e992453a3684
BLAKE2b-256 a41c44af503207b687ba0f20e489f6b0db73edd9e06488ccf8ea17368706af0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 da6aa94bf3bb216f5560f91ad38e2317d480b63ab89150109a80584ae51c1084
MD5 7cea671f282afe56310864beb6ebd9e4
BLAKE2b-256 09a38e320c336713fba8ba9064f19b48ed046383594beb87e9868730c95cc28c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 be7c0f3fac065c27e4678a31347afde4a9623643dfe8bb4855af5c41f58e1d44
MD5 e898e7db7abb940bf05fdc559b1788b8
BLAKE2b-256 c9c82d0b943bf7f116442caa41c2316a151a4f771cc44b2ee17777fd3e7d57de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5c41f41e48360ac86de9a28a751804a1b2bbb8f2013c459ad8c52cf26c654518
MD5 2e0857a54499f80851a579ee3c2c7b6e
BLAKE2b-256 7ef4ddfbc1491acac5477ac43b3550e25c394860327c8ef36d2d8e04a5c079e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 7f4496a9caa70dc38c15162d62d0deff7d23a4e7b2d13c511c25e2c15f472c65
MD5 524d93947b65ca1451a67276902ec975
BLAKE2b-256 fb00c0be020443b8500362ccc0db9f3d2d66261128c8be72d921dbe0f01e7341

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 fb41a4e89a1b8d0e012200df641323fad88b8e74efe0c448903900fe56971734
MD5 59d818d6ad9e09acb77af184fb1e80db
BLAKE2b-256 f43a97179e411f31b56abd7935212d8537be52ee817c24554a9a4c34729e2489

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 36682d4b04185bfda7848feef7f11302ae90a12c07529202ae3dc905d5abc84a
MD5 6ce234c73857b87cd875b60692891f9a
BLAKE2b-256 3ad64859d16759d4eb453b7c7d8a08bac43db7c04b241a9dd020f6bd2622532e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 4bd57b626288c1c28b5e4e99d8e558c159e7d7bfcd26c7525b9278add668f02a
MD5 244ee640f31cd6c876d1cea22479a014
BLAKE2b-256 f1534451957db8f0ba684daeb890d2495861152a455950b8eb6a08d635625e09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7984a0b81d06e9d1a128c5bb1f996d4cd0f4078853e9a7b249fdac3fb40d92b7
MD5 2c2d930e199f9f132a02e7a0a5377542
BLAKE2b-256 90b3de50dc1f61f957e7bc3bb92f1dce57fcb27ae03789e0789a9f8d53ec0652

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 a2c0588f2011fae329077e0414c0c60481e1f2f8b3f2ebc65ad1b77242e74b18
MD5 19c6f3b1cfa739b5899f9b0dd0f41cc8
BLAKE2b-256 9c4a3c5ba4763d8e9d698c921844f2d2ea2727ac0b14993ea0d307e8a1bcdaa8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7aa582184222efab6bff7715c9a8cb50cebd90cdeb1bc9bff7da07bc3a081031
MD5 716f731334719e6543c7640699a02ddc
BLAKE2b-256 bb5b0be1e6664a29017e0debe1287416b55904659e5e48c99b0f0c1ab81d7147

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ada88fe2e55e5005d554af971ecdefd385b18c7f923b689b0efbd29bb77bdab1
MD5 506ab1af32d0c789c0c94c9c4d747c00
BLAKE2b-256 54aed0c856ea46e359752c5aa674a7e2d34f280686ab8d0dd2d521ef753942d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 249fe88bee6b688b29ad6c4ff18add36f547a8684a84ff4a921c2fc3e13a75fb
MD5 3534db125186e00fc97163267ce826a4
BLAKE2b-256 433bc69b9d53462bc9030387fd8d417ee7f05252e0043f26593bfa1f26a11578

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 100d107e4fc64eb42bf1d9689c883d9ddc9da4de5a13b0e4fe0c44f259803998
MD5 9376b9bb4748e43f72e9b3bf4590754f
BLAKE2b-256 0c7b5fef9d9018472574feb33511065a8e5e74eb1f24c1395d718e782298bf1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.2-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 1162afb103112b41fbbde0b71e1b3fa9c74c58492749942e36c51e00f50cdd64
MD5 49a9945fa5307808432badbaac64d0fc
BLAKE2b-256 91a869851b868e0956ea82314e09fd126e26c0fdb76e0b3ce6bdffd679d6daba

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