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

Uploaded Source

Built Distributions

zenroom-3.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.5.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.4 kB view details)

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

zenroom-3.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.2 kB view details)

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

zenroom-3.5.1-cp311-cp311-macosx_10_9_x86_64.whl (652.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.5.1-cp311-cp311-linux_armv7l.whl (775.4 kB view details)

Uploaded CPython 3.11

zenroom-3.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.5.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.4 kB view details)

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

zenroom-3.5.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.2 kB view details)

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

zenroom-3.5.1-cp310-cp310-macosx_10_9_x86_64.whl (652.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.5.1-cp310-cp310-linux_armv7l.whl (775.4 kB view details)

Uploaded CPython 3.10

zenroom-3.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.5.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.4 kB view details)

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

zenroom-3.5.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.2 kB view details)

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

zenroom-3.5.1-cp39-cp39-macosx_10_9_x86_64.whl (652.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.5.1-cp39-cp39-linux_armv7l.whl (775.4 kB view details)

Uploaded CPython 3.9

zenroom-3.5.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.5.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.4 kB view details)

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

zenroom-3.5.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.2 kB view details)

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

zenroom-3.5.1-cp38-cp38-macosx_10_9_x86_64.whl (652.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.5.1-cp38-cp38-linux_armv7l.whl (774.9 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.5.1.tar.gz
Algorithm Hash digest
SHA256 35dcf2ec9093096e214a352c773ff600334902eec498b363580c414bd19f7fd6
MD5 57dd0415fa2638587c281b289cf91df8
BLAKE2b-256 d819521ba1193a78a2897912c187120b3ac1cb55477c82dd0044918082e123b0

See more details on using hashes here.

File details

Details for the file zenroom-3.5.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.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 74b53281015212e82f6d1a93008088b7e2ca5d3607662ecd7cf46664751686ba
MD5 9d35c337037a5c45ad19fadb6b5d45fc
BLAKE2b-256 cf134099a04deb1e6140311fcc3f4679530e38e31f45358700c1868a9a14e6c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d3ad70f624f5504de68e767fd7a77d5999e7b22e0b1bec7c1eccdfcb08e3fb12
MD5 bad00951c4e224dc20579dd0add67139
BLAKE2b-256 3d812f56a60c5c3ec972bcff450583b5b0489bd8545911a1ddb2609b8c9a6400

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 14745cfc3f332bcf85177dda2468561445235ea646ba16d12dee19add2bb6790
MD5 655698eb32a216f8bc02ffef322178f3
BLAKE2b-256 15f2dfd9dc9fe27dc4d5c7f4eb85edea5b4b01c25d0ccd0cbb259a3689dd29d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d81d45be956206085d0df74135a23fdc3cab615fc83c61d2ad412b49eba45f5b
MD5 35d2dbb311d0053e20a08326588fc0c4
BLAKE2b-256 1ecd596e6064e5638163e98cfcabe3e3a4ca4b0583dde4a2e9ddcbc41142bcd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 9f5b06fa239bcbb3cd81c4888d11a521d60a8ae33ab5b4e143a5f31f5eda9150
MD5 e832d62eaa605202820f41e0ecfb4905
BLAKE2b-256 400e0df7ba7b5ed77111d568dc33c759177e40c156067bc4bb7cd9bc71c5cf4f

See more details on using hashes here.

File details

Details for the file zenroom-3.5.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.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 925ef44b11a9a0796cc49ea5537ac464a702693edd15b7e7d07c594a5547008b
MD5 71aaaa8415614eda43c3f326a7676115
BLAKE2b-256 7a86d42cbae65caeba0e64b2b589d7420e7f11c68672db37dc7d8692dee0a482

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5f36667c9639db4be283254a3f8c214f7e387628f6a4a30f7331cca287e3c0e8
MD5 79a9eb016d11af3fbd8421a98bb002c7
BLAKE2b-256 a9ffb6c4763b8711885d76627b2c47067700400c0a9133b3f814bcf5d491db49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 4148c52ff70a90bda123b636dfb7ff5dbfd257d06c95c0f1bf2c21b9a9efd2ff
MD5 8f50dbf38a0df1e66350b20e993b3777
BLAKE2b-256 e6667ad55f615f4a3660f58c12075172ebc453713b7f909c3073039feb19b522

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9e20e85b0b6ad7fd32433bcedb39c273f350f6dba4566957c22b96b6e8787fef
MD5 0789c6dd321e5125f1ff56073fecd316
BLAKE2b-256 447ac5e369cf1a2fb34495505b5391930ed3dac52cdb9b5e671aa6f76dacd2b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 5a1ed3fb15956a0a5cb405fbbb44135b20577b8edf09fd111f84db6f6ba3f820
MD5 9ee17e5cf2706b654a924325839d6e17
BLAKE2b-256 2fc534a33efb0c3a8cff68d18f86de3026296fe49631c3c309326f40bc9b0379

See more details on using hashes here.

File details

Details for the file zenroom-3.5.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.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 eb1529ea34d38d284a647c86094e23a489efa2a5173cc0ae34d58ae535d782c1
MD5 a9f0dbf5c980634b3ccada3bcabe2736
BLAKE2b-256 512e9f61897727b0ed7340e682b7601e4d8e98f19507934c35f2c488c590efdd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 cbd91bee7c432d2969613ad11703afed701de2607ff0ab3444a81ff8adbe46db
MD5 08aaae6b5b9795ae1a5a6a48a44f15db
BLAKE2b-256 da8c251ca84d10f067c4c1154f3a60eb7e222887f087911a65a29b23e3122d41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 647dbd404624dc39dc94e985cab9c2067be7c1a30cbafc449f088141fa5cbbdf
MD5 08a774821e659a22cd88f479195b36f5
BLAKE2b-256 78cc2a0953cc72a10454fb24a5ad7aebb9e705effa4df9b17f1c6ca95e09c26c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ab63bdfe2e161369d06b350a46f5ced1a83ec06325ea86721bb6de9f3222b1a8
MD5 7a8e912af5876b31121381f96a805556
BLAKE2b-256 b98fc5f0c971cf50cc80749711a565f2ce60c0007fe44f7579b8263782e45142

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 2c71f1cd08ccac66ee432c93a85d6cd3939078941901c9e7befc3cf1de49c780
MD5 4bd78294dd38f0c2c4665886ac183ce7
BLAKE2b-256 c8bedb2cce5bfdaf866e337d28069381a035ebab4705d8c6444c98389cdbb1c2

See more details on using hashes here.

File details

Details for the file zenroom-3.5.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.5.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 88747edb75095f26903700331bbc944bdc5a261e56cc4067573bc2904e9a2fee
MD5 bcf8a112b3f74a353e8be5908a2eaa67
BLAKE2b-256 2bf62ead76ea74464ac71d6d869463ef43efef4bda54099ed7a59f9fded77c33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 7860cda00de887ba4772ee672973660bc02c2a08fb93e2beee7b7e0981aa8df9
MD5 822285e9050de17d1a7bb9957f9259bd
BLAKE2b-256 5477eb83b1a2741982ad82e808f5d3ed4dfe7d5a0d302d15af1d34e59ceddc47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c7589279f425376286f8c4fd41faa614301118573f9026b1c63f0bab87d8e1fd
MD5 fd2e9bda2aadd568b6444a15a1db4f31
BLAKE2b-256 763882e9d7109164fce871fe6163d42bdcc0d23420818f8ad8bab8c11608d3c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b5d54a942976e783a2610115b479fbea03b3d5ebb9c5d5455fada900d29ee4e8
MD5 d799bd933f177537a128077cd7d48bb7
BLAKE2b-256 61bcdc47c446248d80d7b90026b3be943706cf45d4bc26ed71096d9231ca9c66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 72e5277e55461a008fc74eda10c17e636b53658668fcad292a706fffb541dfe2
MD5 3ddd3d74f8b608a04dec474f0ad53160
BLAKE2b-256 1fdfcd173b4fe6e2c5ac4ec897fc0cdbecfe83d9037a0c4a672947844107c9db

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