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

This version

2.7.0

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

Uploaded Source

Built Distributions

zenroom-2.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.3 kB view details)

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

zenroom-2.7.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.8 kB view details)

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

zenroom-2.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.3 kB view details)

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

zenroom-2.7.0-cp311-cp311-macosx_10_9_x86_64.whl (777.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.7.0-cp311-cp311-linux_armv7l.whl (875.9 kB view details)

Uploaded CPython 3.11

zenroom-2.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.3 kB view details)

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

zenroom-2.7.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.8 kB view details)

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

zenroom-2.7.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.3 kB view details)

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

zenroom-2.7.0-cp310-cp310-macosx_10_9_x86_64.whl (777.2 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.7.0-cp310-cp310-linux_armv7l.whl (875.9 kB view details)

Uploaded CPython 3.10

zenroom-2.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.3 kB view details)

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

zenroom-2.7.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.8 kB view details)

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

zenroom-2.7.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.3 kB view details)

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

zenroom-2.7.0-cp39-cp39-macosx_10_9_x86_64.whl (777.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.7.0-cp39-cp39-linux_armv7l.whl (875.9 kB view details)

Uploaded CPython 3.9

zenroom-2.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.3 kB view details)

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

zenroom-2.7.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.8 kB view details)

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

zenroom-2.7.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.3 kB view details)

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

zenroom-2.7.0-cp38-cp38-macosx_10_9_x86_64.whl (777.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.7.0-cp38-cp38-linux_armv7l.whl (875.5 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.7.0.tar.gz
Algorithm Hash digest
SHA256 fd184ad0580611d7134eaefe3e4659df2c16e3099ebb57184dd6167922478933
MD5 1ebc026bd7291b60298a1547f919e380
BLAKE2b-256 65f193b29344c07121e57792be505a4462d0750078b371cc3721a101f9b7f817

See more details on using hashes here.

File details

Details for the file zenroom-2.7.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.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 05df0e362da25ed204787203073a091dda008ec0ae7ca7a4e1a30dc3c88676f1
MD5 ccdff7900cfb4c31468414d0e997a738
BLAKE2b-256 c2da541036b02155ccf83341178b04529606995c88fd8bb6feec37d901423112

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e999ce6314e4edfe0eccf5918c3145b4196c13e15ca0d63ffa24c2fe719ce216
MD5 b289ccde1bf70af2ae3b1bf82b0e564a
BLAKE2b-256 6fe55a5ad278e06373d06ba793b49ad1de1428643bdc2734f5d1a88b5d2ca7d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d6ad97e804e66e2302b476a39ea2697bc543f8e4de94dbabde6646e8365bd206
MD5 8c362c07781f6421938f7dbacbc2a947
BLAKE2b-256 4a75a92daae4227e1d1657be636773c962ec58072f7ce9c3a8a1cc5815f1366e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1f00a920a9baa200dce95afd9888ab0e2ec5fc3da77767590fa88d6a244605b8
MD5 8f835f5fbfcc7f45ba484170889b9f6c
BLAKE2b-256 9c7b2efee04bc6913f3f12c17b54eb3e80ec5979672755591f0d7ac36e9bf668

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 573d09898609febeede04ec1d02005bd99c4ecf0f4fa92f89719f24b2c7b0440
MD5 4fab2870f72d03bb56cdc5261e90a890
BLAKE2b-256 710b2dc3179de6a7e02df1b1698302b13c862434e846874d3dc955b7175dee57

See more details on using hashes here.

File details

Details for the file zenroom-2.7.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.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 261ee444f202abff729093be5f8428e82625db0a196644fcf7ea80545cf5925b
MD5 458c25e7f3f159d5903f2e288b7dea85
BLAKE2b-256 e9ff7b516db1680b8f253ebe882e3dbbec5175752cbf164e9eacd8eae2f170e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 7d227143536d7acbdb85cabf61d27d042a219495f45dff761a7075ea340d44c5
MD5 64294457dc26ada42759db78a2106ed3
BLAKE2b-256 679d23233d27b4ab35849c6dd6e2621db35d5a135fcff26d553e3d178a5d4f53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 609336aa74e290438aa86322d62968206d9ddef7b3a55fb62b21a303b509b6c4
MD5 03d382feaf9be79fcfe34a91201fec49
BLAKE2b-256 b5e497db62239ade50914073baae8dec32ad629ccdf20ee27225485f38f97db6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 33ac6dcd8d8c1336a8f6f31d33f312fa42f6a6ce9c7d62251405e7f9c42dc887
MD5 2677844c6013fad6071e4002289c3cef
BLAKE2b-256 5d2febeb8e2a945d87db605361c35fa708a113b76f70e8ddf2c2ea4959587c70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 58ed6bd53e895c564455470de7b8f75f838beaa3cbbf62a6091a30ba6a5e4548
MD5 ff9b742bb257a483e706a3ec46ef416c
BLAKE2b-256 0244a2f4cadb92cfa4a7d0215ef11618a13e94600e0a05811b0f09ba77d2299f

See more details on using hashes here.

File details

Details for the file zenroom-2.7.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.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 87cee524b960a67bfcbbc6ef397130e111e7cfb08f07a24a41c97490ac1ea4ef
MD5 3d08650ec1b40123daf16cfecc9c9ecd
BLAKE2b-256 f8466abc36d2bdaf3fd655ea010ffbb8cee08ece368b85d40a7be3c10f0381e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 1561a6af8b0b0a683a5a275062f5e71ac0126a3090f64d91e0c98103a3222257
MD5 6ce46249c6e54b29a18d5f9c59b92edb
BLAKE2b-256 44e808b3c6f87156c1aa09d1110d3bf27afca6e2e6de19935f686d9bc81361aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 dd3c01e10292e47614003b60cd0dd8e2020a43ddeee55464d178b7552f84e135
MD5 4b982afc562b3102793b261ae439f331
BLAKE2b-256 8b5cbe25f64b21d5215a8e526a249b388542e87cee7c89bb2f174778ab9297cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4429398cb49c58d3c449dc18271ae2cf09b758222bb2e8262f56e8665605271c
MD5 fffcadfbbb62a62489e2f946c2e07d54
BLAKE2b-256 d021cb76ec03148603dcb792ff70cc27aa4dc834b8a02e66ae60a99f0ea65718

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 c13cf468215465cce5b904ece41850a367fa55ed65cb97f01439e5bde6760f47
MD5 7612a7c6d8024c82851f825acc611ac1
BLAKE2b-256 04c2f6561bafab0f619d32192521522191232c8796951a24e17a1791c13887da

See more details on using hashes here.

File details

Details for the file zenroom-2.7.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.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2875ad5aa3996eda6e1d8a690947d560aeacbb6b5123bc374a2bfd77823ba199
MD5 88b22d72bc3621429b9bc6bd5b40afd3
BLAKE2b-256 6e7f18e38297842a1ca1f068ee9bd40ad4744e71be3571f02076a4e9d3a14af7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3c67d234421224d0e02b28d40522cd736b356306078a7a4a4cfa1436d2d71fb9
MD5 33eda407036d90b038feb9d280861048
BLAKE2b-256 d839d59e724c8dbe547a324aadcbba4a7c26d77260f5ccb9ef89520061a263e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 4c284c08f6724e36208c9bc5535b86948dde00acd526cf1a150cc9f59f26d608
MD5 2c251879e643795b2e89e08dccdcf5c2
BLAKE2b-256 f48d1c68059e5bbd9a079658f63c56e6eafdd257286af0c2f0cba27def88d2b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6472543878861470f62d02866655e81b3b4f884231bdd8266d6324c289f5411e
MD5 70aea705c849517d9cc3fc67bb5c0872
BLAKE2b-256 03931d18ed60256ed35f4308384ebf7b682a3f2952687fe989b96619c6b4bc05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.7.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 7225c433b472648562c7f5f091d63dabdeb7df7f33d2be8e4cb1a8e082c20b07
MD5 540b4954666d00821c6e6a891301fdef
BLAKE2b-256 5a6f8d9e87657637d0feb71b79eb97253b752d9b0c43f4c88eadd9747564430e

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