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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

zenroom-2.16.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.3 kB view details)

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

zenroom-2.16.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.4 kB view details)

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

zenroom-2.16.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.0 kB view details)

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

zenroom-2.16.2-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.2-cp311-cp311-linux_armv7l.whl (876.5 kB view details)

Uploaded CPython 3.11

zenroom-2.16.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.3 kB view details)

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

zenroom-2.16.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.4 kB view details)

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

zenroom-2.16.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.0 kB view details)

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

zenroom-2.16.2-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.2-cp310-cp310-linux_armv7l.whl (876.5 kB view details)

Uploaded CPython 3.10

zenroom-2.16.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.3 kB view details)

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

zenroom-2.16.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.4 kB view details)

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

zenroom-2.16.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.0 kB view details)

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

zenroom-2.16.2-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.2-cp39-cp39-linux_armv7l.whl (876.5 kB view details)

Uploaded CPython 3.9

zenroom-2.16.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.3 kB view details)

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

zenroom-2.16.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.4 kB view details)

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

zenroom-2.16.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.0 kB view details)

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

zenroom-2.16.2-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.2-cp38-cp38-linux_armv7l.whl (876.1 kB view details)

Uploaded CPython 3.8

File details

Details for the file zenroom-2.16.2-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.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 6e8f940dda86758f5cb44d9425a7363c6865caf8f56eb532788b52be18002b20
MD5 859e419c45f56623744cd026896e4dd6
BLAKE2b-256 843f09feb85782d8fdba4d8676689788ed833a35632c5251dc5830c34329ccc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 1db9e883a8941de40c5a82ea2edf3e06e0ac63c3589257ea6d44c9d7ff8406b4
MD5 85443bc5884c4010e98262fd71f1d119
BLAKE2b-256 651dce9413ad3de53a19216f19b6a85d2f73f5767f88fa60f97a2b3e5f2ba3c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 ca1d40925eb1e03ed059f0a88a1e6baab574e319b97f9771a8f95de49a04b006
MD5 fcfbb6f2cf5329e9bbd5c02a4cbd3869
BLAKE2b-256 130491ec98dec3d6ace5357ccddcab6546f4e549ccdd230461f8fb33b2c5541c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 09298422e146fc5f366654d5cc21b183bbb8eb1c8fc6ee8a31c354b31196b9e0
MD5 2683c77e2caed0a52384acf3edf43721
BLAKE2b-256 24a4ec51126fee20122c06d57e179028b47fb32a7bbd928afa048d308aaa502f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 0367e5ed6db0253c96ed810507042bf0879c5540a266209d3ed77a53edabaecf
MD5 450d5ee24860e783ffa5907198d1097a
BLAKE2b-256 8296a5338cced300b7f75e8f68d4744e581023961ef3d1d3499e2c1996b78397

See more details on using hashes here.

File details

Details for the file zenroom-2.16.2-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.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 28707bb2b39089f62ca245e9543c77eb386bb8ac6670f093009001e8d5fba6b7
MD5 72baf9eeed21af6767afae46668c8c9a
BLAKE2b-256 1068e52b2c360fa2ea20c8ec799a8905964519e70734186124adf5da5b69f931

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2d79c1da8d2224a5e340178f38eb01714050fe20adcc3a7177b477dcab318f20
MD5 8ce953cb4dafafe52b5d7baddfa9460d
BLAKE2b-256 75f81ad64d7a6b1fc1f4375ffbd31e25cacdca065cc16d2a3cab79cec29dd5ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 cb749eb179ce3c0d801efc17d4ac7029fb714b5b64cc036204949ae5c1bdbaa9
MD5 de64adc135144b6d50ae9ffac4791cfc
BLAKE2b-256 8189f2a6eb5ca504983c5c70efaf49961010df40d1d8ff10ce189de9c55595fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f5fe20bbbbae4d47ad7fa7d1b0996fb88cf4f61daaa832370a6e6b7ba46226bc
MD5 0e22810979044ff6f9ab3f34e83eb485
BLAKE2b-256 ac0461bb886e02a9b64c90a6cec51bacabd391e7d081d416a5e24e4a3ad7631b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 3c688d606d301bdab40e22018cd60af7eeb013b189b5d493ad82d6404a97573f
MD5 0f525a111afe2972c3b0e4d4a212d516
BLAKE2b-256 404eb0060eddac73beb493394b9c5dcf1fe29cc7d8f63eecc2fdea49d138c1a7

See more details on using hashes here.

File details

Details for the file zenroom-2.16.2-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.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f6f53dec82b3335699e42a6ff932b2d5df7d5b74e51687247ebf3cb8e06aa6bf
MD5 90e9fc437bd1028ab0a2a789a62dde9a
BLAKE2b-256 aa41de4bfefc95d7bfbd0b0e9b2c7e3505422607b1326b29d0e28b815688755a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c8f35f046dd975e07d19ec20a2d7a4b89aa278486e91b338b2e97fac39e2ec34
MD5 5cff3ed243e08d629446aa5b79989c9d
BLAKE2b-256 d41cd07b3efed02b68fc2d7ab1c3540a85167cd955587495aea15046060289a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 a5c7f8db017a28f518ddab28b4b3981cd4f05fabf0d2f27bd73a18aaa2e12446
MD5 cc5eed91baaab0cfef71200ed35336b6
BLAKE2b-256 6d9cf9a3003de1dcae9aeb35c02e706f7c55a92abaee726cc94371af4c8f0ba2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7103484674de3f15d38a3ee404c30f51f51a986ce6ea2e53882abb960c18e836
MD5 667d408400ac80baa54357a3f9a4c674
BLAKE2b-256 6d61e7f6503acadfb2fb6411a28291cfa72ef547af0cee73eb43175b4ed71f65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 02f2a21d46d2ddf6e8b2883bc6fe068ffcdba38575e9274e7cf49b926a9602dc
MD5 cfbe7b9d2734d876e32de097a5cef7e2
BLAKE2b-256 743e3f66c05a28e76741a929175415d4f74c5edd52aa0ad8690701918bf2c712

See more details on using hashes here.

File details

Details for the file zenroom-2.16.2-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.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e40c14bda880bedc70c3567212dca0aa7e70892928d4624d6dd08deb94d1c625
MD5 13ce34f1727038654ff93535f0945a45
BLAKE2b-256 e429e876d7e4c01b56c12b33e2cfc28fc49ca80db7e300e9ad077a22612037db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 73f5bc7b154c49d928416be3ebb7a2e5b39562f2214416822633cb8285140533
MD5 2d42402570c6f2d4a3531fc7086eaf28
BLAKE2b-256 a74bd0342f1b001ec7ac6b90997fddfd4e0eb8aa9f4d1813197164c2fd9e4894

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 dd9785a11cca59068dab94f25497a4ab7563927c7e09cd592f9b3753e722d7bf
MD5 bdf18bf1e544539855be809d0e35f8f9
BLAKE2b-256 a403688db7f82cf9a9ea8d68add37d80f2b4a74e326445abf827403d31163337

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 67c9960de91906a5ae5fd37c54a0957058284abc4e70d69e94e66f4a1ee2d193
MD5 3c384dde1c1061a2ea19fb50c6dc881a
BLAKE2b-256 a2ad744fda2bf2372a8668421c081b2dea7da75943c7133d39ea96c1ce530c2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.2-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 96ec7f04f351fa54bf4722b3c682564a766011fc36d24f8cb0d19f3511cac2fb
MD5 cc2e11152cde9751814cb5a59bae0d58
BLAKE2b-256 b6c10497ddc3f463126b268a223732f207db2cbb3c9bc98ec413bce98a2ca629

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