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

Uploaded Source

Built Distributions

zenroom-3.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.4 kB view details)

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

zenroom-3.7.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.1 kB view details)

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

zenroom-3.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.9 kB view details)

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

zenroom-3.7.0-cp311-cp311-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.7.0-cp311-cp311-linux_armv7l.whl (776.4 kB view details)

Uploaded CPython 3.11

zenroom-3.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.4 kB view details)

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

zenroom-3.7.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.1 kB view details)

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

zenroom-3.7.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.9 kB view details)

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

zenroom-3.7.0-cp310-cp310-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.7.0-cp310-cp310-linux_armv7l.whl (776.4 kB view details)

Uploaded CPython 3.10

zenroom-3.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.4 kB view details)

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

zenroom-3.7.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.1 kB view details)

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

zenroom-3.7.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.8 kB view details)

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

zenroom-3.7.0-cp39-cp39-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.7.0-cp39-cp39-linux_armv7l.whl (776.4 kB view details)

Uploaded CPython 3.9

zenroom-3.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.4 kB view details)

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

zenroom-3.7.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.1 kB view details)

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

zenroom-3.7.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.8 kB view details)

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

zenroom-3.7.0-cp38-cp38-macosx_10_9_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.7.0-cp38-cp38-linux_armv7l.whl (775.7 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.7.0.tar.gz
Algorithm Hash digest
SHA256 4402e39fdde531031ecee25012c0cb15ed580d8ab8822a7b6e0bb62ba22d8e2b
MD5 a5ad16187814d4893cb1ce3bda2f1372
BLAKE2b-256 7524b66199bcceb9f5e6254a478c57b9927bfba402f2a9b1f39ae5d4c1ad028a

See more details on using hashes here.

File details

Details for the file zenroom-3.7.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.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 738af433f5939be5525248067bbce9b95912c9a16b5b2c478cc56f2d1c42a0d1
MD5 904272fdfc76b4f8055bc98ff2d67a04
BLAKE2b-256 464c6a15f8e1b9423896c706571a5499859165cbbb2ef0849067d318c28dc9a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 8980b3953d2815086b12cf9110f8983f9ddd52e4e89661a51d39c1ad1334cf82
MD5 835a04514b7d6ff552996e7b8ad10c39
BLAKE2b-256 1e8d3f3981ade64f0afac8d2a713be5e88180831d65898aed147627038b394c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 f166c37957338a0eaf02bf83c23683eac2c1c58797335c8fbef6b182a1383c33
MD5 eb1150d5a0268de713f40b11a98b0fbd
BLAKE2b-256 0505ebc4d198c7b938cafea0fc76f5ab2d6b87da539201b49515ff61ea1f3eb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 76100941d235c2822244dfa686038275bc2dd8c62e0014affc7a7535a1b49ddf
MD5 c4c6ad5fdba4cb3aa181adb8ab80e005
BLAKE2b-256 8db778c956044062734b7575a94cc055df3c4e54fa74dbaee1e529bb5e533570

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 bc6825444138aa5affa988b36b2f50ea3617d63954805a8e3b2340f178e09b5a
MD5 d5b036fb09c295df81d6fc4004d50afd
BLAKE2b-256 e8d0412bd7cf198c61be80244a732d655c01ac1dc197788e783c0e472c2f2e61

See more details on using hashes here.

File details

Details for the file zenroom-3.7.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.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 60a962ec46fa0c41847b771e301958f5cb564524655111eeb0d1f15863aedb30
MD5 a8ac2bc980515a524fe3f05aeeb44570
BLAKE2b-256 33b7be8f724768a8406195614fb93795bde7c6cd5c51d3c6df10e0714ee5cc18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 11a1d0362b5e2f29427eab8269a21bbebf25bbb7705c197b6542a8c564acaceb
MD5 dd25664dd753312d289838e2482710de
BLAKE2b-256 50381efbb3c729ce62683be9c4fbc6848205c47d8e3a577a7145af58f9a63a45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c189f86fae129d20f8b6cf2614631b887001d4e575ab6cac169064d0cec3947e
MD5 6be0286f5c8e7ca96ec8d1cd0a6df33e
BLAKE2b-256 fb67431272b04a1d40de45cb49647a2eb5c767014c6094196636af6b0ba14f19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b8e9656352e71ab38a84b0176c559e6e22b6b32cf39b593ceda2a491c9b4e3db
MD5 ffd0de5df85ac36515d98f4fef21074b
BLAKE2b-256 f96c979cbbb9f8a39ac628397f10165d8b9c0ab04427486a61739122b47f40aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 56ed110601ab207d143ea7438f81ef5eb4088e76ad23f5a393de36463603e178
MD5 055e423aa90a805b1439691a5331f494
BLAKE2b-256 d4768b8d20a69bcb5f05a8a51eca1173ebd25afa5cb70fba9f7b9ee8846838bb

See more details on using hashes here.

File details

Details for the file zenroom-3.7.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.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 a4ae6be88aa2056ab59c0f5f84da6f569d132db54bb0d78d75571b45d35386e2
MD5 53f0c6ec62676008e4f2990f0b1bce8f
BLAKE2b-256 3e33dac520b2d467913a87d01753588c679a7b1f1a589f97250f4e0076422275

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 4366bfdd8766d50f3edb5de55a0e410cf40deda08ce2a0d04b29b69e8c67660f
MD5 95544a9e51dc30db9c20c3cb1a51fb68
BLAKE2b-256 46d3a042fde8a328c262c255549fd15a9de27e7595e3e3e04b98b3994a1bc8e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e276594a1daeae424343cb3fefca33acc1e8abb87592b0d6cb09fb815824fb62
MD5 8bb6c5af1372a5c379bf604ff774af10
BLAKE2b-256 2a87c064b8ab3dac669f87a602c9b048b253a10c6a59c9c541886ce28f6f9779

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5d5aa6b34dcca601c5a05a7c5a015eb56fb6262adaff4e9a5135b6dc32f22156
MD5 5de35ffa83b82339fb76ec6755a30ee2
BLAKE2b-256 676a142336f2ae29c696f6d0a70979038e658b1503f938156a1ffc89034e471e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 e8731decd4bd1d5a1b51b1835c57909cb461ea559db8fce4d0404ff03cc2a3a7
MD5 1dcfc4c19dc714dfc2b3c8c7bdced704
BLAKE2b-256 c487482b0bd059146202969be68d9c497873ca435db2d8d02258c97335c380c2

See more details on using hashes here.

File details

Details for the file zenroom-3.7.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.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e6ccbd8c360d1e29fe122e6f8571edf572ba31caa4c8c6fd926278a79e6f3014
MD5 aafb6fcfe2a87e22ddc92893958cc28b
BLAKE2b-256 cc574706f12fdb6bd491c3a4a998914eb6496e3ba085ec5bbeb65920fbb0e003

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 12e49f575e7293c87f83a92ba19bfefb9ef4c51abd7df25de263c7dd6eec48a3
MD5 b43a06886794d267593f0760105d691b
BLAKE2b-256 4c5b5dbc3fcb8d9c4f9a34d09a227a6559284eb67c420d210d2842fc4cce2b6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 aff338f653db2c3df1e76f583e2bcbfe253103f38c69f310692ea0df86f5c70a
MD5 8cc96356609b19e35edc86f89066797d
BLAKE2b-256 8aa642795ede5aff9ce2e353b2948c0d9960ed307b4e312590e54a51c2582e5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1ad58a6775923e8b6f5af9f21bb58660152e49e58bf3c4e8b121b01babbb76bc
MD5 2b3b1766a15cf1b4c197c7528e813319
BLAKE2b-256 7eb72904468c32bcfdb78ad32a12876e72b576920c696ebd86cc5e123f46ae9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.7.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 5d3308b05f8e95b5e6a7a4be00a76b24ea05a8a8e7b76c948bd4f3b080aaa16b
MD5 2fb0ea25b9ecdb82c9813f7aaa252de2
BLAKE2b-256 a79f97e8a213a079b6d4ad21859c297c1bf165f86210b261dcc7814de694c3f8

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