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

Uploaded Source

Built Distributions

zenroom-2.16.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.8 kB view details)

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

zenroom-2.16.4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.9 kB view details)

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

zenroom-2.16.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.7 kB view details)

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

zenroom-2.16.4-cp311-cp311-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.16.4-cp311-cp311-linux_armv7l.whl (876.8 kB view details)

Uploaded CPython 3.11

zenroom-2.16.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.8 kB view details)

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

zenroom-2.16.4-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.9 kB view details)

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

zenroom-2.16.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.7 kB view details)

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

zenroom-2.16.4-cp310-cp310-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.16.4-cp310-cp310-linux_armv7l.whl (876.8 kB view details)

Uploaded CPython 3.10

zenroom-2.16.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.8 kB view details)

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

zenroom-2.16.4-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.9 kB view details)

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

zenroom-2.16.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.7 kB view details)

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

zenroom-2.16.4-cp39-cp39-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.16.4-cp39-cp39-linux_armv7l.whl (876.8 kB view details)

Uploaded CPython 3.9

zenroom-2.16.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.8 kB view details)

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

zenroom-2.16.4-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.9 kB view details)

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

zenroom-2.16.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.7 kB view details)

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

zenroom-2.16.4-cp38-cp38-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.16.4-cp38-cp38-linux_armv7l.whl (876.4 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.16.4.tar.gz
Algorithm Hash digest
SHA256 7ecde8678a455030aec06bd14e715dfd573260d143770aac93f4789547a00c1e
MD5 8510c2e121bedc1697cd376caa2db975
BLAKE2b-256 4a0b96fce47684140c1f4f21027ad5b9451286b129248dd182e7e9f612e39bc9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 51f4a40fa5f01c55c275ae1587f45783201c06010ebdfa06029e93ede78f1236
MD5 6fccef99754360aeeba2d467a025c402
BLAKE2b-256 fc6f76e42259f5b1acdbf096e2e21f54c1ff2f0f60a3f5ef88336ba6dc0771ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d186a30a7468cb5ffce991e8871eab8b3a4242c5df5ed7df751a9d2f089fffeb
MD5 c44eda3ddbf2dca8523cd663f9d80320
BLAKE2b-256 b044b4b086a536f01a03629204013691f1ed9239958e2f7391f3cdf5a8578408

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c5f61116af4d1efebd8994a541446227ddc270661ad5dc6601d5ba4d4e52e440
MD5 e4ecd483d551f2912bc6854e58c1da07
BLAKE2b-256 3ed6b582ede0731368b97a0c4fa05929535941696c54a0939b365ba7491ef27f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ee7ebdf25781727220a35feaa6c950660d9cc56a4016ba4fa0871e9b447eb0d9
MD5 7f31b3a44db122bbe1cf759ff0498a14
BLAKE2b-256 7ca9deaa859ec05e92433697d2b4acd5d86fa044ef3905ab066bd39acf3a844a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 61741dfc38663f92522231936e003244238af3376462c04198aad4db29dd9a1b
MD5 753ffba301833c9d090c1a62c1f0a2a3
BLAKE2b-256 fb814e23cd816ab61fd29cfdbb1742744feb0d56b4c5230205b1049495f49648

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b52e64111f10ab344e245560634b9a81a301412b5c28df83bce27aaaefebe67d
MD5 5851f7f4c008039041841150d6b0b440
BLAKE2b-256 8befd54e61f6f0ae16bf5ce2bbb85b30546f0e9173ee7ea73a23294920b9e07a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e4c4c80c0d3bb1ff99c755b325485eceaf90abe088e76f19f451d8d92682d4ea
MD5 aeaa47c857514d93c0b275efdedcfc94
BLAKE2b-256 8749f25abe830a62eab63c64f41d1c42ac5dd7a05fe9b42fdfb156f0b29eff61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bc7e656f3fdbee46ee3a3c8aaa6705971f270afba93bfa3c87a81201fea9e589
MD5 ea6707207f209e6b75e5d3567f06db7a
BLAKE2b-256 a1fc7ba3ca26ed8a4182ddfd55519ff8277c0d6ef7040e617c4df8410271b51b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d6e92520320765a9b2b16fa4fe2f8b400375196d65543e1a2aa0a88029901803
MD5 7f78dac24e8e65ae157b2d6389847d77
BLAKE2b-256 12f0dbbcd2cee7cff07d27f87e1ca7213564705a9244c20d9f37453b9d7e82b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 5de91ad9f99ffdc5d79f2631b2ba322f2ac54c008ff67f4834cd75917f989815
MD5 98800c630e657cd7bcbbfc3827f0e64b
BLAKE2b-256 abc559216ca738783e58b782fa3d91367cef00db6290f82949ee5b2b772a0f73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 bc0df362f1fa4a6d46a4c59a132d45ed2516bdaf0899b2f1fda720b2aa2ebed8
MD5 72db731bfae1fc0d6b07dded3850bf64
BLAKE2b-256 09dfec1a579f4059e9f72934876d92c74f6120789599bd13df9b481e75d30037

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 fb6d8a94b575eb43e4cbcb13c81caccb25f99709faff1df0aa4afe32da392db3
MD5 8f8f1ed074e83687a38c30385723b343
BLAKE2b-256 a92b16f2dc0f58848c189b2a3b738a45f49ccfb50e1033b381cef155fa0a70e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 524dbe61ed13b4a05b01fcff9b45e5a43eb2a57defcc7b461eb04d6caaecf1c8
MD5 23de6133994a96a40651382e96c328ff
BLAKE2b-256 30a8d9cf73d502c3b77c414ebd3fde4b884c0dd00357bca07548ea0d9efae3ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dd0bb2e91a265daa4d2e2534d218ee946bd536792fb2ced0c3eca7086fb00f20
MD5 07eb6b7de609b564ef1acea5e101f48f
BLAKE2b-256 9abdeb15e5132016a72ac650b0c2b7fcac99a2867b4f6bd948317ea0d6f58f30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 4a659317da0dc49fae3fdb29be4bb905bed76b3ec50c00db26ac164937f51ccf
MD5 cd9dafa5aa4af2a26363134d4f895845
BLAKE2b-256 885481cbac2bab415a8cdff156bc0ffc036c499fb596c4972f7c500065e942fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 190f313f16dacc9b686d87b48c30c23ed45da2c02ede1ab7010753363eb78b30
MD5 3d42a9697a47e96561801a95860769aa
BLAKE2b-256 57585fd13c5976ff0920a367bf74258abe528d99751498005ff65fe61daa5b17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 60094ecc09514b2177f678e12c459261adc2504e38117db1d5b9b382c4befae2
MD5 d3c4c27429bca49430684d72b1073a58
BLAKE2b-256 8014c301a1a79e1d03297902ea16e6a85a60642fd77c3c42551e77b6f8249f51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 144de836fd443da34d9b99749d28cc01c2d5990f4b665bfb6c0b0bf7a95f8def
MD5 0b6195d174e03ab012b580b478a2f5a6
BLAKE2b-256 c210d25b99cb168b509d1818df5bf281e1b6b27560d9b0a25965aad628466da4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 74d1454350c1d05e6b1bceaaf9e533f6e42c95d26ff12dabb6296a81c89086f9
MD5 431748c671aed550c3dd7807557f8da9
BLAKE2b-256 50ba498f58c835446ec0d244d92835e814503595a9662f4c2399e6b8a87ee331

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.4-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 132cbff4cf0259d93dc6e6436c00b4c1d975c956dc30a74b490522e3a1f9a0a3
MD5 219f8c3cd79dd33b2445755f411a1f30
BLAKE2b-256 c7ec3c1b1935f63b87360b3f3eba9d88c8fc0c7f6f5f5207c7c8db85fdc34c81

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