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

Uploaded Source

Built Distributions

zenroom-3.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.8 kB view details)

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

zenroom-3.11.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.0-cp311-cp311-macosx_10_9_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.11.0-cp311-cp311-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.11

zenroom-3.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.8 kB view details)

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

zenroom-3.11.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.0-cp310-cp310-macosx_10_9_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.11.0-cp310-cp310-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.10

zenroom-3.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.8 kB view details)

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

zenroom-3.11.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.0-cp39-cp39-macosx_10_9_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.11.0-cp39-cp39-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.9

zenroom-3.11.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.8 kB view details)

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

zenroom-3.11.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.0-cp38-cp38-macosx_10_9_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.11.0-cp38-cp38-linux_armv7l.whl (775.9 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.11.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.11.0.tar.gz
Algorithm Hash digest
SHA256 3152ba0aa57c6e0030ace5e185576cfc103c2f297916381b227f11b46fbd2057
MD5 8312cf70d1c2dc1bcae9e7f95c549988
BLAKE2b-256 9f6d5265c4f6659fa22f62d55bf3010f0d6304b3d6f7928205544e612faa3db2

See more details on using hashes here.

File details

Details for the file zenroom-3.11.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.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 599e4938e8157a3494c3fc709acf13827ee3da1298cba5349fde9503ef484db7
MD5 d72f60082ae97bb026277a3ea41954eb
BLAKE2b-256 8b7a5fc1f4c2837f66778273ea314930a5d26a9926a71c75bc6670ab2a5dd973

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9dcf3b7a1160d7e67732cc12674702cd5fbd178153accdc185acb590e27d1c11
MD5 0d62a3612a61ff3ff3007ba0ba9a841f
BLAKE2b-256 68847a8b08481e96ad4ea575a16480bbd3531ce86121bb6ca04ea1c50b1bb6ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d59aa6c8028dac7a3c0b569c1fec7225ce49d4715e6ff7be10c87fad357a08b4
MD5 932c9c0804aa72e82cc467fc716abbee
BLAKE2b-256 c6677ab44fcefa03f29456297f8c6e4ad0c4e9c5eed8630e3e004b67e226d9c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0a1ff9776aa646a60c6207dd7097746eff88e38ba853d77ce55b5644e3a131a8
MD5 a753e090d0fb440d1f4388ed85756b99
BLAKE2b-256 6dafae1f6a874a247dac72b6475af5c85b7498b08a04ceec58a94da0eb7e2d27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 bc644f0cf9145bc125f78db6bd7e030d4b14c37c203800c596ddcf480c10a1be
MD5 ba548db5f13acb942a8c23d508dd2443
BLAKE2b-256 5c69ae170db455eff27a8e1cb4e76674a4e47bee86f1d9a017409dbf9815b732

See more details on using hashes here.

File details

Details for the file zenroom-3.11.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.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 4e890c7457d3e17cb086d002de947a366ec7cc0f18afabedd97df9abe579c1f6
MD5 11112405345ba52325b1e2df984802a0
BLAKE2b-256 2e9c52cfbd9bd813d535c351233a1a6f2e457fcc9c4863cebba48bc8188bd605

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d6ac44b2379e98d775f9d782e854a3a7192c85fd6fe6dbef73a7a6e531e56199
MD5 52f378093b1d5eee4befa3596c5e8932
BLAKE2b-256 baf8daf9a3e0069d32f8bf656859c6a0df28b8e478fbcfef7b2e829620f1767f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 63880615c70c8f13d831198395d8819187e86a3f1be3171027487e20ad80f44f
MD5 32ae76527a8ddd67094bbbeb83edc247
BLAKE2b-256 a0dcb9053036556e28c3697b135a2b5990ee72703997b1cc080f6138c0350bc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e2eb0c896475f703286755b62bdf60ae1d868765aef8e5e116e03a86430d8ee8
MD5 2b2cfcb42d6719eb412b2747645bde2e
BLAKE2b-256 783f256eb676e18b5f4433f40eb77ab7217543b350f28df36f26d7096444677b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 08a603c11256500a6f5ce8e278a9e793709fa49d62b7bc584eace5ef7f536def
MD5 9809cade32fd8ca7f39972ddaffd8f9a
BLAKE2b-256 89379dfd284e85d5d67479ca765a4394d25d4993ae56b093c250628f1cdf86e0

See more details on using hashes here.

File details

Details for the file zenroom-3.11.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.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b49c85ce3b609f496e9879f7e46b6ad248fe4435ca1cec3b80f0d17412a2e08c
MD5 9bbddcad7cb2595110a347e5f9b9444a
BLAKE2b-256 ba7f935e204908de64a26ea37562452670b77ed282cd65ee4d695b374d2f12f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ebb6e3f6e17664263f8ec1796c325d1bcb2241166467b4e104d4c28f43f5377d
MD5 534f65b13c1faac8fcb322c2063f6b32
BLAKE2b-256 60acdedad1d0f2e39cc6191d5f10d07bbd326b1d5b4dad070b3853c3312e267a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d1f9408a8ab0392f948527e0351ff97f337940ba5467c1736e9663024f2c641d
MD5 c29594ae32a1612d5a997ec3e032599d
BLAKE2b-256 0f1089de0a1e8f711348b05b585ba8812cb0e84ff9e01ee589c699ec3dd122ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fd11b624bec058d705a4048ebe6c9fdb7cc97f457235daf7dd4473926857ffb6
MD5 1a91716447794011bba42841c4e1d9a9
BLAKE2b-256 0fb2e85ead15b0fa465d183c302dd3c4ac6001e0d7f229b6c131e40224013902

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 e8405f66f6e1c9ba8251f3950047a13bbedeb745fd64f6f82a80341458763a81
MD5 f51eccca5653538dc37242626b689cf7
BLAKE2b-256 79014a2b6e7ddd446da27c9e1db4c999e1cc6dccd9be0b1fe6d9f2519053138b

See more details on using hashes here.

File details

Details for the file zenroom-3.11.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.11.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2dfe5b37f331da32076e09aa0daec16888d8277e55c2ac31133bd5118bc08b93
MD5 168eefad6c61545e528240e7f238ebd7
BLAKE2b-256 284d1d706cc8c894aa6ce58416ab861d45c568b74720a92558ebc4a0468b550b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 47ee99775442fc4f1d487054a7be00ff151788e367ecc8f61bb26955a8328f81
MD5 cb2de76941457f13242a240f296e2247
BLAKE2b-256 a5620b7242696303211cd072b90d178edbfe1a140050d10c068d183fb1705bbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d0a3433f808be6db4932084ff429eb486bf9a2bc64b5db75597d730152425bea
MD5 f79cd2959acb1c5015d47744b6bcab4c
BLAKE2b-256 373e6ac4d80fb5f21c9a0606f9c9735f2e9ee292f4a35307d99de88d851ed050

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 be33595a0db09f5730d35de42ed53937df8f1a657fa906963d9ae421a0d219a3
MD5 92595c4a8b4e72f6a267bc065ecbbb27
BLAKE2b-256 a2601068e07c699710645408d9c55ce4bf85bc216646f2d0d84c219d862eccb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 fc42669026df7e8b6cf90a96649a898e619148ca7bce1670e57dc5827fdf82d4
MD5 0074227b154a67520573180a0accac7f
BLAKE2b-256 70b09cec0b92c350abec31f1a027e062f88cda6b1b3c787421f92c4be5dbdc0e

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