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

Uploaded Source

Built Distributions

zenroom-3.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.9 kB view details)

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

zenroom-3.10.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (797.0 kB view details)

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

zenroom-3.10.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.4 kB view details)

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

zenroom-3.10.1-cp311-cp311-macosx_10_9_x86_64.whl (654.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.10.1-cp311-cp311-linux_armv7l.whl (776.9 kB view details)

Uploaded CPython 3.11

zenroom-3.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.9 kB view details)

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

zenroom-3.10.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (797.0 kB view details)

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

zenroom-3.10.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.4 kB view details)

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

zenroom-3.10.1-cp310-cp310-macosx_10_9_x86_64.whl (654.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.10.1-cp310-cp310-linux_armv7l.whl (776.9 kB view details)

Uploaded CPython 3.10

zenroom-3.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.9 kB view details)

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

zenroom-3.10.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (797.0 kB view details)

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

zenroom-3.10.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.4 kB view details)

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

zenroom-3.10.1-cp39-cp39-macosx_10_9_x86_64.whl (654.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.10.1-cp39-cp39-linux_armv7l.whl (776.9 kB view details)

Uploaded CPython 3.9

zenroom-3.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.9 kB view details)

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

zenroom-3.10.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (797.0 kB view details)

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

zenroom-3.10.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.4 kB view details)

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

zenroom-3.10.1-cp38-cp38-macosx_10_9_x86_64.whl (654.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.10.1-cp38-cp38-linux_armv7l.whl (776.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.10.1.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.10.1.tar.gz
Algorithm Hash digest
SHA256 c85573aaa0cd9ae886f50c6499e6f50957eb0adaefe1c105cd67889b8ff37fcd
MD5 a78ffe207c4bca6cd7426c2ca6fe0e45
BLAKE2b-256 881f2a4cbe1f7c1614ac679e28d42484f85e753e3aaafce4145525ca8dc9ce4b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 ed95ca1d7e6e884380d15e25fcfc263f22c436f28b437637cf6de25a922fc497
MD5 f912628afa598cf242320f6ca8c5fdde
BLAKE2b-256 462921b5c2a53a7097448136467af932dd455c96167974b4f697e1f250ac28bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 485e52deea17a7d47fb455c1883383775ba5fb1b73e57dc221b369cccc998d6e
MD5 d20530ae2d6ca5ee8ebd59205de17a5f
BLAKE2b-256 7ee5401b41e10740275078a645a7d530981f8d6a2481f5e348c77b53da9df72e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c12339a1b71bad1490fe0c61eea8f85a1c9e3bb522e7442f42c38d3caf23fafd
MD5 aead712d18fdf1886f65ea0df68e269b
BLAKE2b-256 57f3789d5e3c3fc0816bc65ab15f184504d8b2d9bb631c4549876813130fb14c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0afc29cdb94672dea21b58905cac1cfb259b396d8d8a04280baa4703b97c7d01
MD5 f26bfa750090dcad580c5e0c56936354
BLAKE2b-256 bc2e6862f6510c0cffb8d5eb86bd2bef88306924a5999529633c5a0d7e142a8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 1601b6b245cf36e294156d46ddce77210f2a3b255c09303d409426740ffe5435
MD5 fdc9b50a6352ea887872c7b8c40b27b2
BLAKE2b-256 d8f623e0809372de60f5995fcd8a6717853a4a1a9b2f9a6377c604c112c665dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f20a583d8dd36ec799833f37fc141d7f323b706927074610f5cc6ef22f4c89ee
MD5 9cd3fc764259d3f5350d5e2b5bdbc4fb
BLAKE2b-256 a09d0cca29d8742c14b7263bc0cac4485454a78eb02d32eb05406f0442898b47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 54207d51459a9ff977bb3e98cd5b286f6dc8a38803969d5b9090c3c301ebc11f
MD5 c456a35b3bc918966ac9d32a9feb0997
BLAKE2b-256 8a5c047446cd98c993d9b4398a8bfe3e13cbd1c6fa28c04d2e61d5a79dfc0764

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 6f0ca30aecc4ea220e2bfb308c0c0bb6ce088bd470708f808ee737c80e8c6b83
MD5 8ed8be093d404b944dc75ffcb66dcfba
BLAKE2b-256 73363798e3ca4547420b061a0b12c282ab4e5b26f30017428ac6c4176494d588

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 39ff70c5ee15f2ab9d6c1fc11167c871d9d201a3583a56ccc0944e2b2ab5c53b
MD5 6846a634628c78e9c327fc4f4f70aaf6
BLAKE2b-256 faa81ea570e0bb5b5816dd886f341b08070965f328c11d04f6bdaf889020216b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 4f144dbd981e8f7566bef8af2df381a4c25d38e81449e5f3069e86cb9d24747e
MD5 bb8f982787f17e06bfb15929bf4962b7
BLAKE2b-256 8dd89812e6947df63aacfaef24e9aedce3b68e5c07a7aeebeb8af5e63fb2e33b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e5b4f9b906a38df4d85a8040cff1d8717a8c9b208d344b1cf97a45522af1d141
MD5 43920e549a2482fb48cdd7cc32cc98cb
BLAKE2b-256 d4cee96e7904f7f160972eac6e671c3a84933fc846d98af9b5bfb8c96c465c2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c69a09d8a6a1eeba44491460c06d65f3f223c8f43083ccf840c7d1aa2cc656a6
MD5 c12893e46e5a63d4489a7aa50e758034
BLAKE2b-256 a54b98659659a9ae5c37ba4d49544500c86370b94c2d670f88260f6c3b991191

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 aba266f02ade755f1f5b7740876e463a065c817022821a6159de1be9a55e64b0
MD5 75b1753e6d4f8edfa9983d87f6f10c8b
BLAKE2b-256 d8fac74472c746938b147d53b0f197e7d999a99b23a2a9c2b13d7eb81cda5d05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 18b8f0a100227ccf556a6ee4ff2156d933445d3c4f1b222949c069e8291052fa
MD5 006002199689d34de59eaf5747dca5ee
BLAKE2b-256 a43326cbfc5d2b87671eeaeed7b5e5cc7cba0ba98e39c4cc7680ab501b38485d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 7fc5d1ed3d5c49b552651a522e137ab9f006402c388a5b91bf99788c6a3cb83f
MD5 feeb329588ab263a4cd51c41f6f86764
BLAKE2b-256 11c009320ad078b479bc6f1b4a94d98ba3dd93c71ff40dca6ebe81c36ba438ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 970c885b55bd0cefd13228caa7edde6a14663a9ed45b92c93c0bb51f29d4160a
MD5 83b036672305b663847fe52ed53762ac
BLAKE2b-256 7d647b5ef77a246455fdcb6baae45239ea5dc6d949e968d5a12fb0e529d15702

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 bb32f12bd4b72efffeccd6f48af835cd2c902c232441692b4fc154a3e467ac8c
MD5 c39baa56b0d2532d920425a6b2681cf8
BLAKE2b-256 424d7ff5a510e4831e3e8ec59365d7424de5aa55d7e993f4e0b920941f57f467

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 981e1e21eb40386ee9be724479e1aca8a09dd8b099279e8f50f0a8067b602647
MD5 62efaf16671a8738262b983b91c37871
BLAKE2b-256 8133e3ffd831341a47d1944d88b85cf4bdf5a6d5ee40be069097af2d77326f8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0ea0a2ec1a154d544b7b1b6c6b90611681668d6bb9cc770f492c22576fa00f17
MD5 92d11ccdf62825c0500b8a0b75f3730b
BLAKE2b-256 0dba104a6b8a55dd918fe5dd6fafe7b5ceea132b6608ff675dd248a49c02cd7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 ed24b13e525c36bcc3d96cc94bcb8e98ddf1a1b170da4ccfb8ddeaa9c25d448a
MD5 36f96b0fc916fa354a5a1aa017f21f03
BLAKE2b-256 e17df15042e4a92db519294d3458b7a5da17b5a2bc17fb2fa5312205e8719e99

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