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

Uploaded Source

Built Distributions

zenroom-2.15.0-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.15.0-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.15.0-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.15.0-cp311-cp311-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.15.0-cp311-cp311-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.11

zenroom-2.15.0-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.15.0-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.15.0-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.15.0-cp310-cp310-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.15.0-cp310-cp310-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.10

zenroom-2.15.0-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.15.0-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.15.0-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.15.0-cp39-cp39-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.15.0-cp39-cp39-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.9

zenroom-2.15.0-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.15.0-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.15.0-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.15.0-cp38-cp38-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.15.0-cp38-cp38-linux_armv7l.whl (877.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.15.0.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.15.0.tar.gz
Algorithm Hash digest
SHA256 eaa4d93b55485a5d792463725d37bd9f1fc2b9c2b3d177f423c7069430a87717
MD5 790c64cec8527f13fa3cf0d0c4d4609b
BLAKE2b-256 1b5e6efd23d125a761a264bd8b995a93243469aae87b26fa55a5ebabddbb2559

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 43d11d744c8181ed2a77231231433cb24213e23c56313e80f107ef01ac43e143
MD5 05ac41a3c31b10d8dc44d0874254975a
BLAKE2b-256 af43c2e9442a6f8025406ff1e22446006128f9b71d956c67ba9b13984ccd98e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 6f3f5bfea4f3ebe3f322db79abc0d22b65f044706b14194dce55f96a080fbe45
MD5 04ed3deb1210666c56497dd141bdcc94
BLAKE2b-256 e8bee0add745f25c3fcf6cf60ee11aad118d4125214a7e991cfcf5ec3d423cdd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 adf46aca03547e50f9932d5f6e11209eb2cf4349777ef02dd10cd7712c65afd7
MD5 74677190b4d1b6152f68e8abb273d7b8
BLAKE2b-256 7b033b32380de9ea0e6f041ae9b094f3255b32b3d70298c0a4ce9811739a3ca9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c39f157d8bf05a32286bb0f403bb9cc94542be858c510ea85515d22b31c0459c
MD5 8035dbf341d018d1807fac137476a434
BLAKE2b-256 801e1182d2252cb32c85f0b17b5dd0c4a0cfb6e06168d6b960eca7eeeda601b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 51250e896e5567730ba6426b5718ccab1b1b9f77fbd80f3726efc43348805de5
MD5 d2adc02f2165c66624ea3c2c68d92a6d
BLAKE2b-256 1bdd81bded2ca890d2f9dd64571819a4842e29000605c29afb5acf37c2cf4e29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7185f8be26f9edcabed565546457f5edb0be3f85a937c4a8f9222ecf7a1c92cc
MD5 80149a8857f3602b1d8aedaca7321f7c
BLAKE2b-256 88b57c093c6d1c28246a42bef3468e4580f4ee1b90f33dbbbdfd68de45d1343f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 55d4e5b862cbbc916886fda3929726af408437e4e16f9c139adef861f07eaeb9
MD5 639ac1bc44adc778b48069b21deaea28
BLAKE2b-256 70d5be1f6412eb9059ac895bfb5d82f7f8241b54c6be590e72e13692bf9743e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 a9a28ede1856ede908ea998bda3de54d3f774f29e956f490ee6d6a0cc142c9c2
MD5 bf9ed9e3ea60a69b7d22a66ff3dbbd71
BLAKE2b-256 9b897cc3bf2fb342e33fa4fd556dcf026cb734baee7400d8cadacf2972d9eb6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 48ac0b841bd4b4503fa26dd8e7c76e991f19e80cfb3eca20458c0ae2af493bac
MD5 bbd315d1e776bf03963b0bc1222216b2
BLAKE2b-256 04ea90ed62a961c998d7060c44c58256a8d095f021b7fb5e981f8c1e5b8a8f0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 80f18c8d129eb24a03ad7e8cc8da9cd2c87d972a2c2c76a09fc07d726f1b7ac7
MD5 aaa784020be085c2a46e0988fe19f8a3
BLAKE2b-256 a5dd48ffb82ae65a9b234bd356b107c01027bfc8140f6518b8cc93098fd70a8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 916806bad24ae90c9b345cc02f353059c2e2baeff58d610452e96e5e4235bafc
MD5 7ef8d14ff7e10dc72c6d87f4c9f4fd65
BLAKE2b-256 cda8ff93ae76ed921a6032016db17d82ae1c318dab03b2b53ac64172a82356c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5f2a5b01b4618a1af7de4504d7527220a0833136efbba60d7f6bbfc7d09066ab
MD5 6c2784943023b2bf93cd9fc3f2b4b3d9
BLAKE2b-256 b68f03669d5d44db34469d46f13a12e6aaefdd3052c3a2cd8ac2588b78f6145c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 3a5a6f1253f68c322e2377975566ef80ad21a82c1df291a7493b6a1cb37479f3
MD5 ffda75528fe145cb1a95f19e7135a2da
BLAKE2b-256 7c1df4959208b0b6de59429e9ae8cf186c79fad8826d73fb88e3290665c4bea0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 388d331442e5e5b26fa5a24b60eb81b348f890c10dc0bae0f22d703b1877847d
MD5 877bde894cf7922d8c72ae90757758b7
BLAKE2b-256 95adbc102135ac91e105ea56ff2e342d285e5af5d77484f2ac7dbda025a474ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 2972ab5985cd442e82373ce45b31ef997183f47a48ede6c09e47a00980a6efec
MD5 adb11dca668c85c79337c25db6076d99
BLAKE2b-256 47558d443e5e29fc1aac39d8e8d59e8be33fe44fd8422a742c680170bd6b5632

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2e71e18dec0696c971f82445a31895b27dfa102dc0b47a935a9a9a216d0ae7fa
MD5 19465e4ea6ff95c1cadc8c60e0245c40
BLAKE2b-256 aee88928f46284e52647cc07330a50f5babe59d650a3818fb685b19e37931afd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 dcc37c3e03e0f5ef9980b65b59cd24653cd31bd179c8117424f8d0e683056ca5
MD5 0933ce136524efab86f8b1ff4ba20cd8
BLAKE2b-256 605d10e07311638928a20973443a5feccd2f463e6489f52c7665d6bc38595f7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 af33aeb624d0ab55dcef5fd7a2e111375d8cf6d18bdc9fdc805251c8ff654593
MD5 fd840fa34e97ae1c9c67cc7e973f8918
BLAKE2b-256 07b39e395482cd4e266bb241d233b9c26e1b777f822c8a5896a066d6718f87ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 88272a59d2155202d2f52ced2b6df1f52d2cb83e81cca03470d702feaa6ca09e
MD5 26932bdb4f87a9ee6c93b2aec0b3a7f8
BLAKE2b-256 c9e343050b6b204dd7dbc5105ae24155fbf60f1627fbf42ae851705e1a0f2241

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.15.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 02d35077c0fe9f6f88e64d939b5b38eed6e4d60e4bd71e21553e843f0b161e97
MD5 768e0bba05a0221d6afdaedbfcda48df
BLAKE2b-256 c57549df6b56270dee56983126dd5a11d0aea0abf3154b7ef117fa03a171b57c

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