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

Uploaded Source

Built Distributions

zenroom-2.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.9 kB view details)

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

zenroom-2.17.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.2 kB view details)

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

zenroom-2.17.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.17.0-cp311-cp311-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.17.0-cp311-cp311-linux_armv7l.whl (877.3 kB view details)

Uploaded CPython 3.11

zenroom-2.17.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.3 kB view details)

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

zenroom-2.17.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.2 kB view details)

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

zenroom-2.17.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.6 kB view details)

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

zenroom-2.17.0-cp310-cp310-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.17.0-cp310-cp310-linux_armv7l.whl (876.9 kB view details)

Uploaded CPython 3.10

zenroom-2.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.3 kB view details)

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

zenroom-2.17.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.2 kB view details)

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

zenroom-2.17.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.17.0-cp39-cp39-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.17.0-cp39-cp39-linux_armv7l.whl (876.9 kB view details)

Uploaded CPython 3.9

zenroom-2.17.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.3 kB view details)

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

zenroom-2.17.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.17.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.6 kB view details)

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

zenroom-2.17.0-cp38-cp38-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.17.0-cp38-cp38-linux_armv7l.whl (876.8 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.17.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.17.0.tar.gz
Algorithm Hash digest
SHA256 a0e5ae8ea031b828bcd188b1dc1d60cc3fd39a46b9df9ed7f04043c1094b8a35
MD5 a00df1234ab2019bdd86ed21ae95d090
BLAKE2b-256 a524da743e0069d70490b41fb664d89de588473f17db7f01347cc1844d2daf2f

See more details on using hashes here.

File details

Details for the file zenroom-2.17.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.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7d996f6dfd9192ca14b18a2dc1a05e65efa6afbf616c6e452c5b94f408b987f4
MD5 dbe3756d3f22a772de7e2ee351eb073c
BLAKE2b-256 d412f44770152b763685da8e84161fb3fc4ec8ba0d76847ea60eea36a23d9839

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 feaae86668bcfabf2e30d76b868ea1a04374700704365593693c9d02f15da042
MD5 781ad8d3f190084617312f4e6e1ddf8b
BLAKE2b-256 5be7af95fbf5fc3ed3200baaf553243ddaedd31c36d245883b152d9ba0dd6ef0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 364e0a40dc9c8a6061a271be8f0f19b4cd12372ae7c54eea308617fc33e5a0aa
MD5 a481f4f6e634ae9ca04386e8b2d23266
BLAKE2b-256 1348ead6afdfe61ca121f24bdce15a136b4e7bf20e71a17b2a05dfee157978fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d6187a9e78d6c8dd087fb9a121aa2b302bf707c963f0f25acc58f86e4d72dece
MD5 76982543ae0cb3306bf62e9c053394b3
BLAKE2b-256 10c5298397ef980551ae01c807b29c85e69e1d665ff0e47310f17b8e2a558343

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 5baa8685e852cf15a17ffaf761b36ae2c54a88f0321367eed6f24b688964eb6b
MD5 b9331ae431f8fa23997d6ea85b9379d5
BLAKE2b-256 b45363e75ae53114d5d37155da46dea496a23d6802959aa7f43c670a4204c0ef

See more details on using hashes here.

File details

Details for the file zenroom-2.17.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.17.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 96e253c48481ae913a4518e3bd74563d5e9f022c09c06b529bba84934e6c0b27
MD5 87ffcaa63cfafd9a14e62cec75af9c2d
BLAKE2b-256 8a65ea5163d580fed282d87a8c7eb651a494c74351ef7c036f34565c86743165

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 95679cd821eefb742dc227791b3026d6c34110f99999e3826166723c4a4b2b81
MD5 531bad4a517ccd6dbaa62e313f2979b5
BLAKE2b-256 4c4bcb6c3a767fdfad5064bb2761b243496b8bb61c51534563822ce561748997

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 31718950e7e57c6520f6269f6ab28d428d90efd6c12642e6070994a569b01756
MD5 11ba4e696f4cdcd9262d6c29282112b9
BLAKE2b-256 6b24989979063cdf3343e2316193277ad778961e4077a3710019397c0e641f35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 70d80090c1294aba0c4739247d85a37f963e640eb561035b00da014926eeac72
MD5 11c6d8dbe0d762fe07466cc4d4ad968a
BLAKE2b-256 81f46f5f256dea277e0029cd2263140fb609673dc81066bd765b1ae6ad0ea852

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 71161b80388101a05b646561af1ec8429050d0d90fa9f646a6ddf6102c6514bb
MD5 0ce8cb72b50df98f911f31e107ae176f
BLAKE2b-256 f99326dd2796bd54e1e24e920d68e2e7de7fabe48494ccabef9fa94a0b97f4f7

See more details on using hashes here.

File details

Details for the file zenroom-2.17.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.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3bb990b440c4077ad9d6040e8f3319073f5ddd5bf73a409263cf5b28e1395813
MD5 eef2f7cbd7b7f01eee9a8f61dc30a1a9
BLAKE2b-256 5f6bbd64f4d6b4003d8279460701de921051080f8521c2c58cc7340e7db091e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ecb8af0d61ce91343bef88e7ef0744d933fe6edb5e7a7b39b4610b5d772a778e
MD5 facdd0eee9452e67018736c495855e6a
BLAKE2b-256 fa058acb7c8b2c95e7acd3c57c4b56643c0247907803fcaff468363992b507d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 f757fc0788aebb7e0611dd24639109f956f30839aeb2734857ad138443bee0be
MD5 7f4991ad71c94a7cee91bcf4b9c9f2d5
BLAKE2b-256 50576a4f89351ddf61d80e19160197ba9e011cfd00647a90f58611e35fe882cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 749543771b06a1281dcd3602a59424b9caad54ebcc8e9f4ee6ead00217ff4ed9
MD5 a391aefab16b5a6231b71c2cd50d71d7
BLAKE2b-256 684aca3c45f77a00f6420bdb3223efea172c79ac77165b5106a5678de375c2fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 5c3f443665c26dad7356c83fd7087997852c926c0e7834c0fd9cab043dded41f
MD5 f14848c20e212fd9fecd817ecac3b692
BLAKE2b-256 ca027cec730f9073fc23cd3f214e642c517fa68406c42079d6b0a185fefe1c34

See more details on using hashes here.

File details

Details for the file zenroom-2.17.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.17.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 ca794b08da62e2a2a376fca4c9c1bbc17f49d767c92efae6be015605f364a468
MD5 ee18acb964e4386306cdb06f2bf0c9e0
BLAKE2b-256 d83016857d25d127d254e2e4afc5217525e67d6c14ca6ba072e80862078c14cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 902103279d3c07107971dc800d4792064e20a78c577d5e9dc7478c39e32756dc
MD5 7e302441c5cb7a56c60380e9fbbdf107
BLAKE2b-256 d02a2642787f79470f3664824e4e8b8bf12c27a90ec0c21120cb34694ea9a00b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0e817ce6a9f9b6ce09abb9cf320e79af23acbd4792385412f9bd45625694a2e7
MD5 d71feaa7f738dbf8f63979c0da97abcb
BLAKE2b-256 05f6570e28442201cb1d4c078458fc35ab0971eb4e11308eafbe38afdb2d297f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4f2bfadb36ac166fc0e4a7264570bca4eec5508d96027d8f0908bed9be8a5004
MD5 517bab88cef576012cea5194d71a252d
BLAKE2b-256 1359d80c95b48362f86198d4f18ff3db8050a598a2eda99e08d35ea0c5972335

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.17.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 9ab27ee4b715d6fcec1d8bc7d0005a109555cd2b6694ea284ea71ac36b7bda89
MD5 483715461fef9687f971f43bbc75a8c3
BLAKE2b-256 9c92b39fb31e390595ffc2fddb3ade263ccfab663187cf0c2fcc810c449b448e

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