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

Uploaded Source

Built Distributions

zenroom-2.18.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.1 kB view details)

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

zenroom-2.18.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.1 kB view details)

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

zenroom-2.18.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.18.0-cp311-cp311-macosx_10_9_x86_64.whl (778.3 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.18.0-cp311-cp311-linux_armv7l.whl (877.4 kB view details)

Uploaded CPython 3.11

zenroom-2.18.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.1 kB view details)

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

zenroom-2.18.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.1 kB view details)

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

zenroom-2.18.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.18.0-cp310-cp310-macosx_10_9_x86_64.whl (778.3 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.18.0-cp310-cp310-linux_armv7l.whl (877.4 kB view details)

Uploaded CPython 3.10

zenroom-2.18.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.1 kB view details)

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

zenroom-2.18.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.1 kB view details)

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

zenroom-2.18.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.18.0-cp39-cp39-macosx_10_9_x86_64.whl (778.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.18.0-cp39-cp39-linux_armv7l.whl (877.4 kB view details)

Uploaded CPython 3.9

zenroom-2.18.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.1 kB view details)

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

zenroom-2.18.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.1 kB view details)

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

zenroom-2.18.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.18.0-cp38-cp38-macosx_10_9_x86_64.whl (778.2 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.18.0-cp38-cp38-linux_armv7l.whl (876.9 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.18.0.tar.gz
Algorithm Hash digest
SHA256 e7dbd8d373c2b1035293d8546e4ee3ed447fa463278b9bd96b77a999bcfce6cd
MD5 2ae9770229b2fe3bc5c2fcc9dbd6bd6e
BLAKE2b-256 711815834ffa9495f18056321777f8e225dd59bb9eb403fb87a9f28f332072f7

See more details on using hashes here.

File details

Details for the file zenroom-2.18.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.18.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d6bdc7dee7118a0a5a522c68f58a7c41d2a367710e0ba03d8211e98e56524529
MD5 fad9ed4868d11fe1f0b2ce1b94dcff43
BLAKE2b-256 f50d3dd0498348eec76a25812947507db5aa9f4a35a3b791dfb7955c4c073010

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 44935bacfc8ae167f320108635fd6739b4156ddadb4b110bf9a05e4584911271
MD5 c01d8e227fadcf2f394629809e6a3f77
BLAKE2b-256 5ea0994dfc3ad218c7175150be1eefe1bbf5fcd148d7345f749f625517ab7492

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 6c9d2b8bb8fcf007d12f795e832ccb35a46dc6294860e61b7fe5a85e4fc1acae
MD5 56a44e32a0940e785847b42b1ed00f34
BLAKE2b-256 8f86573640b5c67a0e0c64f60cdf3f9b0336eeeddfad2285da79062993787f61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ab23d357b97396bd4e4e0fa355efa0ffd014a87557efe26b97bfb8efa664eddc
MD5 46015dd85a0354ad39491c6b514f317f
BLAKE2b-256 70e8f77f05745b6389e5cb05f7599ea769817be7a68c3415cbc1dbd5b5e2eeea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 e37cf3659c1cda5a17fb79fc4dac871ee9c998bd54159bb35f2cdaba95f6695d
MD5 becfc56c81a7c96e83e6cac1ee1e42b0
BLAKE2b-256 20b959ea3083c3ab8c21709371be7bddbcc6e02a7f69bcaed72513e36fb4dbf3

See more details on using hashes here.

File details

Details for the file zenroom-2.18.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.18.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 ae25c6382784e9b6f47cff3af58e6929a0f9c909d08c3f1840bdcd46745554c7
MD5 16866badf9ab6aac1df6cecb963bb54d
BLAKE2b-256 44b28ab3fcf5ee6c9d4365c49358608529719e9911c3f8d61ce964539cba1c39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9503af028a0b70acb824aa163b8804d6a8f3f9c83b0cdebb908764038744c04b
MD5 fad4ff96bd3d2feb13ddc5ef1cf0b075
BLAKE2b-256 eb7f20e70393ad56f109b31a638bf33b02de4fa6933d338fe0aeb7ed2203e95a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8bedc121f4c2e93e157c69e1efac1a2d999eadfc785030cda9726be1a1a83825
MD5 a6a0a1704930200dc2f4d854b57b2d32
BLAKE2b-256 de81787dbe4b786ca933a6893dad43e1cf47d3a82a9dd35bafb3270f2af590e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 39835655546f89235f309899d7b07573546d8392f30cbc0c7f89d5702e0f45e7
MD5 ad799d390cc0eddcef89a3c6468a297b
BLAKE2b-256 f73b146fd0572200c7903b489412ba26c2e59a0d51fdcc2ff75565d819f9cefb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 2802863d58f02566d8011c6f19607e9f718e0edf037fe5b68eaa5fef9f7d5f38
MD5 a79347723a9a74e063956ff829f30493
BLAKE2b-256 08234fcc35d7a3375ead0679c0caee1e1aa86ed867d22d0f084638a0c674a7e4

See more details on using hashes here.

File details

Details for the file zenroom-2.18.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.18.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 6b010949891c60fdad84818dfcebf17881f85aa5dd77baa81dbd3e4b0209e754
MD5 c1b1c8ce0b17066e426be0753f672f32
BLAKE2b-256 28d1311893c1483deadb13219196a6e79a15e4cda5da6486cc8c6713206271fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 00af3b9369acc775a9b811013a531c6ce0020b875b06fe3b65b2b749454b34a7
MD5 5a445b8559fb89538d72e7650c751bd3
BLAKE2b-256 3033ab09da41088422f89e242d175eb9cec022e1a758187b83d94b9a7a6135b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 ce3a8c9bd97cba85a3e980c5cf986cf586a6f344fa047f14f28c5c6818913be1
MD5 f9d61553559ca59ab18bfd8a32d88939
BLAKE2b-256 4b4f7f38269d172a309b88221d11d1b2e97f93f3145325097cc7b45d95b07867

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 64451d3f2aedbd803a26444c53bd315a359f03cd9e52d75c1e71f8ad7110989b
MD5 7d1859c046af2c6db31bd19b36c92864
BLAKE2b-256 bb01121e71b8a968ec346be5734bc0ecc63822b0017472e46eacfd2ecc19f44e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 c99901a40a76b4dd907fbec03ced117c8ffa9eaa601df6aba2620c96fe3b6189
MD5 153261766eabf26839ef0ab1743d6619
BLAKE2b-256 9391654d1bad23d06f5173cd18434896469d3168457425e51181e3145aac1b82

See more details on using hashes here.

File details

Details for the file zenroom-2.18.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.18.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 4760ab15b742fbe70e75d422caa7e2748f19d35d2a048f002fdce399a2c6389c
MD5 011eaaa93c1ffd7e14e1356dfd1b72fe
BLAKE2b-256 5f12f8e9ff8becf26258dc6d92b9b406014947f77f1c713e72c79aade5884acb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 4a3f49d71c3603f3246317c8aaf4478a9f2a28a328ca9e8337ead865cc2482f3
MD5 84ac494d933d38e626b8219c959a818a
BLAKE2b-256 c96e50312852e5e4a387ab7f42b367c1c09a9b669a481dd70dcbb833dab50a15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 2f8fc466c4d1dd971a88b910a3083e3a78721912c42de0038e8359d7749b3d1c
MD5 a40f5449da6882023cb08642add4bd20
BLAKE2b-256 67c722d28417f39bf6bc8dba6c3a148b5fd5a7921ec9ef0742fb34a97f4348a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6ad8be4d6ceee736bf7cd39464ce83ff66e581a6e484fafd8f60076bc730456e
MD5 be8baaed5554522393898e2c34ab3e2c
BLAKE2b-256 98472375ed4e8d5cc08007412fb56d31399cdaf06ba7972b4861074c17f1f3ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.18.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 f3f5d15fec39f7d60c87b29b450ad738b7ae2c7c26b9d3bbb61a7868860de6af
MD5 c920421a117625483d355a7c0d75ec95
BLAKE2b-256 68e258c10e055c848292453db80ab98bc657234c7f1344518bd594cf1739605f

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