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.1

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

Uploaded Source

Built Distributions

zenroom-2.6.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.2 kB view details)

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

zenroom-2.6.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.7 kB view details)

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

zenroom-2.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.2 kB view details)

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

zenroom-2.6.1-cp311-cp311-macosx_10_9_x86_64.whl (777.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.6.1-cp311-cp311-linux_armv7l.whl (875.9 kB view details)

Uploaded CPython 3.11

zenroom-2.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.2 kB view details)

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

zenroom-2.6.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.7 kB view details)

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

zenroom-2.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.2 kB view details)

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

zenroom-2.6.1-cp310-cp310-macosx_10_9_x86_64.whl (777.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.6.1-cp310-cp310-linux_armv7l.whl (875.9 kB view details)

Uploaded CPython 3.10

zenroom-2.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.2 kB view details)

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

zenroom-2.6.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.7 kB view details)

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

zenroom-2.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.2 kB view details)

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

zenroom-2.6.1-cp39-cp39-macosx_10_9_x86_64.whl (777.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.6.1-cp39-cp39-linux_armv7l.whl (875.9 kB view details)

Uploaded CPython 3.9

zenroom-2.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.2 kB view details)

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

zenroom-2.6.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.7 kB view details)

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

zenroom-2.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (859.2 kB view details)

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

zenroom-2.6.1-cp38-cp38-macosx_10_9_x86_64.whl (777.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.6.1-cp38-cp38-linux_armv7l.whl (875.5 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.6.1.tar.gz
Algorithm Hash digest
SHA256 6d34840f202fb4c6d7e3b43bef1c83ef5da06cf764bfc5ed59f9aad114415100
MD5 47135ed81414f9f7ad4b0826ffdd29b3
BLAKE2b-256 236cb8e0db857f8e901c5f8bbfb51f42db40dd9817a7baf192f28d477422b20c

See more details on using hashes here.

File details

Details for the file zenroom-2.6.1-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.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 332735a9164cd471d9dfd7e155437d9a480dd7820d253fc708d8d165301202d6
MD5 f2007b2b8afbd2471dd76eec38361092
BLAKE2b-256 079f6144c475818d6b1acc917c9730637799bc9474a888148edf55b00ec86e55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2374b556749484f2e3a2f49c92a6d5363a2787aa3fd05aef6ae63304338916a4
MD5 5ecae003f6a184c8ca902ad628dc352f
BLAKE2b-256 febf1277417abdc5a6b9231e2945e10f76e983e0b5ee3bc6d6b0aaf7504e406b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 632ca1813f118b809a6eb4817d0a8d65968518399c4273c73394c5c46e03597c
MD5 ba9350418c8ebec38289fa46badcc5d0
BLAKE2b-256 9339e707ee157179e08f0491969ec2ec2115a1efce6813002651959a22ed6af6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5b9fbce1325ecf37f94520f8be0de7fa3eb078d2b35fd5ccccbaa9927a75315b
MD5 9153ca72418dd2ac86455be2c4e8709c
BLAKE2b-256 36c59b71cb5248e2ae0da6b9b9d4143a78dc6d17a474d4ced4de6d69c62b1d41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 d01ce95b67c8319c2cc9d96e16e087115ab0c95c84bcc083e9c7639d2b08d65d
MD5 4b639913c99135478bd18a68363ae59d
BLAKE2b-256 fb279c330853ee5dc939669b0942c10aa62252c9df93a94eca5da1da76031f83

See more details on using hashes here.

File details

Details for the file zenroom-2.6.1-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.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 75b354e53a98c6fdeb9c840138d1b4a88f7a742b321f8eabc9bf95a6795c209d
MD5 b22e23a0283f4da9ad9b7e2b751b3166
BLAKE2b-256 eecd060930fbd34ca05431b83913c194f4b966190b5ffd5bf0baf5297c133d44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 089042eb4f7efbb2258915c1c00dee05710335d9b62f1697bc84a65c4e8ec3a3
MD5 8f9e6c7142e6c01fc3e921d68fde20f6
BLAKE2b-256 930bdc6255df10f9efe48a1e470eb85a45042df0b3547fafec5c8c0c23556531

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 4b62aaed377002ec5ee93ca19a226a4577a520c980b7fd80aeebc018038fa204
MD5 0262cd875625d14a6dda9b1368dbe28d
BLAKE2b-256 68cb9acce474b46a7b938979e6343d731faf5f27897dd73bec5e6399a2592694

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9daa18abf7771bef0b79fd07a62e4b33d0f5cda3149c69dc41d80809104d60c5
MD5 ecc3aa606b210523ccb592b5d8d2b06d
BLAKE2b-256 162f6a1511d86617ec900f4df415b59cf885bff4c3f9370e2556dfb9948e3e02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 3b3acae99547bef181b63f9a7d341d13c68f6df8179345436dff229d7c2568bf
MD5 d4ccae88bdc1d6b17bc01cb0a8384c55
BLAKE2b-256 6ca48679cdce47ea87f9716664a15a6c1e9fd661aaae8bd56dbaa4067b93b845

See more details on using hashes here.

File details

Details for the file zenroom-2.6.1-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.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7c52b5da9d684bb399c36f2e5e152f69452c453aed543cf425226e9d6dcedcab
MD5 1d239e4e5b52efcc9b3e4de72d65c27d
BLAKE2b-256 10736d072e00dbb4c0990e0694d19b76ca9f64b60c40c8d23a2bc7c118360e69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 532fc68f21358df06000e07e402d026fb2891ed1d701ad8f085838449a6cbc92
MD5 e195c9fd199f43ed37779ae5ab9f4b5f
BLAKE2b-256 463696bf3880de5e016c41eca1d130d0839ce5d50f2421a07d8aafe94c9b33c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 ed0575d45967be2cfaf1d515d8556972f7f5439604f8452b37ae6eea2a4a22da
MD5 82ccbdbab08332968a63d3eb99f92fd8
BLAKE2b-256 79f507ab73e63d88c3e6ebfd1d17f961ff7b34a47d37e4b6665b11e17662b672

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 69df21fb184c0ddcd04df7dc5c40d14fb14b0791824f6ad4ae8214657f49207c
MD5 d94c9f78b0608d210daaa0f48f94ae47
BLAKE2b-256 c0ca79d28326cdae6bdc12711b580cc80425b19016b05306ee056ad5b2cf17cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 7ba18b0672b8a25abd40482f8d32833a2497c47c8177c30f475c489984703668
MD5 b771f3196acb59b9c0a505bea07107fd
BLAKE2b-256 8ba7502feb3538ae818171400ceb36347a9ca276e1cc0caf532f111e22ed1bf2

See more details on using hashes here.

File details

Details for the file zenroom-2.6.1-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.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2754494138371c5bde34962c410b8bac12702282cbff0221a465804e40f93a19
MD5 1e8fd5b058c6632a52bef9d95aeba8cd
BLAKE2b-256 bc587512da30566b651061314429107f3305a3fcc48550e920e8a1f5e9503d51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 3878b2278ce78db060f053cff23a42803d3ca00b4943405a8a785aa6ba8a6eff
MD5 18fbca806ba81f2d0fc42c055794858e
BLAKE2b-256 70e97322d4dc63300d4d07df52be31b60d3c0f2ed7ddef43f8257a51fdc7f0de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 7ccc64d4428cd48f93a1d85904f56d59dccbacf3cb301b0db2b664594b99b7f6
MD5 a8898311006f8943f6153f1e8eed919f
BLAKE2b-256 8631eae1f38ee0d51dc33cb245014932ad1a9b96785c80f00e76ae310b84c60e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5da5bb74eaacd1e670846b4517fb963560e969278c07a7483120f056855a04c1
MD5 97da3e1768ac62a219ff26aaecd6815d
BLAKE2b-256 f12d5fdec5ee56afac13274b73cfdf2e48ebc9553c2a45ee854b1ff4d1f8ac82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.6.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 05bf77d0695af74e0fee6bd69ef1515ee0d16c02067626e2803d53185d8707ed
MD5 bc84d2f80bc2e8863fadf918c7c75d9d
BLAKE2b-256 1baa2f1b9880e0e93971cb013e89239ff686d34f228e08e65489213e9666cb7c

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