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

Uploaded Source

Built Distributions

zenroom-2.13.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.13.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.13.1-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.13.1-cp311-cp311-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.13.1-cp311-cp311-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.11

zenroom-2.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.13.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.13.1-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.13.1-cp310-cp310-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.13.1-cp310-cp310-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.10

zenroom-2.13.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.13.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.13.1-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.13.1-cp39-cp39-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.13.1-cp39-cp39-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.9

zenroom-2.13.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.13.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.13.1-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.13.1-cp38-cp38-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.13.1-cp38-cp38-linux_armv7l.whl (877.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.13.1.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.13.1.tar.gz
Algorithm Hash digest
SHA256 c56b34e678b3163e14dca1f7a1d4ef44d90d34e07ed5fe658814644b705cab58
MD5 e18c5fa20b947962de03e9e935cb6204
BLAKE2b-256 fb6bc942a7fcdee0595855bcbc53e1c55e60559504fb49b54587912a8a8d2bfa

See more details on using hashes here.

File details

Details for the file zenroom-2.13.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-2.13.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c6a2729d94ddb187bc5b62db7ec252d088e707a2f339c1a641fe33d101a4683d
MD5 4b8908d54fe52d768aed4b38a59ebc7a
BLAKE2b-256 921a0a06d5210b214150d54f99b395d53c3c831e2a2f57fecd965fb8e7289a12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b176306f3a3a98cad60f98c1183daa5bbaa607d67d3c42fa029ded10f72c3752
MD5 c2d9e279d687af93738193b016b4e42d
BLAKE2b-256 42b80a3fcb098289cf1433d957c207be99a9bd64a9e2d736cf61e7f0b2360f4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e830472030e42d1509b5e46ee1626bc9a3696815851cb9d861f87fc3dfd1992d
MD5 0248e4cdd9c54ab3ac5a60adf95bb9bb
BLAKE2b-256 b6be31352ee86b82cd1e35b577664149a555d94ae979df9755f9c9ae927aa3fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f8efe364fdd6d4e1faab323a35336f1b6f7bb386e23a83540910c8c26f04fdd1
MD5 4cb6f75e9aa5383e9e039cd790ebaf43
BLAKE2b-256 d3c908c221f459a9944b618fe12c464d12da3112b1cffcf38ff8768267261817

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 2d738f6ecd2e6019ec5c5810cdc6425b50ca12406be5fc06cdb755bb5e2664df
MD5 089e29d3dc4686f5ccaef01155deee4d
BLAKE2b-256 47e6827f7a20db55cb636ad23d523262a57b8391b4a44b31f8e709914a0f3183

See more details on using hashes here.

File details

Details for the file zenroom-2.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-2.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3ead536be8ecd2a64b29e8426e7c6cc07c34cb29b29b776115d51a23746c8e22
MD5 1a4a3c06377bc01c08457dadafc08e3b
BLAKE2b-256 08168630188db0cf5c423b47402e045232c5328c86a11f72c01936fef696ecf3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c54d281ca00e413d5fc7e3f11f562df812a94de23def2f1f616f26f42d411019
MD5 13c1e1b95cfcedcf7cb7dbf9445db68b
BLAKE2b-256 0d1cbad9606090eb83448bf741f22abd14f3beae76d323746b62eee2bb0f8f97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 04effc333ff9ea605709ad2727dac61593630db785d46b02aaf0fff9caddcf79
MD5 40dfc0f056acb9f3f51139d8f808ad20
BLAKE2b-256 7992c880f86b56f456d86075069f2c67ccc9e12f093806ad09847c019bf97dbe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9d9054715a3fadbea89123be6114b3562cbc3fce4830412b367ba709e7224936
MD5 8aa9e8d9a06b577527063011c2ee9d3d
BLAKE2b-256 7776e8ead11e05af530f341d71933168c0a383b1e0545ef4accda294fa333c7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 f0b2588da126c599bd96f33f3a25802e9aa92a6d0c36bbd0033c4e8aeba66c10
MD5 1c5df11cf80a3f075ede0eca5f08bf8f
BLAKE2b-256 30c0c0f3dcde4aaaec22bc65a0dddd3c1c81869bcbf0bb54f4b1aea0ee00d7c0

See more details on using hashes here.

File details

Details for the file zenroom-2.13.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-2.13.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b79dd94f02cca47c1a119d8364e22dfb70b434fe76c28f4e86ac95d7f33079c8
MD5 cd8f2f0a7420b9898a6b4f35331dcf1d
BLAKE2b-256 6a3f32319afd371b7890c244e56cb257f594e923fee0f12b8bab96b9ec5729af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9f99deb40037f2957c425d3fd5fd42936773b0ba58406d93eb2a35a70d6d6dcd
MD5 b3c06facb669b73c28d8c8d7019ce4ae
BLAKE2b-256 67ab37d18c7fb459e183629c7c008c21a1f39d3c91b2ad7b02802a43fd222377

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 211761fde9518ceb34302c52257766003e9c287a0d19b90f8d6d3657c81be019
MD5 8a9544fe49e0b07eb6ff746b7d1bca98
BLAKE2b-256 ea09d9b7421ca84d62a4381b4cb1d9b116675cf1454b64a654cb2a82980d70bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9cb30e7b143d5c43970d1e671d07f80a674807ef0f0892d63c57bbaf5dafedd2
MD5 6e99ec13e72ec7b0ccdcebca2d98601c
BLAKE2b-256 94d02a822c26f68ce12f8f0e3975162a47dfb3e5050792af68bfb014b51d01d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 d261589fb81ac26269e74ded650ab8fd1fd0a23c260933f49dc64cbde9391b21
MD5 a3658c991e41786fe8a7cb7f6c90e854
BLAKE2b-256 974b68c7f5cc19f4b36c82361feacb521ca6b5b41e32a73b3511d6ac90349ae1

See more details on using hashes here.

File details

Details for the file zenroom-2.13.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-2.13.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7ac09257aa925686fec4a1480388326256ef73382cae078f8795141b244dde70
MD5 26b6d69f559fe1a25d3cae1876209acf
BLAKE2b-256 bfcc8e5435449c0f8971449d1ff9e62c8d870437a6a87d9f0ce5a46beba828db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ae4f5b487ed3e4b7ad6963aaaecfabfe4c47377ff9d9722da6f25dc3218eeeb0
MD5 80862647bb45ece15850d3e68b22de50
BLAKE2b-256 22d07914e5e813384f97dffbcba9860f6294f4f59e38bea2ad94218a34fca483

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 cabab5f03f8ec48bbba98a222a99b4b7dbb923aec583cffa09dffad5b8f1ff82
MD5 9e676a01516a6629ae957d87a59a4b4b
BLAKE2b-256 0fed420b80e10f1b6a2d0a04d937c6cd3f9714e04a5a40424ed8e82e06cc21cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9826ca274edc0099b5905f71d9383b9da3301d4672753a8f2c333410c83b7523
MD5 bcc3339a6ebf9c6e2782de4ce7eaac75
BLAKE2b-256 01e4c8f58f60c5915762c9e68517fdeb1eae9319e6d0764057fbe3f28ff22077

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.13.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 bf70bffc01d15dc50e1b92bedd2de83ebd35c7a67052949b20d58d3db5fcceec
MD5 7d2f03e4436e2ca2820f17b44c855b92
BLAKE2b-256 bda14c139b1d3c96318dd81ae5bacec517828f877e01a06ea9a5595d427eff25

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