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

Uploaded Source

Built Distributions

zenroom-3.9.1-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.9.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.7 kB view details)

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

zenroom-3.9.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.9 kB view details)

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

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.9.1-cp311-cp311-linux_armv7l.whl (776.8 kB view details)

Uploaded CPython 3.11

zenroom-3.9.1-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.9.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.7 kB view details)

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

zenroom-3.9.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.9 kB view details)

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

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.9.1-cp310-cp310-linux_armv7l.whl (776.8 kB view details)

Uploaded CPython 3.10

zenroom-3.9.1-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.9.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.7 kB view details)

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

zenroom-3.9.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.9 kB view details)

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

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.9.1-cp39-cp39-linux_armv7l.whl (776.8 kB view details)

Uploaded CPython 3.9

zenroom-3.9.1-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.9.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.7 kB view details)

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

zenroom-3.9.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.9 kB view details)

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

zenroom-3.9.1-cp38-cp38-macosx_10_9_x86_64.whl (653.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.9.1-cp38-cp38-linux_armv7l.whl (776.2 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.9.1.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.9.1.tar.gz
Algorithm Hash digest
SHA256 3b51d496c4477df713d7d5371e9e636b5f33d5438d2871ba7bb5758dfcefdceb
MD5 a2d000a18f77dfda5551454af07b21e1
BLAKE2b-256 7458d4866c88c2c4b2caa5c1d3260d96732ba92ac146b81e847b2eb2c8974c30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d0168fb906092fc5843c5dadb5d9bf2850a9c05e9e86c41ca5b340c7245f1c38
MD5 219a4436b5460960ece0fa998fe4da6a
BLAKE2b-256 e79eeb737345907dbb296cc2a80d11d7f655bf51248827e15940da5b382baa34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 6a8fc67b4af3ff499eeed3f69ae734a71386c9bcfae667f7253d64da7cae58eb
MD5 d78508e4ec11626942a8f32d78ca3e4e
BLAKE2b-256 4947731be3b246e6a9a7cdfd9bbf39f8f2159cc378015ae517fe4f8c66ae7abc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 069a02e718fe18615645020d7ed2e7e017a44fa381d3408f8af4067108764c95
MD5 841c865fba0f8b589301fa8ba2a64736
BLAKE2b-256 3421b6f94bfb8cc7f84a998dca4bd67967d3f7adfe6f99b9676417481384d84d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 caef885bd3bf9e8f8bf6c360d0b83710ad507680dbc006f9063c94f025ed4273
MD5 df26af1471b62e0a19c5bfe5f88ca0e1
BLAKE2b-256 9e711eac17d2fed88da76e8e3bf9101952bc0766c0700011de111ab64994af18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 c6a2b216e5bd40518a3d4a8b0343534375a01fa26dfc488ea4b78762c80005b1
MD5 252e1f04b28bf3ac87433f6f4c896764
BLAKE2b-256 f7e00d14745301c1b8de3ffaaa210c4acce64500b6869d2d41b4e5c359cad93d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7bac3df57319664fcb4c21ede4ccd60128f9b14c108736218894678e13a163a2
MD5 ce5a326bccbde71faa4e3affbb0520ae
BLAKE2b-256 a86e32122a1fe40c4237008d2c93905de2a6d12283b138448c4fea6dacd1f32c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 1a63e463be12740dbf2fd7e77919803a03929bcefef96f598619a8f63ca9b8db
MD5 296d442dacb12fc67846e98534e513fd
BLAKE2b-256 9d7881acd0232096c747279ddb9c5b7960598e99d64f435576007d74ec235767

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 5d3e9ace29c64c14d47560b51ae64e04e05acf98d883da0805e51e18074af7d3
MD5 bff08f7b54fa4646e88775b0281c69ff
BLAKE2b-256 bf688539d169c54642396f013b113cf75dd6a7663c2ea5a4cd8331303d56b337

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c37da0ecfa63e763a8814abab651fcf6edc8246b8e95c8c34d57efb7ce793017
MD5 30445366d7a1677ff59af12aeaf05366
BLAKE2b-256 9c246c310cd743168764ae512337b141e7ec8e628a080f4aaeaba66f39deddc8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 6f0ad30757a8729fa893425c9c2d8cfb8e21aa181d6277ca735e1aff22dd1ab1
MD5 4ea5ac4f70cb8f8e301fcbeaf377c3e9
BLAKE2b-256 625992374ca9e1b1520abc41d5c718724e8a149d558a4247d6636b28e148296d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 34b7d97779c785b82c743e424f5b2d0df267a35ad43514c9c0c22cc029a87278
MD5 06be495b915ec0344c185f7c37f04a45
BLAKE2b-256 9f873a5fe9c779e0e9c0d74e1f537b69d38f7e71bfa64c3d92947c9363063f4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 cfca0c4adfecc0101fd50d6d13366c79f8efca448031ae53c24633fb24989850
MD5 bd55f44696e40e59a3a029367b53576d
BLAKE2b-256 37f0cb8115f47faa6139a86ef6d2da2da687a49fc7859f2449b079d00d43f840

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 3570b80bd5e34c66349b367e1bab2335d64277d2a8fd50787c53e3b514b16c15
MD5 3d1636e46b0f59899569a494d35f472a
BLAKE2b-256 d0d94657d70093aac5b451a85e27c5b1326e4aabc7c28da9a6ac3eb703ec8cc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 329232334e8d88ff1071c891fd2a0a41f41d5f2d42d12344c49350e093d8ddca
MD5 b4b8348fbeec00c94a9a7fef0a1b7867
BLAKE2b-256 217383c883afd1eea7fb447b6cf9f466548fb23a6d62e58dca870fa2578c575e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 ea2f5730dbae594d6fa5d5229cf306085c64e197aad5992dddb68d12dd5f0587
MD5 d7dc889760e73be5c412012dd2e67297
BLAKE2b-256 7949bd58cf9b3238d61b569dc3261016a3fbc35931d912e8066f6325605619c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9f915fbc55826a6ed368f5c979470ce8ed2ea45fae365a2d721ceca26039fbea
MD5 6739c818adfa2b693abcb59f89e8ccfa
BLAKE2b-256 4bd9abaab7db74d5f1a986be92d37e76eed7c7bf534e510e432d8b2ab004c7d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a15e61f8ae2aed00eb3964b335cc39a23eedb17be70e6e5a4969748e69145e9d
MD5 82512667ec4c4aa704d7b29d0f210426
BLAKE2b-256 e87d4237e2769222c27d8392e4a9a54b147877bd52785f64a30674862940750a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 9e8f98bd02abfe9ce431043f3366afc5469b388ecb67511e5ca84798996f1a8c
MD5 582be161401cbbe036854a596b1c86a2
BLAKE2b-256 721191ea92aacd02216c42426a991582031f13e77d21322cdcbfaecfb021aa0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 339139245e6ac693053630a8e47fff0e05c079c4a7a3ce078da7104a0c0264c0
MD5 595a1f285f74eb8165cdbfa22ab82529
BLAKE2b-256 5a88d3071527998d388b3cb1993887b9f386b2508eb75ade4c85215bb763f6df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.9.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 7a18cc8b4dad1611c8105f79a2148cb7b46c308700a90a1e10fd376f2ed3a8c6
MD5 895d06ad59fb894ee9992e7997245bf4
BLAKE2b-256 50030662a54d2057416f968993741062a755269e6a1390a54a6be42e4c203e77

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