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

Uploaded Source

Built Distributions

zenroom-2.20.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.6 kB view details)

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

zenroom-2.20.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.4 kB view details)

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

zenroom-2.20.2-cp311-cp311-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.20.2-cp311-cp311-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.11

zenroom-2.20.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.6 kB view details)

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

zenroom-2.20.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.4 kB view details)

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

zenroom-2.20.2-cp310-cp310-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.20.2-cp310-cp310-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.10

zenroom-2.20.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.6 kB view details)

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

zenroom-2.20.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.4 kB view details)

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

zenroom-2.20.2-cp39-cp39-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.20.2-cp39-cp39-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.9

zenroom-2.20.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.6 kB view details)

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

zenroom-2.20.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.8 kB view details)

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

zenroom-2.20.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.4 kB view details)

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

zenroom-2.20.2-cp38-cp38-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.20.2-cp38-cp38-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.20.2.tar.gz
Algorithm Hash digest
SHA256 9197f1e9529738d309b54e98f889b97009ed67e85f06c21df7dce0436fc2727f
MD5 51509f690a972bd2014ad781bec5b12a
BLAKE2b-256 f33d86a39d271c0abeefcee6d40973e4afb1ed7683329f655747bf526f5b9eb8

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 246df2a6bc19c26e08a4b971bcdaaffdae82fa8ac0b1e34536ccda19237b153a
MD5 f25c46402b75e0ff440da2c5611f7f0f
BLAKE2b-256 52fd9574138e3e8b785510aace56e8ce79bf6db3d66443f6e223b4e527da4950

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b0626e6538e7dbe980be280929b2d8a6a505084608befc9ea57632daa5089bf7
MD5 5309378e5428db3e53e475ccb459c8dc
BLAKE2b-256 08ad0c4fb5a6a5b0f637e01e1e0d20d02fe447a95a8ec813c105849f0158580c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 7e660b6b578bf95c9d856a9a02183e38933ee19efa21b9102c94444f96cf531e
MD5 c72a2945b2b6cb81d141b1e692782c07
BLAKE2b-256 510c5367a590bd95722fb55bf4a9eb73f39020b547c285c913b9eab7af791bd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e9a94144252267813cc3d249a1c16618fdb4b51139b2cd4ddb485d49e5df098e
MD5 34b2a07120493a31957f2c55155a2394
BLAKE2b-256 54e84eb0cf60dd220db87e28a1e36e3e2022f976c35cc8cede836b3c1435b70f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 522e8f34cc7e33159df3407712c95bc7302da880d5ce16c45b0d39e2c6e14167
MD5 624adf46939b58845279e57b58c79b6d
BLAKE2b-256 5efbabb85be559283fb51b387c431267ef8665d7dde8e2501bc799d99a0d6d4c

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9f77ae4c0e627b29a2760883564bdf2c3c2ad804e89b980eeaa7f4fffec7f486
MD5 e15dc88eef837ca695ec9fce8c81b419
BLAKE2b-256 b32862d54c760eed20dadfb67c8974a8b75142b12881cbc2ff623f26a85ab7da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2e8895177e3107ec605368a03f01c7ceb2f068c58cd1a304172bb28fafab83b1
MD5 61e179faa9ccd0a8a314e79b43217284
BLAKE2b-256 4c613d5f1926991fb8eff67755b1b7fd05b612a4c88dcc5d661ebbc586b3ecbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0245feeb6b088e9d091be495f4428b0137ed8bf7dfdc23a1189c66a5f9213233
MD5 a82ca62462ab49d418a751726d5950ae
BLAKE2b-256 2d02efd379efe3fbbcd8d6c628c6add8db3fd9db8804bc65d96fb480bb437adb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 498ddbb7ffec24168d8ab15bdd6ea6d7a2fc7dcbe8bcd865b53ad2f0fd394561
MD5 138b7f04b7a3f3da7555520dac6a0002
BLAKE2b-256 ff04fc734bc702752bd685f54488c01f634bca0917158e95d5952b843fd1f9aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 02431d27c44a820eed15a3913df7aa5a03a4ffc34cb43cd32b416ff9d68c3fd8
MD5 b89d90775cf39d16f34618e3d6bf9020
BLAKE2b-256 560500083a2268cd5393082e410220ad22888a8a7141f2eedaf300b2f8e66f7b

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9ffec240291bfe1c83c545e2a965e5866d9de8dd1f50df4624465e9c78e4fc01
MD5 5ea7243e291252e75fa89a3d808d071a
BLAKE2b-256 5f3dcc5f7638a57b27eb5cc79084b6a66f7e38c6cb0880137d3a3960652e6463

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b26dcb7ef3fa324d10da91441a43899bb9ba82d53eef1db8220a5892d8e19451
MD5 98dbcc42acc73b778fded3a768e2e7d1
BLAKE2b-256 7102fbec7f28b9971b562e5abfe859a4f2a58656560c28b480a2d6fdfa457974

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 f65a0bc65746439c5c91fafa78ddcddde6b9522155310cee01faab75feb908d6
MD5 9b394c6d620edd5669ff09d58e81ebd1
BLAKE2b-256 54a00906d11006bc9ce9409060007a41f40a5f7eec9929944d50dd227349db33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5b68c256e71944d9903b76956ec7f0246da2b738fb6d5c4e366169219426ed8c
MD5 7d0013ab85d4bc913ec31ee85c352c11
BLAKE2b-256 5863de596c3e729c1a442095a8a5ac2a800cec50ef3f5edc4618d0cde4207236

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 a59cc2b5cf0953c5fd5c0bbfd71fd283e2794bd7a0c5e2081e275907c140b4d5
MD5 79abf6ceab06014af50264e6026fbb70
BLAKE2b-256 55bfc6443c17f838f5223888144c8f1c9b95cd33c0da9d72d91e0439e4172b16

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 1013394a2ad07800d4b249307e77ed122a99e86fc9439d5e2c380881bf1010fc
MD5 274792e963359207f5146f1ec0db29b5
BLAKE2b-256 4c581970c66b2fc82b9d4f77533f740b697237c3901bc437259d948075b7ca0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 cbf6cb4b12941774ec9a59a2ed8101f8b375fa56513f571a57e7783b1fd7563f
MD5 5146fe1dbbe986cbaf9c679a08087d0d
BLAKE2b-256 bad23c2e4e5fd445751ab1ad912a54f404f8819856d5733befd4d0479c831a38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 594e26310cfb40c01b83fb4bb9194288c18666e9966aae3d7d35a8e2022cbbee
MD5 be94a2a652a86632c23906fe73231cd9
BLAKE2b-256 80530bcb9e65c5c4e26395f974e644d5692e11db2a8c16299d2b563dea434f5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 16052310d449169356ad1e9d5c48c86ff7fe30a84b094a73b7f6ee3141beb6e2
MD5 d4cdc69010cbe86bd5035dcba9e8d459
BLAKE2b-256 f5c01aed46b2f05ecaf0a0c0e26836abb828cc33678ba0a61b9ebe3cc962cff3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.2-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 0dedd4c0c73241b89811251bbae0085cf42ae08d5ca5adbe0e3070c2f8fb9e69
MD5 b3e0e6608ead815a67be2ba61010a2fd
BLAKE2b-256 ed2c231631e7799bfe2a6d295a212672094ed3584b4dc1edbeb08d67add5633d

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