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

Uploaded Source

Built Distributions

zenroom-2.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (904.7 kB view details)

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

zenroom-2.4.1-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.1-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.1-cp311-cp311-macosx_10_9_x86_64.whl (764.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.4.1-cp311-cp311-linux_armv7l.whl (855.4 kB view details)

Uploaded CPython 3.11

zenroom-2.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (904.7 kB view details)

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

zenroom-2.4.1-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.1-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.1-cp310-cp310-macosx_10_9_x86_64.whl (764.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.4.1-cp310-cp310-linux_armv7l.whl (855.4 kB view details)

Uploaded CPython 3.10

zenroom-2.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (904.7 kB view details)

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

zenroom-2.4.1-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.1-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.1-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.1-cp39-cp39-linux_armv7l.whl (855.4 kB view details)

Uploaded CPython 3.9

zenroom-2.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (904.7 kB view details)

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

zenroom-2.4.1-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.1-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.1-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.1-cp38-cp38-linux_armv7l.whl (855.0 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.4.1.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.1.tar.gz
Algorithm Hash digest
SHA256 0183b2eba8fc31420c908702909c5bd9fbf225f3717484b8b2365470bcd8074b
MD5 2cfdc61ce63dc6086f799a532ece9bd9
BLAKE2b-256 4e287ec48aef461a81243becb456b835b784757f552480c5d5cc5bd6f51164d4

See more details on using hashes here.

File details

Details for the file zenroom-2.4.1-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.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0ec9f6e25b9ed8d693fdfab91cedd8935ad78dcf6052807f74a67e9cbde99b1e
MD5 d206e5596fd67bd061e6f58a32e66dbb
BLAKE2b-256 029ecf819c8f984ee2260c38dee2964a046b154e574f514853fac70de98f3f9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e7d41b94aec3c4d4b46f82673137e238739c1d2949dcf43447f71315cb068bbd
MD5 3c56229f4921193a51bf45cfac15d216
BLAKE2b-256 d1378d574d8cfe669760d41f5c3c39cb3397d0fb7a861d3c35e5f0b85a5d867f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bf2bfcd34bf6f91c9bd8648e7b6cd4e4940410988b175d8b23ba915555954e80
MD5 b256c89f8b83766b4a3f0477fa37b232
BLAKE2b-256 12b830b2a5e74704fced233a9523580e2c8525db86d61a052afc0de22002804f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 38ef71da9440c325b9ee0130292ca6937985d6384222f1a7a9339f0496520100
MD5 8f702ce380e2ab4001047511f0e56e91
BLAKE2b-256 5e49184eb097d2504fc76d08a70a76469ce6b68ff6fe63326d7d71d9190ba034

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 4b634d7f581aa23d487d97540aff9a550ded4359bc5326cfac53b0c09c09b044
MD5 3c7eb28b79b0e209edb747a3ae433942
BLAKE2b-256 2bfb822c17254982651cf70d509b6a157f65fa23b52b6e5177a5e5613bb985cd

See more details on using hashes here.

File details

Details for the file zenroom-2.4.1-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.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c5b0a25382243a853d8ac924cfe63d76be3881414244a16f1ca61ba23307e376
MD5 ac8187ccde5e96522b9d9eed2427db95
BLAKE2b-256 e6a01c7b30fb3d4a336f1886d7acc67fc977705af4e20ea4099d4eec543dc9ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3503f03c46297d818992225a7df6886ca40ed64acace8619bd9886d577bf0b12
MD5 30106f94033b37d44d935dbad7b5871d
BLAKE2b-256 98b1341ff8a4861666c3b6f85b440e33a04e67978767d4924a0a255f6d5dd136

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 a22839b794891dcbd8f5bb44d3f2cc139fe339850cca869b2a64f27d7efdc61c
MD5 9f6196a17515f49b76318ebb7f1bc7eb
BLAKE2b-256 9011adaa5dc8886dc023f3049e3be5858e9e713d27a09641aaafd0001e2cb18f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2736e5e36c4f0ac776b5cc3d0b4ec853db222d3ee791d7298e9f3bef94aee384
MD5 f2aa5a7224d94bd0396463f38b61cef1
BLAKE2b-256 a760647412ae096164afb3b447948ba2cff9292b4457de8a02a2df134f47bfe9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 da817596384c2f22fae064460fdf6903865cd6fa68d52789a7d9931b03288422
MD5 5101beaeb679c8b7962c5f83b2b4e7b4
BLAKE2b-256 22c3d627a42da12a4b03c06fa7d95e7679da5d1452c8c87d0c0f3e5f7dc97897

See more details on using hashes here.

File details

Details for the file zenroom-2.4.1-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.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7f385552ad2e47fbf28d7f38666e88a8a86ca54970483e5effde9f8e9c596a28
MD5 6ed185b9f7bd20c01a88b0672934ea6b
BLAKE2b-256 f2fada4efba02bc00d2c8c06e5616992c203301d017cb739ee89d332138ad2cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f0ecd1f17dc090dce337b3ae5bfbf78307d2637297e3d6a1d8d570474590a8f6
MD5 ae82462ec9cf18a35aa98b645ac0a20d
BLAKE2b-256 0403dbfa735122299b577b3e1781e286fa26e415a520ee30714e5f5413bbdfbe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c86606e1442b51dff273393b96b766d1eec379d78cd5b8fdf2676a7777bc28d7
MD5 a1ba12cd5054f02cefdeb346eaa55fed
BLAKE2b-256 894e97e0fae1ad6bc72f3b06904bfc90e2df0e15a553a0b62e59a54df2b03bcf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 84aa02f7b7fde10b4f3e367b634e02c47a9cc757fbe7e5e77a06632d40b4b92e
MD5 c4e966c443bfe09993b3bb1aff431bed
BLAKE2b-256 f7cba1b0231a598bf3e68fc33cf19a6871e4306ab831b4659493cfeb1cf7bae2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 7e29bf526a6397b0a591335199307e39c0c52eff915b7a678d36ff6e2a59deff
MD5 2646b2a8d6240e2a5d97664a532461a2
BLAKE2b-256 1143f1e900f344a19685ad83681c8045ba6832e1ef3f3f08e59aa01ec6cdae3d

See more details on using hashes here.

File details

Details for the file zenroom-2.4.1-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.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 87cecf63b193fe0cd165e7aed1a70fadb949606a681b77436af39fc9c96fea47
MD5 9758a6df152f0d9dcd9b354d927c10b9
BLAKE2b-256 579e7b2a9b2ce1d6947e6cab0d06894b0ab0cf20b89d260ba83a819ffcbd8bf1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e4daa7f305021cb041b85e56203d43157e53f769bdd879576e577c81315919ff
MD5 8a6b78d84dea846110779aaeb9788c9e
BLAKE2b-256 bbd9f75f4073c039ab74eadc240348f533215038a194063a4fbbee44d6ff780e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 174afd316f3a8964129b7266c766f8c5fc4ce4910e4d9dee4c27b4a84ad7ad67
MD5 1e927e816bf02dbc30bf35b31d4418bf
BLAKE2b-256 f9870e07ec62c9305f0dd8b210a60c5c60e02e3bfc9e27174de77eeecc38dbbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 55f4f60d30537aa012bd6792e46e402e5dea6b3fbfba92493bb6f1703a2b46f1
MD5 7120c110ea1e0f4036d5063013e91faa
BLAKE2b-256 b17e4e2f2a0b72ac145ab79795c7f4d59b7f5fafb894c429ab152992a746c750

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.4.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 36bc933c34b718b5190ca1577b1c92594a3570128407dc380f1fee18528a4857
MD5 7b05a5eebfc83f170b41cebdd2c9b9f4
BLAKE2b-256 f58af7474aea058f8da3b572aea8c74c74e81b7833b92c06a44aafbc4f811895

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