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

Uploaded Source

Built Distributions

zenroom-2.14.7-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.7-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.7-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.7-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.7-cp311-cp311-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.11

zenroom-2.14.7-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.7-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.7-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.7-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.7-cp310-cp310-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.10

zenroom-2.14.7-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.7-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.7-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.7-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.7-cp39-cp39-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.9

zenroom-2.14.7-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.7-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.7-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.7-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.7-cp38-cp38-linux_armv7l.whl (877.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.14.7.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.7.tar.gz
Algorithm Hash digest
SHA256 abec1ab300241b2688ed76163f35050e2e9feac1ce4d590fce77bfab103cdc6d
MD5 101f0ac3c03ec2d071d879949af6982a
BLAKE2b-256 b7acb33312f4659d626e44260a7dfa6136ab5326b1d1c61f7cd34caa2022c3ff

See more details on using hashes here.

File details

Details for the file zenroom-2.14.7-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.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 960638ca56e0803cb2416b1055aaf580a1b904cc86a9f4e0f26fff684367b7d5
MD5 3e8988d63c8ec502282f99a1a3efdbb5
BLAKE2b-256 4acd5b3979b98204c4ea9e7d4bc12dabfc300add888fba2bf483511a524e4b84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 4db0c150104c4a52cef236b64a8ecdd84f147fc4ad70bd752a66036847032eb4
MD5 f90da856e4761af63bf783dc318340b3
BLAKE2b-256 4cd40271ddb8a435cf2158aab487cfae0bd157ef8329add627eb222c872f8696

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8de0db7ed2de0aa0c3c97f5d551dc05bc713144ca53796f268c218225ef5f8ea
MD5 8613a20df568d1c75a688bd5222354de
BLAKE2b-256 22d5c70ead946309e83949d1cce685c5b40a5f520f9db9e828eab63a801a8665

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f833e292dd31afb05652a9338e73fde717f34a029682aa364b2cecd9290c150c
MD5 7408704c0981b7003f0ea9ea4d50aa13
BLAKE2b-256 ef0f848055e2ac75980154d20b5d10497a6ab8e37f89da8e539454a239945673

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 879c83659a8a8ea8839e20a46f90e966ce82bc23c550cb72340575cbf94207bd
MD5 452dbbe514d5d5c545dd493dc8823b87
BLAKE2b-256 98116128be80b2cacc1cd87ad9b10f702b1e9d52cc6de08c9a1c6ca24b564f82

See more details on using hashes here.

File details

Details for the file zenroom-2.14.7-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.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 378d31a801b96664d31918ab3600abb238be15f0a3217fe27430394c2e5262be
MD5 cbdc7f0cff778c8920c3ac273c835e4e
BLAKE2b-256 cec6c4567f90652fecc64444c763cf57dfab7851b6951c8c1d094528697dcfa0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f18be167eb02b07c32fb3a6fb68e52905f61b96f1c5a30c1657b6f452365ff9c
MD5 793820326be0af99b80256f6edd40cf1
BLAKE2b-256 1148b3373864f3913d3dd1b8ce4cf1233f416ca4b92d556289d2fff40e46fb53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 95d9be7a2929c84eb37c31b63069ce7852ab0fe9f4d87f7b9127e33299836db5
MD5 b086239f8a43e91d1e890e0fb98adddd
BLAKE2b-256 54d01db12f733e8750a1791c41f6ca556be98c0e054ffc38bcb812f632f8a3f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a4f179f108b6c32c8ad440c76a186851ddb5f2404252d8736c622ba73b0e2b02
MD5 4e4a88efa68d67eaa061c02a4f0cd314
BLAKE2b-256 bb188dcc2fb897cb43615ba55bdc2debc821a69ba5a85cd099446649ce2577ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 95082e73897d0f4756af6b6f9a5a0b578124ec4ded6471ad7c84dc2972b35a7b
MD5 719d371ba90de9f0f68114939d7dbc01
BLAKE2b-256 65010196b6651c4fb8d6422e5f6ca9cb526b651123e8620385bfcf93656d1ab5

See more details on using hashes here.

File details

Details for the file zenroom-2.14.7-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.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 448329b72580dc1a37a1a9e74d3a7f8593f9d99d892b1c62463b0d58e704ec5f
MD5 1d829d37648652fcfa648864d494c6cd
BLAKE2b-256 42cdf40aeae1a68d6f52e312430527b9b963d4583e73dbb7d56c7033b945a20f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 81ea126e089743cf11bcff939cae75c4a972ddb56c62164c70affc21df9e4f94
MD5 7c021ca9b1f3b225321cf1c043425949
BLAKE2b-256 f3b05bd5ec6c48e8a0042c0f01044884e52326e7571191817786786d76a8e031

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 17925ee30d36c96acbebcf2da7103a65dfc369e07de32f8e8427f79489ce57fc
MD5 c1105f33742fac085a01b99885291c5f
BLAKE2b-256 9c3d760fb8ca7754d581af2361b754a1b6e86ec93d605c6e8c839c647f9b05c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5b7fa175b41688a2b2c695f4d2b31d2798a207642dec68d103f4d082b9f21d30
MD5 e47e2d5bf32e9613f977bdf6cfdd085c
BLAKE2b-256 ac2f8cbacdbf7c282aedb16b42e0046431111786089f7c7753b600d7fa2a1fcc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 86adecf0826fe22fd8732edb173f9880a68b2cb8968c64d57523946032119f66
MD5 d0fc5677f8e435a48255dc9c0b6acfe6
BLAKE2b-256 20552fbc83072feb450a7b13b2f3ed017bcdbcbd33266a2f73e428d6130ee6f4

See more details on using hashes here.

File details

Details for the file zenroom-2.14.7-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.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9e3075ef4b7b15a8b423a97764317c1b63d681341b1483a5549853be88fccb9e
MD5 e9fa758b1d4e505546482cef7d5fba62
BLAKE2b-256 450e68a907baba83a013f0bfbaa215fc9a5e858ec2be3e1c58b56b8ccfa68196

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5fca54d36252c4c8d21dc3292d18f551b4e6d9c6f073ebe07163de736ee3c126
MD5 f6fd424eb6dcf77c2663c35c015b44c0
BLAKE2b-256 22d9d52f6fa115cdaf2f00574ef68096fe6cbd738f1110442261a0b535206422

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 529a54558f1d08e01d88892a440fd671c01fdb8d1f1eca613ca055fcc786d6bd
MD5 fcdb4d0449c902c837a035f3c5e62400
BLAKE2b-256 294f8fef944e062ae5ccc9a6dcdc7068e535c015fbb4303438c1a2ba109812b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1f2810e4ac1a95cb127b5fee4b0452c0e0289dfa226b3193ab0ad280d3961483
MD5 63dd207bb91bef04e616080f561c8d45
BLAKE2b-256 ac98520b155651ff158d5c4d88f4e9b8eedfe3ad74e0ceca636a478677c2adb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.7-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 70019989c7865c25ef5e2c17dba7a0bd1a58d6050a2a49e08e6c81b828810d6c
MD5 b8a899401d541576ecc3a5f33de157d7
BLAKE2b-256 35f190b578cd29f259127ba2c6187bab32c6400ed07967bd6ac944ef605fe102

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