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

Uploaded Source

Built Distributions

zenroom-2.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (905.4 kB view details)

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

zenroom-2.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (915.5 kB view details)

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

zenroom-2.5.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (847.5 kB view details)

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

zenroom-2.5.0-cp311-cp311-macosx_10_9_x86_64.whl (764.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.5.0-cp311-cp311-linux_armv7l.whl (855.8 kB view details)

Uploaded CPython 3.11

zenroom-2.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (905.4 kB view details)

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

zenroom-2.5.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (915.5 kB view details)

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

zenroom-2.5.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (847.5 kB view details)

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

zenroom-2.5.0-cp310-cp310-macosx_10_9_x86_64.whl (764.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.5.0-cp310-cp310-linux_armv7l.whl (855.8 kB view details)

Uploaded CPython 3.10

zenroom-2.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (905.4 kB view details)

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

zenroom-2.5.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (915.5 kB view details)

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

zenroom-2.5.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (847.5 kB view details)

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

zenroom-2.5.0-cp39-cp39-macosx_10_9_x86_64.whl (764.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.5.0-cp39-cp39-linux_armv7l.whl (855.8 kB view details)

Uploaded CPython 3.9

zenroom-2.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (905.4 kB view details)

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

zenroom-2.5.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (915.5 kB view details)

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

zenroom-2.5.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (847.5 kB view details)

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

zenroom-2.5.0-cp38-cp38-macosx_10_9_x86_64.whl (764.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.5.0-cp38-cp38-linux_armv7l.whl (855.5 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.5.0.tar.gz
Algorithm Hash digest
SHA256 68f1260f4242a4d70946f8a171e6173024898daa1b6d288389e2722e33c58efb
MD5 221e40d7b77552680d47906e1c62bdc6
BLAKE2b-256 5957b3fb0625bd8ae8838e54376672db7835bccca88c85a1173c8a22b0acd667

See more details on using hashes here.

File details

Details for the file zenroom-2.5.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.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0ba304fb157d0ddb2a88197d2af6c498d568cf3414e701680d55968ebba4b10f
MD5 dd289d8d2ac250828d2f2e2bba7a5392
BLAKE2b-256 bbcf34a29e2f0d10d64212779d5551597bb57552ea85d1b5c70d12fccd546154

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 00e0b30753643ee829593df5c69aead277d5f05cff6ec87e5630dd37ada2d2de
MD5 93e07e095b80ae7e5acdfe5b71b2145f
BLAKE2b-256 e0ae927f29854ba9a0ebd73c76af80a758dd54a061ff6eb62a627214886eec72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 fcc9af55f5305f900b9b1cc116946de51290742a136c556f4def7ff3ac2ffa76
MD5 77ae0dfd5080413a5ba62d8f20e85cfd
BLAKE2b-256 31cb12351b5f6f325aef24aba74ea18651ec740cdaf972c5bdc6cf23e23a0dff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d8f04ddc33cc9392453c0a1f98a99f938f15d9bb98c1de7ca8b92474b2b68d37
MD5 bba3d64b780a606f303a268471a0264a
BLAKE2b-256 7eabeef4d1f3c1d7e56503d3db3a92ca07d0f8133f0d4bf1ac0725b0a5e4954f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 43a2da48595b777d6a493f138e5a5fed2a2ca43d7c31ed66a64fad92f9088b00
MD5 9c5aa966d780b2b15366e4e03ffcaf7f
BLAKE2b-256 0da90c7241705bec021022761e3876cde5565bd2d4f91f04d3f0d7d740f80803

See more details on using hashes here.

File details

Details for the file zenroom-2.5.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.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 786718c6f138c8fbb5fcd8316483088e1669ed6cd47f7c1de3f738964d9fb463
MD5 c99d7a68f5f55af1cc9510df1a7436d1
BLAKE2b-256 5a0d92068d484750af04b4bf6e67a3a92c9bc31ffe7322693b0f904c115eb603

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9ad2b78604da7a1b9f170674c7b1815f3c6ce931bd72d8a14fa7016dd62c31d8
MD5 48a11000526425bdf92cc063d4f14452
BLAKE2b-256 205b67f6e70fd51cf2f002b13cd10cf52621f72c68ce0f4397af0c3780de65c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e0ab16177f62caaa6b8ec8680452b8cb8a0f9b8b31e37383584ac92d902ce64b
MD5 b36b79343246a83527f630e4bbe394f7
BLAKE2b-256 8e14ed9cac0a7d91f24d01e3b710d79162ea0ab9eeb2949901d28c598f57179a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 491f94cb6aee5d306df67f537a0246e519b207866070421554df99c13d8d8737
MD5 70aadf4aa557651db53fe4741453b0bc
BLAKE2b-256 971fbf0123681faa431272560a5ee4cd47f1a595d77e2898a32271e5d8b2dbef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 33bcbfb13535f9c45312e4c5e2c7e8e7ce1f7690bdec969739ba0db4848ca218
MD5 8f0532d3da40a46ae8407fb61df262c7
BLAKE2b-256 6b31a93fe820aa81ef694f0ce2d4722c8cf8a53c4299b1a2e5cfebc10d625477

See more details on using hashes here.

File details

Details for the file zenroom-2.5.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.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 1b055c605cfc9aa727e543ae16cacd44ced8dc7260c9a9c13fc98804b6a05659
MD5 648c1610886b1f7866bfc818cbf82988
BLAKE2b-256 88034e6a52990f6e5c0f93fb74ca75d496c58d2ee4bdd0a044ffafa09f74172b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 010db03f3e492957d897387efd392bbe4fe86b2bf0575a5ec0abc94f5ea44bf0
MD5 d77527435b32f28ef6f9df37ca8e6200
BLAKE2b-256 0e745adc8cb0dcb78120bef1f0ff214bae491d936c79a48e9b4efc9bcdbe503a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bc1a4f32cfab551c5db25b5f7f29583d9df39bb674cfc8eb9e7bd33f98f29d72
MD5 7dfbe69e2716c2244b3456cfe97b34d6
BLAKE2b-256 31c2350efdbad9e1416d9d7964bea1b492525cabac2f11903067b13c9cc27a05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2aa784709fa00a6b2a4c8af1a1f796cad2b7208ec540feca66fa43b3b8eb62fc
MD5 5029adc4825998ab85b44e8e62a54325
BLAKE2b-256 e21cfb74f90cb125b8cd9b1e0bfcf704b23451fbc7002b91ff43f27aefd3dc57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 5027234aed7014801204326526511eb035eab21126c9047b6f3d1dc73e770110
MD5 b24206b6acfefb8829b165c759038740
BLAKE2b-256 c5889640cc1c440c8f0417fbf126d4f05e485ac04ea887c5d0834e366bee3866

See more details on using hashes here.

File details

Details for the file zenroom-2.5.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.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f8114e22385df7667bca4b27c7ef2d6f16d3f093e36a588f5c9f6bb18795ad2f
MD5 87eab299ece760fba9224551fe6781ab
BLAKE2b-256 c732a44c4ea9c9e58c7bdf02e56ba08bc64a9b138b93c3322e31185a3f182458

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 fb96de124818253d6789882616e2674fa4fdaa12736e2e876b00af089680683b
MD5 bdef6a40dd32123d5138ce04d6bb6a83
BLAKE2b-256 94a21d51ba6bdf588aaede0ab3170fa5791089677cc9aea677f58507c84a7393

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 4224150eca314fc661bd1185700e08d7c734f1dda2b33a04a55d2d9df609f258
MD5 a6b916160ddf1469ed26a23198c60f0a
BLAKE2b-256 9f269c0b3126db4551c971c77ca49259e311e17d78b49c24aab5c436129499d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bad1418c1fe7c037ed704101dc070c34beba21dcb41a51ca5f1804cac20d0257
MD5 b268b2c7446e5f1510a151bcc5a4c56d
BLAKE2b-256 75b102a79dab22a634691470f137a15193dc9c0506397cca66b4436ec35c83b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.5.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 834b8f23103e6009f867291033961370465e4a7bfc9847e843d970616447db19
MD5 af63f5db727d8836a29d2dfba3575ba8
BLAKE2b-256 7825465f7ae12557395ae9dc8e3d7f07dc4c696d1679bc4c53c2f334c6e2e7b8

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