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

Uploaded Source

Built Distributions

zenroom-3.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.5 kB view details)

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

zenroom-3.12.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (805.5 kB view details)

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

zenroom-3.12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (754.9 kB view details)

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

zenroom-3.12.0-cp311-cp311-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.12.0-cp311-cp311-linux_armv7l.whl (785.1 kB view details)

Uploaded CPython 3.11

zenroom-3.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (797.0 kB view details)

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

zenroom-3.12.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (805.5 kB view details)

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

zenroom-3.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.4 kB view details)

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

zenroom-3.12.0-cp310-cp310-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.12.0-cp310-cp310-linux_armv7l.whl (785.1 kB view details)

Uploaded CPython 3.10

zenroom-3.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.5 kB view details)

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

zenroom-3.12.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (805.5 kB view details)

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

zenroom-3.12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.4 kB view details)

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

zenroom-3.12.0-cp39-cp39-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.12.0-cp39-cp39-linux_armv7l.whl (784.3 kB view details)

Uploaded CPython 3.9

zenroom-3.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.5 kB view details)

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

zenroom-3.12.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (805.5 kB view details)

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

zenroom-3.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.4 kB view details)

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

zenroom-3.12.0-cp38-cp38-macosx_10_9_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.12.0-cp38-cp38-linux_armv7l.whl (784.8 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.12.0.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.12.0.tar.gz
Algorithm Hash digest
SHA256 f6abb23cd4546dbb63b083d32eb1029f8976a9f6d72ccbd402766786816ad7fc
MD5 bfa0e130c9eab691b8534c65d11e74ad
BLAKE2b-256 bd2c54da8c0898622112789755a98c5d964cca0b48131934aeb220a73e356a06

See more details on using hashes here.

File details

Details for the file zenroom-3.12.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.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 5b1070b2ece20e924eab99cc477c567ae2855081c696303a42513bc4dee675a6
MD5 159246c49087f38519a1262164c8f05f
BLAKE2b-256 77b063ddce36903fac4a4ed7e424ae24c510dc5de5473a90ee32944b19f83a42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b126797927a16742a0405ab79a6c1852146937e535dfe44ed68f2616a8c67845
MD5 46eefbcccd1b493ab92f97e755fafbc5
BLAKE2b-256 bb63e67cad0198587cfa326ec16cf383e39023b88cd5fddf266bc4cdc6a941d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0c91eaa9aaf23cd942b6f5c965dc71b9303d185daa90a1684bfc08198ea8f153
MD5 8a812f52769f5d32f2d9b831f04a23df
BLAKE2b-256 af4afebb6499fdf53a82b8c5a394d6201542d3febf531787fcebb97da3131064

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a79537e21b6be10a19b11945d5af0f86e65cf22a75c63bc32650470116a792fe
MD5 6a7693accee74381cc6e38b5421f8dc5
BLAKE2b-256 94440b45308d1033d2afabbb0341e05ea0560cae6e1e2f1d9d6c558c08591e4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 24ef55506b13feb1641f4810a0df185b9d377a485c467b7b9a79460495d0ca95
MD5 aabb5740bf2668d46dd25666393f6dee
BLAKE2b-256 f9ef686616dd52c725f6448ae47143c0aedb35088d1edf2a463d08fc9b3f0d0b

See more details on using hashes here.

File details

Details for the file zenroom-3.12.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.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3873294827cd34ed34b62439006cf3fb399158d92ef671c24d4c1b9b6adee78b
MD5 eda39e04114eb78cd0857d16af447377
BLAKE2b-256 59b0ecebf125f8f970069102be54106f7f8a2f96f9a617a5d4b1f2dbae68507b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3cc364210c41534080738735206f7fa3a36f631fea130d2cacc4836ece249538
MD5 5e172c665f6a69930cbdfa64412fc88a
BLAKE2b-256 d78a0c7d261e9ee39f2465754f1ddc0c95304b2ddd46f18b810a969589b851ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 65af7e3c371111c38ba0dbf43f77923e46aa05252543111759aa1baf83552005
MD5 d1e056f7c77ba5ec1b383daa65467134
BLAKE2b-256 52a3b07700a152f3952d9088435ac829cdc1c1412e6a692d11187f16bad7c6d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 00da34e336eceb9b312776124760f11bda67a755ae3271897f3da5e0d974a900
MD5 0bd3b8fffd893c9bee93caa101a2b43d
BLAKE2b-256 f323225c148716cd1116754ee1b30e40992f6b9297845a9d91a64ddb96fcbac1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 79fa8d2fdf2cb168307d5ab0d0eeae8d0dd59136a0008350995cfb017874b75e
MD5 c221afa738628ef4c9e2b131eb376379
BLAKE2b-256 eade5f7ea0a0eaecbf95cb180ec71ed10771c3687a0e8ba10de6b55d718b2fd5

See more details on using hashes here.

File details

Details for the file zenroom-3.12.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.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 6b5ab27f40c4f6745c73051fd03d243c5b8df200aaa45ec29f30e62f0b05fbde
MD5 c6b6f0869eceae81bbd523688f2359bf
BLAKE2b-256 fa8d079fb01e043581027380eec0c808e5e5a7ad9e9d44320477c83576d79a11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a8af32872eafd2e7f40c185d68aed88a4aba33c943e3167ff64b1a3ad1710409
MD5 a92b72b1c27f175a9e057de369f6482a
BLAKE2b-256 387644b4c05521a3698484d18ad53629ef0e201f347db104495a9298d97564e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 84b6b59f4ca7be75abec4853c491cb81dbdcb42765246b951c63b82200750163
MD5 bb23510b966aaed4b905a08b0b50d2b3
BLAKE2b-256 f9b9f9f4c76f11d342585a6cf41854dc6b6b939f07f44a02688c8b09aa3cfaf3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e8f5e685134d61661f9c0d6f658f98d0ee9b0450827cebca8572ec7f59ec193e
MD5 4e82ae5e4390caf12dff140a2eab0025
BLAKE2b-256 8638551c55e0df066db685e3e293a5aabc3446118d4c34619b258b43cd780d28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 d59285f03ca423f96cadcf75d0e0b9835a51da55aa595dc5055a5eb01eadafef
MD5 868751cade7346eab23e06b5b0c3a386
BLAKE2b-256 9a5ca8ada83c9044a061e6e526f1eeeda0344502d421353a1d3b775b4cc2eb7c

See more details on using hashes here.

File details

Details for the file zenroom-3.12.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.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e67bf976bbc747cc67e90ef13be52c56d7a22f10fdf87fd725ef7840bcbf7301
MD5 09672428fa03b66feb2b6fd0a5788ff3
BLAKE2b-256 f2355f73e71c543aaa8c9c2876e04775b8d072d879d013c49702718131348352

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 523d4d0363d9eb1102002d2b063758e25051f63fb9fa6e093035862fc702634c
MD5 aa107c5c00d367c8ccc0bcf6dad520cd
BLAKE2b-256 d62a745a886f80bfe580d943a9b3ca21f282041e187ad851a55cd7c300b95318

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 626b2f544241eab0f6e0eeb2db95301d6d69f7f5876d0efc3bf6041ade4f0323
MD5 f3bdbfa527c9d8c01581e2d73bbadb34
BLAKE2b-256 5ed05a9368767831a3a630b4340e278d05bdce66f7aa4c72c50dbc118e0af887

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 36a3addbd54ac9c5bb2146277dfced11439c7c414ea0966f0fb24cb7fd4aa1f1
MD5 e9bc5311e366e8b73bba6a4945dfef53
BLAKE2b-256 68cb24e8e65ed44ed1ae277c8e903ce11875d249ecae886ee5184678a80edf2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.12.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 7e0d53792343718353f8c64b43065ca074bcf9d625637fffd6ce9a10d3007360
MD5 29a8840ee8210ba6bd04182d48e251fa
BLAKE2b-256 da939c4983f3005907fce8f1587412f1d9bc7ce91301c373dc21dfa0dfad6576

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