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

Uploaded Source

Built Distributions

zenroom-2.20.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.20.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.5 kB view details)

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

zenroom-2.20.3-cp311-cp311-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.20.3-cp311-cp311-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.11

zenroom-2.20.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.20.3-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.5 kB view details)

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

zenroom-2.20.3-cp310-cp310-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.20.3-cp310-cp310-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.10

zenroom-2.20.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.20.3-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.5 kB view details)

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

zenroom-2.20.3-cp39-cp39-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.20.3-cp39-cp39-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.9

zenroom-2.20.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.20.3-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.5 kB view details)

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

zenroom-2.20.3-cp38-cp38-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.20.3-cp38-cp38-linux_armv7l.whl (877.8 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.20.3.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.20.3.tar.gz
Algorithm Hash digest
SHA256 04883f800a1beef5fa158c9f31b62bc55b631749438c1a399dbed23b6f1bed2d
MD5 dea7f3dde17cf831bbb1b769f3db29ad
BLAKE2b-256 18ec435cce005e09a9ddd8e8b75b592e672aafe4611c14446503014a70ecf1cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 ed0aac442dbe3b865908f4173cb5115c51b06af5bb6fb6f43fd7d51dc9a1ea6a
MD5 121e8d2a0cad50dc6302c678ff29bf14
BLAKE2b-256 1e93733d8004628704e48d07747c9a9ae744d62fcc70fe3ecff2198e8c991158

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d346a57bc22e0c6dd5b1fec946a025ad4e1ed26bf34f7bd26346fd10ce23032b
MD5 7ae119cce9bc5035e7b90f9749e024a7
BLAKE2b-256 c9e65b13db0e17555c8491269ca44044ef191a3adff7db3b4134e74142e94431

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8cbf72a602871d1d4bbc38fc008bb7f788e9b08a0b5fa2dd917f3eb4bd337dbe
MD5 d39af63d7a916782658e22adc02716e4
BLAKE2b-256 da36982dcab82bdbf4df33c5a112ce04332fc1ce770ca8385d6c111fe0d50fbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 93e73fb1b09c9b4a5a073512b7f8b2a37964f9cb283cef91b161049196eeaf71
MD5 8543577404b6d56171af2d5ddcc33f9c
BLAKE2b-256 b22e73b99436f8ef3dba86f39d38a3f10facd5f1908949c0c953391539f26a5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 5a516a6b78ed409cb92840ff19689a573b41889e4bf997128b1fdb32a13d8821
MD5 309759b3b686474fa91ee4516d2cd761
BLAKE2b-256 55bb1e0323e4dba6f44103cac8b1102d2da5032f0c1fbc11d1c7b3ca1ed5f6fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c83e5d28b8c01538b7d0096c442581692e90445b9170262d839549c39d84b6e7
MD5 1c8db753edf3c56052652502603ff31a
BLAKE2b-256 5d4f9098df2981c43c5af83ee1384f6ee9e3a3a9eb4d8611a3f4ee1d44c1e060

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3cb9e6b79dad80aa707a10f8b854b9621a1869df824aa3112a51b0cad5b8b52b
MD5 6d3a87011a5befb93ae9d2a1d983f11a
BLAKE2b-256 7f4d6724da487fdc3b60ea91d07ccc81d3a360f76df5aebbb453973f618772de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 41c99a87f9eb36207de4ca013b04e78382c1ac8528891a60ecfb1891b10bcb70
MD5 0dfbe51aa36878b313c583ee4aab9dfc
BLAKE2b-256 0cfeaa610f0244791c331ab774ffec82d693d756075f477613b5b3f743bf4644

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fefb989ce7e2a9786b9fa31ed211636ccf820f326aa1bc2189c454a8699bef97
MD5 f275d2c1412aaf23bc35d47b3c9bbaa4
BLAKE2b-256 4c58fa686bb7fba0fd1188849115c715dc603868046f915ebacbcc008e3d7383

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 3eb82e2d386cbb1879a62cb4b4a635afa01548a96f78efa678df05dcacfd4939
MD5 75581e8b0a535c60d9d5096df9792035
BLAKE2b-256 490064a94be8d0134479f2cdaa613e6d92835648ca3c14a112086c77c5d0558d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 87b998c3d07c46d39bf401053ba11b8cad9c1fc1ab0c624f16c1fd20258dd9bd
MD5 e917a102bb415f2e7aee65439b9b220b
BLAKE2b-256 5e222c61bc1c2392c82d159a73cef2c63fc9a1aab738fb7e924c6c1ef4ed852f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e2e8a62bbfc9a2efd3433cbbd4815ea6ca5359b06b3bcaca49cc91e6df949893
MD5 3f973b6701a8c4f5810300c238b8fc11
BLAKE2b-256 80d588be6daf204de0c3a7c35c56140ae5f513d0c514bf851e519285392006d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0aa9c5a513976edfd45406108a2b9aefca4d0cf7929025ba3b67156d321f4c7b
MD5 919f1efe4d41871e8ab994b80cee2cb5
BLAKE2b-256 7294f59ba2fdb3442a059e02d2f0d9038dcba56f430146bdfd85827fe4c381d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4b9f7ee125e76bb08adf1b506fd2f28de78b880b56e1b9af406d3287433fd865
MD5 15e290c4288a9c42b62c8a00e0d31c39
BLAKE2b-256 0f8d8e0bef5e153ec3b81d24ff3ea8f083970ab282afc8689a06bb38ab1ecff6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 676481a0165aa45daa37d11835138f5a8dd79af72c851694412eaab3db1c29ca
MD5 e188b35487fb61e708123c2fb8a4f0ba
BLAKE2b-256 8e097991f7c8d20b649fa115a37bf4acd9a385c021ccd3be90e1d904388a6636

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9ebb296e9033e57ea6f17bf5c81925ed68ad3b93c5cf2718f266005c49b5c025
MD5 1f8018d1409272d37675752167d9f6cc
BLAKE2b-256 89e37bccefdd945e9200e82823679657070c6b84599b168b229cf46388e1b074

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 223a41e10115e6fc38f9367c579ffd84cd3c8c29a626e6ca21a1d00cb46fadfd
MD5 b436bd61c5e3a14969e93db640ab5dd2
BLAKE2b-256 10dee779ec34e68c787b79f2c370d8509fcc3adb435dfe8783cc077877f01ec0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d8ce645453a9d5df534367db6cf2d66f0ddacd545848edcad4567b649f954948
MD5 e6371b3f5752dfb4cfb7c834503f8ce9
BLAKE2b-256 9f035cc673351de1b07e4374eedc1e59cebdf6dca8c09f919778080159f3a1f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 084b36c9e15603e997e91769c1c07597fdbd57661374e0ef4adc33c175c6761b
MD5 41902ae247573ff0557fe50d4e40f51c
BLAKE2b-256 1aff4ee80b722c2c5df15afb98bb3862b92c39d1efed8ddc05396e06860e1413

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.3-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 d5b754dcc68f5a3eb481ae430203fb8fc27980485463b1d577e9fa78861e330a
MD5 d50d5e90931d3c6eeec5290965b09fda
BLAKE2b-256 dfe40f5b866239372b81da683c47d2d2f0a8bd8c629c3632e70704cb05f88e68

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