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

Uploaded Source

Built Distributions

zenroom-3.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.7 kB view details)

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

zenroom-3.17.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.7 kB view details)

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

zenroom-3.17.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.4 kB view details)

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

zenroom-3.17.0-cp311-cp311-macosx_10_9_x86_64.whl (680.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.17.0-cp311-cp311-linux_armv7l.whl (787.9 kB view details)

Uploaded CPython 3.11

zenroom-3.17.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.7 kB view details)

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

zenroom-3.17.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.7 kB view details)

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

zenroom-3.17.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.4 kB view details)

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

zenroom-3.17.0-cp310-cp310-macosx_10_9_x86_64.whl (680.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.17.0-cp310-cp310-linux_armv7l.whl (787.9 kB view details)

Uploaded CPython 3.10

zenroom-3.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.7 kB view details)

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

zenroom-3.17.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.7 kB view details)

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

zenroom-3.17.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.4 kB view details)

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

zenroom-3.17.0-cp39-cp39-macosx_10_9_x86_64.whl (680.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.17.0-cp39-cp39-linux_armv7l.whl (787.9 kB view details)

Uploaded CPython 3.9

zenroom-3.17.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.7 kB view details)

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

zenroom-3.17.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.7 kB view details)

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

zenroom-3.17.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.4 kB view details)

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

zenroom-3.17.0-cp38-cp38-macosx_10_9_x86_64.whl (680.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.17.0-cp38-cp38-linux_armv7l.whl (787.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.17.0.tar.gz
Algorithm Hash digest
SHA256 37ea4845d2e8fba944354b70ba988f4eed6bf96e75b7da23cc8e5e50ec6e3bfb
MD5 166a6cddeb1dafd59afff9c8ebe1b5b7
BLAKE2b-256 de83c3e15e8d61bc2f85105aa2a8eef5c13c204d933d8ba857f6d5e44544850f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 56ca909e6bc53851ce3b15fcbf4ec53c7d7d2d75bdef9c67c32af35a04fe3622
MD5 b20afbd63705710f9a6fa282b8d5c90a
BLAKE2b-256 44d9da9e9aba1ae8799cf07d9baaccc7633ce4e83bc2ea9927bb0bc44bdaa474

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5809db9d7c3f2e913e312e72b4b9a576e431e199ed6629192737fded07152434
MD5 feda665e1f9f72a0193d3e46c0fed664
BLAKE2b-256 61ff4454f9767427576c080b3553bc3d050a58294e9e20f44338e50dc4a73093

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e1b72cac797b5295e45bffdf0ebdf976170333b03740103a012d9b94e62adfd4
MD5 946f265425102574f4e8c62e8ca5953a
BLAKE2b-256 5e19b1f593bb4d6bb88597f726e004ea9207caeaa9cb08bb81529609c886a07b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 786aed5a1ebd92a9bea852694a4827997e7fa97ba996f90d954790575e4ef1d6
MD5 5ca56a930708525f439ef892bf531d49
BLAKE2b-256 8d181f9a37baac070b2103a39689893b351c844eb0821ea7b1e31fb552a93bec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 4883c6c77fe9db434167faeadb0fdd478ba0e3a560d49807180a2865a43d0e34
MD5 9d4f76e356c2836e9f65402ca46b4ef7
BLAKE2b-256 0982598f5a22352519cc1402f72bd09ddaa005496b59576f6f9928e59f227780

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d7fe8b1348493453fa8898f7de77df41f126ac7488ebaafbc12ef05a223145a6
MD5 df500f5cba868c6728a71036fe4a3009
BLAKE2b-256 2f6668350c05d067c2696f653b3db393fa3c97cba549a9b7900e32675a9dc1a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 514c1b9bc6db5b3079fdfba8d271684c04a4495e89fa6679b11bb3b0887286ff
MD5 711328318e58219d6490691be83b22a4
BLAKE2b-256 ada6775f5bc28e2c1b25fa3b966f99fc3dc2d3f990d10a5ac958c8c07c708d53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0054de659c3d02b10714e53d3b98faee4377949596912e2fb21676aa506471ff
MD5 7741a98b13f9a2b3ae830efafec8397c
BLAKE2b-256 4a3104d092a5e17ff9bb22db04af643a86ec1b800eeab069310cc052e4cb6534

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f9faafe7c4a0dfc746eeafb896c6ff992d4831e4e97167d55deef8f7be193f7b
MD5 0ca8af173842ac51eb1e212ac6861950
BLAKE2b-256 a1c218604577b008ae028142505a7b2479c218f48a5acd726abf6d47d30485e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 e780843e1aa0cf8d61dfd7ac29b64d90f1d00c5c67c6c0e2ed7607231207230f
MD5 9091dacc782c7bb3849f9353d8e9597f
BLAKE2b-256 5280eb1ed03dc6a900d60bebeb88cea2185b0ab571d6fac5bd08d446355c0067

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 bacf2dd553a5a59dd19c16f58d7defb024d563730bce527139c421feb3c05c24
MD5 3943b914a4b146e9f3f181568bf4aa96
BLAKE2b-256 2361aa556a93c08a7195c026351582eee5ae43961779f42e41e836771565ed31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9fcf18767ac8c3e176ab6c10a105b32b18de43d6dc6a84cc75a6c746f151eb40
MD5 033c5592de2b8a369c7460275f08b743
BLAKE2b-256 b7ce68d82de306461a40c294270f0eda09dcac7a18d337d2953f816ac0d99580

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d3160da2febf9d51446b87f347fce8bbdcf472ccaad8868c7ae4a0ef3e40e45f
MD5 23b4317628d61ad527366952c8f68d7a
BLAKE2b-256 9fcf6ab30b223b31677540d5ad0078e3511047584274e819f4f3fac292c62a4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fdc574637230e93ff783520e9bd7a394de2893efaf020f110b279f52a16e772e
MD5 066a9f8df13bdf2aff3cac51e0145407
BLAKE2b-256 775d8518f49ca6714a8bdfac38c88c1e5ad2711c0e9f17e141a8cab1ca9c2aad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 c8b0c65817eb725276271cd3cfb55c12448117e99094fe5f35c272e7880c716e
MD5 bafd8af2767339132b8cfe4a4626b04a
BLAKE2b-256 f4861391ef3daa8ae8115ccfca4342af2183fc0f18b6edbfc30f4bd35c72e891

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d9fb6d9b959c9026bf09302d100fdbbfcb61db375584131082922dee555f6aa4
MD5 a4705f6b23a903f2b3e99da8fb05fd7c
BLAKE2b-256 31533c7b53a8277e6b01cb7e2729e4e163b8c8724fd828817809f1e487316ce7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 23dd924bf9bc6cd4ca24189efa2cc9898ccff4059a0271fc20c4d3051ff6e6df
MD5 f445b60204004823eef75bdf6d3ee614
BLAKE2b-256 05a912a35c5d258dd32de8d1eec763204706841137dfc2536a9b4ec77694a54e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 4c01bce85bafd8f8cbe2a792c3ff2feefdb1a695e77bd5cac182beb2020fd0b3
MD5 315c3fea71154c94b0888b2cdf1c6e77
BLAKE2b-256 06c4f9a3de1310077d0ac94a31743df26e7b0948fdf9fcdba4b436249f22a15d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 900d6a758fa99b29d943de0e361a559bacb8c04c1cd5879664b824e1c163053b
MD5 e9b4652edad6db7a07624b36ab50541d
BLAKE2b-256 cb8ca3281b27bc2835e85b535de479c49f7b2a17f23dd9b7d8e30cda4608226a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 a8d7925a10913bc3814c1f6cfc83f4680ae7f306c2574d1d51a4132a754f76dd
MD5 ca99afd59abd4f363bb78bbdba993135
BLAKE2b-256 a8814893a30160c5d000cb005f649d78ee162136afbff69b8d52ed91bc6b9a45

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