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

Uploaded Source

Built Distributions

zenroom-3.15.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.1 kB view details)

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

zenroom-3.15.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (804.5 kB view details)

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

zenroom-3.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (754.4 kB view details)

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

zenroom-3.15.0-cp311-cp311-macosx_10_9_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.15.0-cp311-cp311-linux_armv7l.whl (783.3 kB view details)

Uploaded CPython 3.11

zenroom-3.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.1 kB view details)

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

zenroom-3.15.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (804.5 kB view details)

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

zenroom-3.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (754.4 kB view details)

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

zenroom-3.15.0-cp310-cp310-macosx_10_9_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.15.0-cp310-cp310-linux_armv7l.whl (783.3 kB view details)

Uploaded CPython 3.10

zenroom-3.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.1 kB view details)

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

zenroom-3.15.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (804.5 kB view details)

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

zenroom-3.15.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (754.4 kB view details)

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

zenroom-3.15.0-cp39-cp39-macosx_10_9_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.15.0-cp39-cp39-linux_armv7l.whl (783.3 kB view details)

Uploaded CPython 3.9

zenroom-3.15.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.1 kB view details)

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

zenroom-3.15.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (804.5 kB view details)

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

zenroom-3.15.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (754.4 kB view details)

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

zenroom-3.15.0-cp38-cp38-macosx_10_9_x86_64.whl (661.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.15.0-cp38-cp38-linux_armv7l.whl (783.0 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.15.0.tar.gz
  • Upload date:
  • Size: 25.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for zenroom-3.15.0.tar.gz
Algorithm Hash digest
SHA256 c885ae37c7f72eca8b370a8e9fa632534f321f55243b26d949141b41061c86c5
MD5 6c1fe3be1a995ad852f2a87aa1ad5768
BLAKE2b-256 37f9dc2dd24705249a54a1aed74f949e4e493f79026c53c265ddd3895be83d8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 eecd18997833cb60399e3eaedea6aa85de133eb7f4ee56bccee2b58bc67dc263
MD5 89121da3af00a88b0fec49e186690a36
BLAKE2b-256 9b20be9b229faa2a455ca8d2d8e1f9dfa867e83627c5e7feb9dce4cbbcaf2eda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 614231c1443a147f5f20fd8f9e19c02cb33f3dadd3e2a0c631c85bed68610904
MD5 08749cf2e9db092ee5e418a1276de3d2
BLAKE2b-256 df6ab01a3b35219febe4de6619891df0bba024c3d0ba32ff5f116e704926c8c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 25a90fc686cb06491bf3f6c21185477aa23c99871b60716c877d861d03737d78
MD5 2f30267cb4bbf9d879188355fa7b213d
BLAKE2b-256 93c4adf867d49047b697d6429d2b4aebcbc0c8f228436303fd4431dda20e4919

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 99d86a1edb25ea590bd2ba7a47ce2e373d74ccf8f85d1191f6c469596980d838
MD5 6c0fe18df2a48f7063e41a3564ca8b69
BLAKE2b-256 e34fef6b3fe0ec9ea569b1ee234dd0685e173a8849abc25f7c692f4479d98c5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 1adc39428080327e6af3221fe6c848efe57b11f7bc9c2cf40d7b675f6c6e0c87
MD5 d4ac6b03b8b8502c75ddd219c021e8bb
BLAKE2b-256 8964a987f3a19e70aea17bb682b9f70292ea1dc686195834725d8305bbd069d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0c9eebca61fbb8c5005cb57ed09eff14c2f772b5788b49c71d34d4a3dda16308
MD5 403cc26c54b26b1b5a4119160f7e4bff
BLAKE2b-256 de1a07a3b020e748563db3870a93bbf85e9fe1cb38f5cb028b5096bb5c94b104

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 4d693039bd6e13462d5ffd97353db70159d51c233603046bfa0c94c3e5cdb9ba
MD5 aa2549f34c3f4166bff1949603a7cab4
BLAKE2b-256 dc25dba344b6b4e31ab96d56af2b1ce12feeff4c8b84ac7cbbf5ba51c5621713

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 61ff49504def942f1240fff3c2efa61b967337dc57e8edc3724caf990fc48235
MD5 446bdce231d3f4a163b1dcb3283d3125
BLAKE2b-256 7c5461f29934e0bd89ebc9d32992aa9e85df8406e15db44781e425519d4e1076

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 49abaa0f4e39fb18a8ad663f5076683ea0205e88278c59726c67d37b5b671f3c
MD5 e4895b2ac362db00ae441e60d1d9e904
BLAKE2b-256 5bed157b52572e2507f53e14b452862c97e77b4316caa5e56ef9184b9ace38cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 345368500bf12a56c7b71611c1e17925837cf4aa66a25d30ac2457fbf8829a30
MD5 13a730da04479b758674e1926980aebd
BLAKE2b-256 f3fcb27f7c5cf78b8d22523551805ad3036588ab881ae5b331ea3b5b5c588727

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 679c1c4d5de350cf02e23e22fb9e64e1ab20afeb98ed096f5e2a84df56b1bd78
MD5 e6ee50598f8f65f8ab87ec83f587bd18
BLAKE2b-256 8bbebf59514403ed1630a94b90da8a2f92dc3dda32ce8f7e77d17cbb37045a90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 074a299cde7f65ecb1eafc9544e140b241717767f2ceab950afde3aca09a4000
MD5 a3d1fbe478e42f21d2b800535472e949
BLAKE2b-256 0c0eb59d2a4ecdf5e34f0b54eedab07f6d5dcdf2a93293df9a026f1fb3e363e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 cbb982815a28a0919e26a46288d1c78510cbc8d0ae528c2de10c7e355c293e44
MD5 c4c63408eeaf421dbdfff6ee5e5481e8
BLAKE2b-256 952cb6026688bde31a43493b38c785280ad4794be55ca98d045ab18d6f2ff801

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e72a45a71c87a71d01cd8e6f48cb279f1d718c3ee1ca3bcccd067ab215614996
MD5 e60fe85c2128b99f2a1c018e41e5b877
BLAKE2b-256 f029cd79261dfbe6631d76839b77356c468e3d3f846e8f45040276e8a4138fcc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 2edc3db1b03e6163616864ffd68f5543e11b3f1e7a3d31387bb548dceff1bfad
MD5 70edff6ae1bcfb0d85086415b7b44ca9
BLAKE2b-256 4ef2052de012600d2b86a8f9d9f1957b30d57080c69ad3a20a2baf8807cf4c90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b9c65cd88dca046ddf1def79a037aa3d109f14af0a6204fb1e6f870b29689f82
MD5 15df663e56fbe9d2ea78ea365de73652
BLAKE2b-256 65fcd6e9f42ae8e5e6c57bc36e4cc37f10cedf57710317113b2d0fc75dcfb7ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2c68b7bd69d48c6648485e9cfcafb5e7abaa40976e365b9b188af3e7e2bf4bca
MD5 85805957ec7d1acdd2c0e6a1ed8e90e5
BLAKE2b-256 11e37987273de3eecbf0faa8018048d0497a75df51122e01d71bcd254a1571bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0656ce3a35957513741625af4fee2df8927125bde8136ce23fceae2f8f813074
MD5 672dac0f73c5576654e7548c62f794a8
BLAKE2b-256 a882d41b1365340a1c8a95a25bf3b9fc3b6c29892f5eb135d0a08b00d366c15e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f4e733ba4a2f63b3ec36be37f91cdf7c2916aad56dcadb42e4da88aa6d6a3c58
MD5 d023123a53f6682dba899bc8afa4848b
BLAKE2b-256 62744ea9045db58816d917aa09435b4e7ae16846e14cd2bd3223f06f038f7e92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.15.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 a66d35a3f60495ca5731e91450f1d195a81b26b286208433d7def56344e9a3d6
MD5 f51801c87e5a8efb7e039b979ce39096
BLAKE2b-256 e946b705bfa6bc8833739d2d8e78ecc4a01c115c5e65642be048f2aaf2d19dcc

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