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

Uploaded Source

Built Distributions

zenroom-2.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (918.0 kB view details)

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

zenroom-2.21.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (932.0 kB view details)

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

zenroom-2.21.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (863.5 kB view details)

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

zenroom-2.21.0-cp311-cp311-macosx_10_9_x86_64.whl (779.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.21.0-cp311-cp311-linux_armv7l.whl (879.8 kB view details)

Uploaded CPython 3.11

zenroom-2.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (918.0 kB view details)

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

zenroom-2.21.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (932.0 kB view details)

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

zenroom-2.21.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (863.5 kB view details)

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

zenroom-2.21.0-cp310-cp310-macosx_10_9_x86_64.whl (779.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.21.0-cp310-cp310-linux_armv7l.whl (879.8 kB view details)

Uploaded CPython 3.10

zenroom-2.21.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (918.0 kB view details)

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

zenroom-2.21.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (932.0 kB view details)

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

zenroom-2.21.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (863.5 kB view details)

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

zenroom-2.21.0-cp39-cp39-macosx_10_9_x86_64.whl (779.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.21.0-cp39-cp39-linux_armv7l.whl (879.8 kB view details)

Uploaded CPython 3.9

zenroom-2.21.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (918.0 kB view details)

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

zenroom-2.21.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (932.0 kB view details)

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

zenroom-2.21.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (863.5 kB view details)

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

zenroom-2.21.0-cp38-cp38-macosx_10_9_x86_64.whl (779.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.21.0-cp38-cp38-linux_armv7l.whl (879.5 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.21.0.tar.gz
Algorithm Hash digest
SHA256 c79dda45ed521e13d75bdf0ddd5eec497dfbffde66f69278da02b296f30ad17e
MD5 45b18aec535bc97e191ff7e696063268
BLAKE2b-256 966c3f75c98381e9f1ad6facdea916cb0af9163c78a9375e76fb1155085158a4

See more details on using hashes here.

File details

Details for the file zenroom-2.21.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.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 402a799532f55285724fcdca6b1bf53b63b0bbc22401bca81db55d35061055ec
MD5 1b6607f7c36a192f890503bee98e5e27
BLAKE2b-256 fea685d2435d1a78886b52349d838b4718c2dfa3fd3ee3bc0235a7ffb2f40025

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 dea0eb71d0e524d47e7c1904f164fb03118bddcfc11fa13941c251b2264e17e1
MD5 661e29bb90d63aa8e425fe1717f9c9f3
BLAKE2b-256 ac8463589cbf3b33ea3fd9c3d9894243b7bbfda0409089a7b6471aa09c1150c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 6b5512de3a9d355bea0c26846400b396cfd38636ec7fd11a0bdcda2674e6c3b3
MD5 9ecf461557483858f53efe234a4e9b75
BLAKE2b-256 d93c9c0f523f1356670b7ae5c5210c4e9797f142b4d8866305dc52bc90d2dccf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 23ed0d85b900f740ea68631509e79c516122bd859f886295591daf4d457d7106
MD5 671d3799e21ce8bf2b7aafae4e0a5a22
BLAKE2b-256 8d91e993caa02c5088fc5c5c8e8103ba61e154b85dbce10dced91119dff7dd8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 b90994c98c87badb7a5c774c739d81abbea98a2d9468dff1a0a7c94947fa13f2
MD5 0ac066d5f8f2b036f9e30132a9fc714f
BLAKE2b-256 5d8aea5ec4a7b91d497c8c828036e080aa4025c16a1cfc7918575b14f9a70b56

See more details on using hashes here.

File details

Details for the file zenroom-2.21.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.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 4b624b8ece3dbe231ad6321d288969af4fc0982346e852d5bbe7ce780af9cdab
MD5 2676e194803115ffbe5f36470f01fdf4
BLAKE2b-256 84d033cd8ba48244ee24fbefde01d6afd7b84d1ad9ae15115478b9ab7a8bc785

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9aa2d6e7878a433da2f229cc2ea4ee735da1ac2d7aa308f0f8629664de7750e8
MD5 71cedfa52a6f3069d6c27d75e5ed75b2
BLAKE2b-256 42bd0ada8f25ab01c6a0150d0b8f5524a06b4267d841ba9cdf25d5f1b92548f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 5c1a8357c273b699e8018ee345ff7455050292a68643b924697622a70d16c865
MD5 8b126154a28673ad4585a90cb5e1be8f
BLAKE2b-256 8ba1233d4fda733e7d6bb0723f4e7214f704dccff789f7612babf47595ecc39e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f76d1ece0504507cab83095e8e9b15f04e2b3a1230d31415c13978e345ece3ea
MD5 f6dc44efbbd1ef25c9626c891bbc7eef
BLAKE2b-256 0b313e701536c60b85f5f6eee3b3ad2b4c1eba4e3edb369d3bbd8516920ee2e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 13fbbace76f7c336c7c2eb53541b05f39fb55e416d3d9f3861fd090b27755386
MD5 18399b9cb1dbf0f0a2e998f088c16828
BLAKE2b-256 905b529f35248f0ffd98bdd57a419f47d86c6f6ef4a798d2bfb8f42d13f776e7

See more details on using hashes here.

File details

Details for the file zenroom-2.21.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.21.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 77a2908b2abc7c22bb387933dedde0e212536e635fa6b1b76ee82a818bd36c58
MD5 843d35eddd29404cb88b6fda1894622b
BLAKE2b-256 71265b5ea4ae2e889b1debcc4aa4a3c810041f8a45cccf66d6e468f454797ec1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3aae984ed13e13cc099eaa14636c742983499e4e9ff8dddac6736bf00e15c03e
MD5 5a282721ff0c745fbc2ed975ea2e0d01
BLAKE2b-256 2d48b45431753958c96d8f387a59c234e99699bdc6741e973bd690179f4bf3a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0ca78e993a7c1dc53505bbf17f28344d932783a8e998e9bd75acb2bf6ea5d83b
MD5 30dc8c50af0d931b9fa61985a25fc888
BLAKE2b-256 1dd189e09768f30aca9e0e81c39820d7a78268cd4abbd1e7aba722bbf72e1ce9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 87eede47ed02331c0d48b2e52c3b4978c2367435c449e22461967df4c3dd2dec
MD5 594fa7ce047c6ae8cc0e35dd9a3a821d
BLAKE2b-256 c84e8ee69d8e1b8c2698b0f020d6c6dfac5855ead79a03763d7fa10e7ec66fed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 278e8f1e97898f4468277e84017551bec685d8fc04a2b0816f14dda85728680b
MD5 a7781005190fd38695e48823214a58d6
BLAKE2b-256 f1f6b81ab2ed0d6637b689f62ee8d49c78b815967b108074e8433eb472988c8e

See more details on using hashes here.

File details

Details for the file zenroom-2.21.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.21.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 cb0dbd3406ec1c843febecb394d9869b055285b7eb72b3e5d8f21071f724bf25
MD5 7c8b351cb3952f8779cc2ddd12bfd92b
BLAKE2b-256 8654071d6739aa2e10b0ba31af67077510d228520d37e2e58a3bb145316e4938

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ffe2e2eaabe5841c9a58f697aa167a6b5e55beb0ba49f71b2a064623b088bd4f
MD5 6463af6e1dce1d8a128d2fbda566a807
BLAKE2b-256 a362152569929fa450811cbc707bbb7b2e0fca8cc5755daddaa0d8891d58bbf5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 fa34d31f4f50e0e466635af6c99bd6b2e1cd53ba9752c8e6bb1a9bdff5c1fd3e
MD5 cbe104129bdc0a07825911abc626e891
BLAKE2b-256 1a27392b7b78eeb0518efe68cd9755bacd5a4bba13a040e5f57114aa89ca100d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0ac64b57d97a754e6c6d9067ff7433fb3adc833a15c19509e73cb4a6f444d45e
MD5 2f74a04b3fa5c6cc93f6f29e12322383
BLAKE2b-256 0c239fe0bbe21a5b2d9d02ab3000a8e9e2424a6be00f2a49704dbfa7cda6cc93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 afbbc0b37ea4d44e33e85fcc14acea7b437a1fa9f13bd8b51e1898d44c1d8619
MD5 95f46f101361343014ea908592025451
BLAKE2b-256 69894655fd6c724625c9f294211d6a6f3c5d2771718bc6d53fcb7e12d1f7442a

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