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

This version

2.6.0

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

Uploaded Source

Built Distributions

zenroom-2.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (914.5 kB view details)

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

zenroom-2.6.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.0 kB view details)

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

zenroom-2.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (858.4 kB view details)

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

zenroom-2.6.0-cp311-cp311-macosx_10_9_x86_64.whl (777.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.6.0-cp311-cp311-linux_armv7l.whl (875.2 kB view details)

Uploaded CPython 3.11

zenroom-2.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (914.5 kB view details)

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

zenroom-2.6.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.0 kB view details)

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

zenroom-2.6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (858.4 kB view details)

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

zenroom-2.6.0-cp310-cp310-macosx_10_9_x86_64.whl (777.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.6.0-cp310-cp310-linux_armv7l.whl (875.2 kB view details)

Uploaded CPython 3.10

zenroom-2.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (914.5 kB view details)

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

zenroom-2.6.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.0 kB view details)

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

zenroom-2.6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (858.4 kB view details)

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

zenroom-2.6.0-cp39-cp39-macosx_10_9_x86_64.whl (777.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.6.0-cp39-cp39-linux_armv7l.whl (875.2 kB view details)

Uploaded CPython 3.9

zenroom-2.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (914.5 kB view details)

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

zenroom-2.6.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.0 kB view details)

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

zenroom-2.6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (858.4 kB view details)

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

zenroom-2.6.0-cp38-cp38-macosx_10_9_x86_64.whl (777.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.6.0-cp38-cp38-linux_armv7l.whl (874.9 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.6.0.tar.gz
Algorithm Hash digest
SHA256 793537fa05b6a0b6ad489e060c913792935347228488a318d74a315c8147fd97
MD5 dc3e1382f5d8562eceac587a1cc39bc5
BLAKE2b-256 312e50985189ff35ed31167eb1573bd7d8e6ef6f87dd172208b92ae7f9f70b11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9475ceaa8d259d84cff5026bb29ca33aebe216644319e7a200f32655b97dd0d7
MD5 218f560381cd3ed3f9f35fcf0900709d
BLAKE2b-256 9638087152732ac52869ecdf717f8b3550ce50265355d481a1c749c6e7528525

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 36dd310fcd8175417ed34230f2b38b9069f02ffc2bf3a30760e5c9c519303e03
MD5 4097e7f90e397cfe2ae43a34d1042e3c
BLAKE2b-256 cdbf4c0f45724f43bc7470cebaa4f3be946ad9d8cb08e6bd5f8c2fe0a66ae9dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 65c271c891883f780042e92aab4502a97ed89069d8f51e8984ef93349c0d4428
MD5 4334ad8721a8fd21a12e3f65d429319d
BLAKE2b-256 1d7ac8f81f1c249ce207a75f227c660ad729f1a7e8ec157517db39cc868b50f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 58a7852f2a5039d40539b53ad84acf637c7ff4a7212f9eaf7bfcfe3a2abbdb8c
MD5 0009a7727be926f6a6531e798dd5f6e5
BLAKE2b-256 d7cb63627c5c392f817ce402c86bdc8ed09f0aefc6ac46caf73de67df3e9c95a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 49d52dd26a247f800f29188f794024ee8511c68b7f6c908b8a1bb44e5520cc7b
MD5 9ca8768d09745579f6aeff630ffe9ed0
BLAKE2b-256 52e6db9fd9666e7c29f1495539791fc7bb6ab9b4cbcb505b81e53099fe83660f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9350ba14bea76602cde2df243e786bc6e9a5c8416beca610b05850eaacdb49fd
MD5 aea50c75ad74540255f76c6395810a82
BLAKE2b-256 cba98ba7c8b54a39b913483ddf75bf3cb6729f07d12fb9f41a521789536f2002

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 983ecc0185d39e96b09c87f3fadc72144f42a5b72cb44ecac804be9125a255e4
MD5 f76c1d6eaae943e348a2d0de94653b11
BLAKE2b-256 142c0f4f4012cf6f5d5f7557ceb4d48f1c52210c76baa064af9d1ad55a6cbc92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 2086afd5ec3dfe3753eb53ba0ec6262e288fd713f21ca15e20698a3c9ae33317
MD5 dc1fcc8b43251549e22a6f6703d4be8a
BLAKE2b-256 50b1c64cbb9e98a1bfbb58cf397705184ac182b011ba22a4eac9521bc5686b60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fd6fa3face4fb127ba4a3ecf9261a8fff7764ffa1e1d6393cda3ba1c452c1765
MD5 95ebcb29240e10fc7b98da05fc8702a2
BLAKE2b-256 2601e4821a9f371b6e83811a26e357d51863afd34a94ece89af45b8c364100db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 435d772e6e128d2cb72e9fda24a4025ad71dab88c89294aa566ae68c4ce77561
MD5 0eb3ec51db990d4bc95e1fe6f156bc89
BLAKE2b-256 311025e641595ae342d0a1519d371745345bbc1b026e694ed4ad790ed163a0e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 93eb1fef52c2ca658b91ac83ddfb5002cc1070fc54f967d067b4dde9458f83fa
MD5 f7adcc9c3d17081eb20718b4f9f4ea74
BLAKE2b-256 9db80c01ef4c40546606e3d30fd68127b77286cea202cc19b958b1048474e7f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3b3892eb291c94dcb6c40c9e2edb66d68412c0c62255f32a3e502c6a9bb6c0da
MD5 f5d0402ef1a54c963d5023fef1ef595b
BLAKE2b-256 dffb98512a5e2257730fefc252225e2b4e78f650837677745b79e751da19ab1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 37fc3f32782a112ba4c4293eb9fc92bcf5ad5da58f055fef451cf69476666dfc
MD5 c278d09b10a8703dfde2724bcb5dd877
BLAKE2b-256 d3a7a593e2f64c737b844d3f0424101a494d8c106b6a041752dd08eabd3cef78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d5e01aecb701d2290a356cac2571d96eece66fb1a4465cd7261884b1085b1174
MD5 705dd89bcad3cd9d8415197374b17bea
BLAKE2b-256 3773e0b416907af0825b30fc36a1740ec28103e8de21301dad1b469053b388a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 9af17713d5e943def21c34f60540d83e0a32b4461069421dbefa5fbd8d2451c6
MD5 dc7d7bc8833334ef756f4e61ff1fead6
BLAKE2b-256 dbec4a0f22fb327d94b8bdbb90ac714795d5b7b2474f4abfb1644769225f03c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 20a4edc4534ce2496c90fbaaecb664c85089c5b4ac7b84199f055cc1986c1370
MD5 4a36b458c87695f3f7ac90b972689243
BLAKE2b-256 aaf18ccf0740cb4d7990c466fc60df028059a9bb7e949bd40709fbdebb524d26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 1dd696ca9ee7764ef1edb7f179dd146d32570a9ffeacd989d32041ba098fc66f
MD5 4684d450d53efeb06f7d5187791e4acf
BLAKE2b-256 71a50595cdc627d0571ba5990278c4cde4fc2f5337dc68c20a2141942e1b59ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 b43bcfb686a4908bcce2e71437d388f78713cd98a339d4b3f6139e350d1e6ab8
MD5 dea9585f63027e240f7a8bcb63d3dbe2
BLAKE2b-256 96f8489f14caab222c9c2785fe96484b3144964b4cc42299fb9bfbff4c924787

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f2b0a8f9a90cb727fad9d01093d97dc8ace09fe8ad613ae772c7060c56238201
MD5 a4c9a32f6ada35ace0bcb56d0268e756
BLAKE2b-256 7217665d1be17a574800d0f3465c0f0e913f36956ac216352ae66988076e9202

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 9dc4fd3fdf7d51b244a20aa26399cf49e58285fc8a9aaa02c0b979c44f2406e0
MD5 0878862c5c85604ea7fb1fbade3d7e3a
BLAKE2b-256 893a3204cf873cee9034b5074c9454b103b1e99fe3c5f027ccb56653eba317f8

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