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

Uploaded Source

Built Distributions

zenroom-2.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.0 kB view details)

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

zenroom-2.9.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.3 kB view details)

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

zenroom-2.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.8 kB view details)

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

zenroom-2.9.0-cp311-cp311-macosx_10_9_x86_64.whl (777.9 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.9.0-cp311-cp311-linux_armv7l.whl (876.8 kB view details)

Uploaded CPython 3.11

zenroom-2.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.9 kB view details)

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

zenroom-2.9.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.3 kB view details)

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

zenroom-2.9.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.8 kB view details)

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

zenroom-2.9.0-cp310-cp310-macosx_10_9_x86_64.whl (777.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.9.0-cp310-cp310-linux_armv7l.whl (876.8 kB view details)

Uploaded CPython 3.10

zenroom-2.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.9 kB view details)

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

zenroom-2.9.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.3 kB view details)

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

zenroom-2.9.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.8 kB view details)

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

zenroom-2.9.0-cp39-cp39-macosx_10_9_x86_64.whl (777.9 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.9.0-cp39-cp39-linux_armv7l.whl (876.8 kB view details)

Uploaded CPython 3.9

zenroom-2.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.9 kB view details)

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

zenroom-2.9.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.3 kB view details)

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

zenroom-2.9.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.8 kB view details)

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

zenroom-2.9.0-cp38-cp38-macosx_10_9_x86_64.whl (777.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.9.0-cp38-cp38-linux_armv7l.whl (876.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.9.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.9.0.tar.gz
Algorithm Hash digest
SHA256 ebca0b9ecf97e74641e33295076e4245717d8316780d2db78a0189263a14a6cf
MD5 fcd2e7e52925858f2f790415f8e7082a
BLAKE2b-256 0a6ee535e3443a1cc5cf71b7bb6cfa738b3cfc9cb9cd98d081b611a30b47f370

See more details on using hashes here.

File details

Details for the file zenroom-2.9.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.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 17587e71210acd560e40e9a3c1e5abb85393b79b08ae71db903052d5e4441eb8
MD5 8a998d3acd5683fab5622ff6623c0ba0
BLAKE2b-256 31e5e67c3427f52ecdde3ddc91b65870e81efdff132a5937a3166f7d10de0d80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 bb12b776ddd4c9841bb691b5ef2de333b0fa37db886bf90e35d62441cd857f4c
MD5 2e06eb78da73c453086491266976cda2
BLAKE2b-256 60a7285e45690d2aadb727a6d0d881bc918b124cd5fe29b590750452ccab2946

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c794cfa84359aa288e35a796986e35e8265956ca27f73478a2784a12ed1fdce2
MD5 a505aa359eadc60a7e5d732ec470ce50
BLAKE2b-256 a2c6c88c36372744f8a74c7e00d577fe05bacce44710bb64a87ed032580406dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ee7076bb5755381b87dbb44fe16258c3cf4dabfc6ffbd268446024e7c55a7439
MD5 77c17dc99b31211381db3ef66c1ac122
BLAKE2b-256 7b03dbc14fdaae8dcaf3bb63109d091e48c87d799e547139f50af362f24226a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 fc16600ec4c4a54c73408e420dab7d17f53e4c0c7f748b1b6388a4b1cebff7fb
MD5 a45b10a0d2d89178d4470a03746645b0
BLAKE2b-256 13d33fb121dbd24e7e1285dd5b28ec5c5a9cf90ea16805197ab0f5f18bcdeb5a

See more details on using hashes here.

File details

Details for the file zenroom-2.9.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.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 493ce5fcc6bfb3721a3f6cd871328821fd06ce9384b84e6a8f1dfd636312cf2f
MD5 42970be6f4668c006417034b994290b7
BLAKE2b-256 4e54610f3ed71c2baea3d4e8c8ce89b34d45a449209befa319ec8390b71c6edd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b9896722dae51f192b1395ac852de0248c68c6e45dc7683d77d56918df60e136
MD5 f8e12fdbd04fe59e72419ba6bf6aee79
BLAKE2b-256 63b2dd4163963b016144bacaae89b554f4c4119afe2e8eefd7a33651af465dc4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 7ab4b43c76f3b3428d3beae347b1fc413fcf78bed1a08c44e5f1b8f69979e6d9
MD5 4d2e831956fd88608374492293f67bcc
BLAKE2b-256 af266ba841c63aabf13c5a5ecf9bf35e44158154b3aa6c124ebf3558272ba896

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b2159a07e16976493cfca6f1221b7f3e91def71e5059dfb571790b600cfba394
MD5 66ddaf586850c5481a73528d5c51bf9e
BLAKE2b-256 c81b8137ec8ae9238f0ca2e885ad0d85c048f4c764a81a6372cdf060d6c2ba70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 b63a4ff697a96dc55058bf9962948adae83b01fd375b39693ec5c56ebb4f8e88
MD5 5140792562623d39be4df9ce5011a99c
BLAKE2b-256 cf7b6b71be12b3caaabb0588b011685a509bf46333f52eca56fe980d9d8a9bec

See more details on using hashes here.

File details

Details for the file zenroom-2.9.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.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 81b8047c684a7b0e55bdf750d458e21b36c54b13829dc453eae45e296c7518b3
MD5 65064154f3024376c52d45a437e62478
BLAKE2b-256 4fbb6f47fbb12c2cd029b7b126fb59fe1f70bbbb3452fbbfb53a8dfde2757b6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c43defb15b3d2eeaf043ea5daaaa4899f910e3ebd13c2a66ef3eddf5d77979bb
MD5 e54c7b902c6722159d951d67b3a065a2
BLAKE2b-256 e33cf320c5edc5e4eac8d9ee6dc4be9f73e5587c13bdea34985d5078dd721d7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 28c8e8901c926ac0b154a5e6686521bf0e26218f2ed34a176df6db0abb3e150b
MD5 9c0cd53626132eeb86b6210d99224530
BLAKE2b-256 f2d9a81fe5526b3d06fec4d4acd3bd082f0bb1882bc21a4eb1b3dfadfb764478

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c965e8cc751196025953d615c73a3559af537237934c17e3eb20d1b9cc1e0800
MD5 b3eabad8e36d65d0f4cf8a1c57d1d7bd
BLAKE2b-256 d61ebbbf65247398aeedb50ed759b147417a3c1b098257a86ebaf15fbe70b5d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 caa9124c3ac1adf7872f1d84ad05d7ec952ecddbc35a6e3d501d68f7db3e7843
MD5 ee3c7dda1dd0fb8d353da9ca0a897682
BLAKE2b-256 d6dce67b92bdc3a9fa09dbc96859dad3ac5225566bf986a01c48c17568868b37

See more details on using hashes here.

File details

Details for the file zenroom-2.9.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.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 53486e93faf9507230774f6054b6b3ad7900f8d33d2ac3c20bf2be96009b05bf
MD5 07469b879f35661dcb7536b083647068
BLAKE2b-256 55fe1e480a87f5326ea5b95651835635ef7eb6b07bb1e5bbd6c4659c71d623c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f17bc81dcaf2f8997ffe3bce4ff3d1fe04196ccc50c0e7c5ccd3995b8121cd3c
MD5 f6778fc8323158a1f77d140329159bf2
BLAKE2b-256 2ebd59d0e940bb884ef489238a5eac0288b66b9eee373e659ada0463093391f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 25ce2df61f9e70c0c7017245ca3a690158f91328fd3b856d7a78e0e686e15d9f
MD5 0e8e5f0190254097b92f28c52bd8c0e6
BLAKE2b-256 de6bf06b559cd8e5120b86729fb8b7a21f24cd1c001c3d2bd58b039512f36df4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f31aec0850ac39921d847592546b67c58d8776d2e8c9317ea11ed04ec380556d
MD5 d603ce0a05e6c81444c9a03943fb1cf4
BLAKE2b-256 fd181a404e24d683549bbf81e8df1b13af1ecf5de16407c2b81336417819885d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.9.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 25921b64b43ae0524fcb8857dcdde0bd1123a343ee22cf50a5d6089353c65275
MD5 cd72e5e80cf38ec8d6dc5b618a24fbe3
BLAKE2b-256 fa5f3f592c2f26b866f7d2e1717019fb8cb195efc3664a9f5be878e252ea3ccb

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