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

Uploaded Source

Built Distributions

zenroom-3.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.4 kB view details)

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

zenroom-3.0.4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.8 kB view details)

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

zenroom-3.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (738.8 kB view details)

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

zenroom-3.0.4-cp311-cp311-macosx_10_9_x86_64.whl (648.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.0.4-cp311-cp311-linux_armv7l.whl (766.8 kB view details)

Uploaded CPython 3.11

zenroom-3.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.4 kB view details)

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

zenroom-3.0.4-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.8 kB view details)

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

zenroom-3.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (738.8 kB view details)

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

zenroom-3.0.4-cp310-cp310-macosx_10_9_x86_64.whl (648.2 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.0.4-cp310-cp310-linux_armv7l.whl (766.8 kB view details)

Uploaded CPython 3.10

zenroom-3.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.4 kB view details)

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

zenroom-3.0.4-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.8 kB view details)

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

zenroom-3.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (738.8 kB view details)

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

zenroom-3.0.4-cp39-cp39-macosx_10_9_x86_64.whl (648.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.0.4-cp39-cp39-linux_armv7l.whl (766.8 kB view details)

Uploaded CPython 3.9

zenroom-3.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.4 kB view details)

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

zenroom-3.0.4-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.8 kB view details)

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

zenroom-3.0.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (738.8 kB view details)

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

zenroom-3.0.4-cp38-cp38-macosx_10_9_x86_64.whl (648.2 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.0.4-cp38-cp38-linux_armv7l.whl (766.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.0.4.tar.gz
Algorithm Hash digest
SHA256 8e3215f6c9d8cfb59042448d6bf01b887234bbde8b52c7de6842d300479a089c
MD5 ca57f9ec1579436a1b909f8e6029a0ae
BLAKE2b-256 72fb71f90c4375d8ee2cc892a95271fe19e6913df0b09c22578b8ea92c3b9b04

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f7860230ce4929e280fb06c8ed03a53acb3f10d37cf058b1698bcc75c5a10a5f
MD5 e67b47c7a768871780f2ce661f723d2d
BLAKE2b-256 8721876ba62afe9ede62c0961237777b89a58951138c73b17d7201672e3c5a1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 feeb48d60978b129344910ba676584508ad27be70d208b9ed2626f4b0ac44aff
MD5 6e8afddce610fc6bf4df0a3a8df89b1f
BLAKE2b-256 077c80a6aee4d3cd308d983e0d933ace51d7de4d4ddf5e88df41d02630eb4ebf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c7de6cb7d2acd1ef567bb773342a7c95d9c959cebfe4703784937394ec820290
MD5 8fde5a82c7ac75f6092772e0fafc53bb
BLAKE2b-256 6eff7f29cab634cc5729924553f71c9f5820758feb62278806553ccc8fb6d44e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0e9a6e87ce1d2c00d587b5441dc17e6c7023bd741c5da3918dc0f7e35bf2409f
MD5 e5a2d8088194c6f29ce5382715b9d6a0
BLAKE2b-256 00ad66e934291e5f1a3ce553a177a11cdfc9b5e22b65c7d7ef0a15706ee02702

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 869de9abad863c8dd650348c3981b1c88c66764944ceb69b26d15497d0ff142a
MD5 258d092d19a1e29a45f248fadaf7f117
BLAKE2b-256 35e8b00ed9df0eea87fcb875ac8f7c80b92db211a4456f11b6ae5565a25715b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 a85653c0646e4460166fa9a67d8e456d51bfe1ce27ab5599efaabd81209d4cc2
MD5 c0aaa3453d814cc87e26a4fb52d981c7
BLAKE2b-256 caf612735a80d9f301fa11481b87cfb8893a92c6be9c635f85a6c595e2f772b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 330f6ec357d649522026de01989b816b70e55da94c461f897d26ebaa25b0b06e
MD5 f0b4a31f8db2389d672b6d70b8d19e08
BLAKE2b-256 5e8e2eee93534cbbe321ae81097afeffee3711fd0baa1cc11fb1c1b3f05726c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 35fcb840a7a571e0e52c119b9feaff9cb085ea20a543ff0cc75660a5e64b6257
MD5 21efd8d2f7567ff9644b6809439ef8db
BLAKE2b-256 e56da65d1de8ba5080b8231788f814df5e072edd95a1d5a3641a2e824736b9e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 507c48014d8eed645a53c6d0a78d4fc1cc0689a7145f07dfd5dff8c5272d5b7a
MD5 7de4af8c8de2875dd93745e7a68fc2a3
BLAKE2b-256 b7be004aaae341fae5f1e6ac59ab1541d75df56f4fe8bf6d8beaae845587d5db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 1f63415806b2373da56537e592309cf4898c986736467b8db57d30a3d3cc0121
MD5 49b2e5b29fc95f674253e400c184be89
BLAKE2b-256 ab0123427f10f21f1e1f11d0f4532a6cbaf1963742425d8c6a850e887c116ca0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 a67fde77fb4d5f48f793aa038d1739ddd81221f3e0e0dfe1938d6adbf808cc06
MD5 9bddfdb267882206d0d41fb4167bd8b9
BLAKE2b-256 0f3fe2eac9ac8237c91f45d021ebbd0a7668dbb16ddb8095c075ee852447835c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 298ce57d16544516c95aedd1fdf611146392bf5af2cf0a0f36bc4ba20ace7954
MD5 c19d4d299ceb9e0bee5203ab92769470
BLAKE2b-256 6199153e95fa08f15149a8c8f6b60a45a4ad177e9df98b642bbabd22e76629a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 f59d803d51ec4e24bed093f7e9afb6ffad81930f07273fa0d3204f4d65ac95f3
MD5 f51182c0dd5afe2739b121aacf2bac87
BLAKE2b-256 1fc762771433bff6ce9b262d78ecad0b0c45a516dfc53f5e0fe87535b1d4928c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b3a378e8197dfd08f4202607141fb120ad5a39d0c30c0f53ab226b8851f1919b
MD5 72c829825defb1f4aeeb42dcafe824a8
BLAKE2b-256 c13f1761b5c07085c8337efd3876e4146d1d415cf090bd35902b53e8649c37a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 78ec332817717799cc89ac6f55db03951a8d9c640067dc8ed06903f658a22824
MD5 1015d8c32150c1e7afbb1adf4e812a96
BLAKE2b-256 d11806d53b5b4b8cebca60d5f7cfce43a749737c901f39314524da80c95db4db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 def6d287255f074ff7ce1b947c1e7fca638b477be10699affb98a9b4c52fd41c
MD5 34de665357d2291cce378d98b63134e0
BLAKE2b-256 d510e5a517ac26ec458694862b7d1531e239da9176959ed1667cc6c79693356e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 31a4eb4d2349ac6f567cd66975f510d6f7f60f3fb0531ebc5e391d10c8ecf375
MD5 d164266ae0f36b59eec85d1bf50a8bfa
BLAKE2b-256 bdb992e65a7dc60f3086d35b378f16134d553f7ad5942ca4697f76668ae3a1a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d9ac73e1d53101cf85ab7d7c95f9420ba12933d9ad720d03d907b876c4c82240
MD5 1d88647ea05c9b2e01d183d9c6bc889d
BLAKE2b-256 90d2b760d0eec480d72418f9f2e35ae3cde0c43a0307fe1f577b45b2df94c4ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f1c56fcff06af081e63cabeba5db2232e0b95b4676ea6d15f16e28661e408c8f
MD5 d63dd4ce149e9167eb3eddd062fe7945
BLAKE2b-256 e9d7897b927d1d97bf61ab03245ae2964a0d7dcc40e92bab1694dbca9049e78a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.0.4-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 37d107dfbd44305eab689a5dc314bea06c5574e5d3c5a333227c93908d3891b4
MD5 7a1a53c387a82797bbca8a9750d9d17f
BLAKE2b-256 586af30c636f1463a62dc2a71075cb66168818f90565a0c12133e783d89e8000

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