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

Uploaded Source

Built Distributions

zenroom-3.10.0-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.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.9 kB view details)

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

zenroom-3.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.1 kB view details)

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

zenroom-3.10.0-cp311-cp311-macosx_10_9_x86_64.whl (654.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.11

zenroom-3.10.0-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.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.9 kB view details)

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

zenroom-3.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.1 kB view details)

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

zenroom-3.10.0-cp310-cp310-macosx_10_9_x86_64.whl (654.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.10

zenroom-3.10.0-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.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.9 kB view details)

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

zenroom-3.10.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.1 kB view details)

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

zenroom-3.10.0-cp39-cp39-macosx_10_9_x86_64.whl (654.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.9

zenroom-3.10.0-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.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.9 kB view details)

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

zenroom-3.10.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.1 kB view details)

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

zenroom-3.10.0-cp38-cp38-macosx_10_9_x86_64.whl (654.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.10.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.10.0.tar.gz
Algorithm Hash digest
SHA256 921d4609ec87554de59a95a5f7b5cba19ccce8a5b5ff08bcdc4fd5e884738c26
MD5 38b9cb714dfd1301126783ba1392b930
BLAKE2b-256 c4c203f226aa614050927053af71520e238875e034451edc647f225cace6597c

See more details on using hashes here.

File details

Details for the file zenroom-3.10.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.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 bac6c36bc11045433953dff4250a0d0c1cc28e76c640c22135d3ceaced1e3740
MD5 239e473b352cae803bc4a3512184e389
BLAKE2b-256 6d16af86ae87e163f0f1b744db503eda4b8d7165108c8358956f27b907431150

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 4b6a30ede00d5e7ad2f0195f022fb19fc516e502ab2b0ae55e17d5b32af6c7c0
MD5 cf28c8c3179c726e09b0a3bb3f013ccc
BLAKE2b-256 e8191b74556ec28d09225f5ac301a91e45d17c9cac8fb71afe1ea5cde4412fb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 5c784f4551cd2ca6dc16812937b5e7af64b730dd4e66025b79dc1d853436c3f1
MD5 665bf7f42f21f37d75e708f804ec7938
BLAKE2b-256 4af176672da6057b91e4a35de73d533b6ae7574826de3e8814b01f85e149a280

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d9b30ca2e0558ab9f737258bd33d4e4d483ebf2f8aff37771f72ba3b6570755f
MD5 c13f3c1186007f510c26dbb9d225e562
BLAKE2b-256 84425a9f0e031eea8be8c5bf79a427f789a0281b66f019737da964776b797fff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 b6b4f256b0e43200e1df2d2298e8d31d17c54a5710729e5ec34bbdad6d9ac606
MD5 d554098985f761f14778ff043b8c433d
BLAKE2b-256 abea01d2ce359c9024885bcc19fd6be00f466d69a663382ed4e0c09faf92bd9f

See more details on using hashes here.

File details

Details for the file zenroom-3.10.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.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 ab94350b9712f68027ac7f2b3a4fdb82d949e42390ecbbe6c5b4c7086850d864
MD5 a1f731abce969f054e7d75a2ff8b1a50
BLAKE2b-256 d4a74c9f9cf39909263339a9777c36fbc794f254104c5c054ce94ab2742d08a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 7660398c3de01baf586ff02fe0ac200d80886d95c5ed9690322a51ff956ccf77
MD5 a0d3de7fa2fd0afa84647d153fc56c82
BLAKE2b-256 af9e4e4d804dcd5391f23fc612b9d2f19723c3739f4a5bcf65786ab23a4b8ae2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 98d092660b747f2b6e099dc4a18fc6cebcabbd481b949769f6103062357ce53f
MD5 96c7f792d9d57ff4bc9d485702d85763
BLAKE2b-256 b5474bae092bdfc1180df583f779f6dca1b1de69d42dc2da7aff9a977c6c7e06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 27b7e19f4261473245136ce5bc0f7e9941b2c42b3b946b8dba5786eb5cb1ea33
MD5 a9110f44c7fbacfeaf20c7be721ebf63
BLAKE2b-256 7388a4580f5fc57db50ceabc301e3af438133c81be1c2dfb2534af469f53b0b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 6fc7629f75130c30a9cbb051ea385ccb3c1e2c926b38a19db2698102b49bf053
MD5 0ceb4c330e2dd2ca3884dd42bf45887a
BLAKE2b-256 9ac80c66ebf6215bd2c9fbf9b11ce498b886122d146e8ceda97fa5496634ca29

See more details on using hashes here.

File details

Details for the file zenroom-3.10.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.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 829e13cd5674f07883c47f4d791597ad800fa3f32b5d1a14839d68733d3fd4fc
MD5 ffff0f541a863c57b77e5c31b2a5cd95
BLAKE2b-256 eec2ccbdd766e12d588ca5f05170bf6282ef9f90e40ddfde12f08462cfc800d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 59574102ee97fa4126a0d105724996aa4aea22c05e9fbc886a7f71af830532cd
MD5 c5aa448805cfd54e1f46af672be6f35c
BLAKE2b-256 933ac08fae356d631882cbcf60976e21981f8a409acbddce7dc9b219612ca2e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8454fbfad94d260ff7c39dd43494f88980a98191038bc9bdd926dfa8b27bdec2
MD5 8d32484c6a3f73bda5739769c2a7f939
BLAKE2b-256 82931b5baef2140b910ff7a29089e94ab008054fabf120dd43ecab61c0516607

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cfda762c108fe556a6547dc8136cb0a3956da2ead674d3c57b1e43367b75cd1e
MD5 23f881e510e500813e27499efbcfb79f
BLAKE2b-256 4a67de5cc6508334fe38d4a8c028bb11e5ba066acc9b631e391fc6d844fbb619

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 bbb5ed5f80ab652cf58563325a693f7ddccfac72902cc99db3cd532c52aa2f74
MD5 90df75e287f011d8aa8def10b1fe96c9
BLAKE2b-256 4037ff7961e17d2b2051347caa1cb5aa7f896d8ceb335807dd2c4370e4793f13

See more details on using hashes here.

File details

Details for the file zenroom-3.10.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.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 fc1c9682bef9352b5c67dfd3c36b66e52d35b26e58e500a575ebe988371f39fc
MD5 5095cdb7af51740f7e633815c985c9df
BLAKE2b-256 7c13650dfc82f486bbf0d75994f17e1874e961bb72ba462b9b476eb412329561

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 8c520a5a7b5f6dca72de40bd251e6d0bccbddf592eceb4718aabca24dcebaad0
MD5 9f367481b39ecb9314c2f6cece5c6093
BLAKE2b-256 05838b33110c4e16d0aba7d6670c019075bf5fd4ac1739783a4f16e6df169678

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c7e164d02a23edd74b94736d7ce0d6e45b686252228126aef93eebaf3b054776
MD5 d60c4b39e80479978b2b514b41343b24
BLAKE2b-256 65a24d26727fb18ed53a13d6477f80d5141b845db56ad4ea6a795e639e3ea253

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2cd7190e61629036fad81b70c97e96f89f9fd9b9daebef6d641ef02979ad5486
MD5 3f7cd58fa29e2681271c7bb49822bffe
BLAKE2b-256 1433ae5a4325ae24f3fc3e76f0276fe205dc500be031e422055366094c806f99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.10.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 2c6605a869e29f6cd3fe6f26d7e0a206a77aa88ee08ae419eb00fbb5b6ab104f
MD5 aa7e25f6503fde7edf789b38b428e36b
BLAKE2b-256 6cd1c54f38cfcec08080985bf79a0426b271d69d840a33a59438537ebf918c4d

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