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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

zenroom-2.16.1-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.16.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.7 kB view details)

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

zenroom-2.16.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.3 kB view details)

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

zenroom-2.16.1-cp311-cp311-macosx_10_9_x86_64.whl (779.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.16.1-cp311-cp311-linux_armv7l.whl (878.2 kB view details)

Uploaded CPython 3.11

zenroom-2.16.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (917.0 kB view details)

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

zenroom-2.16.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.7 kB view details)

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

zenroom-2.16.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.3 kB view details)

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

zenroom-2.16.1-cp310-cp310-macosx_10_9_x86_64.whl (779.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.16.1-cp310-cp310-linux_armv7l.whl (878.2 kB view details)

Uploaded CPython 3.10

zenroom-2.16.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (917.0 kB view details)

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

zenroom-2.16.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.7 kB view details)

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

zenroom-2.16.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.3 kB view details)

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

zenroom-2.16.1-cp39-cp39-macosx_10_9_x86_64.whl (779.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.16.1-cp39-cp39-linux_armv7l.whl (878.2 kB view details)

Uploaded CPython 3.9

zenroom-2.16.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (917.0 kB view details)

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

zenroom-2.16.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.7 kB view details)

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

zenroom-2.16.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.3 kB view details)

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

zenroom-2.16.1-cp38-cp38-macosx_10_9_x86_64.whl (779.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.16.1-cp38-cp38-linux_armv7l.whl (877.9 kB view details)

Uploaded CPython 3.8

File details

Details for the file zenroom-2.16.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.16.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 71f0d4e97d7f852930f3218f0dca78000484b78f2a15fe8967cb638f52dec428
MD5 9ce3ed229d82e5f19b028bbcf9f7d732
BLAKE2b-256 92a186299da1721d9127fd62bcbd5756493289dd637ad5dad7197c9357f9eebe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a4691019619464cf4002d9f088534c456e83bd244d3787968868a15164d4650d
MD5 7745328d361639bcf65e239de7a663f7
BLAKE2b-256 4ee50965c449b9a7116bd0fbda2ccadfa53b9b6ae8c7be56d6bbc6bd12114853

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 614da345bd2caef75a9c6d09fb5dabfde4e081173918225c045350aa1f641d46
MD5 6c7d416a977c9d9badcefd669e391782
BLAKE2b-256 b2e4a2855e973dfcf12d2f42d8588744f5aba1e0f14f977a1d37628899735089

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8be5d3abb565b9bc0c121618ad40873e822864c7df22b83470e485b03a0c977f
MD5 10cddeb14a383317f2937c49d887bc12
BLAKE2b-256 0691b6d2ceb3bba10203903647913b63d2d12c570f1d19130f06ac389afcb0cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 cfad461a9c08422b5d82aae0850266687cba1a17264fa59fb6956db881d4dbde
MD5 6754bbfefcd15b24971cc5cf925b1692
BLAKE2b-256 c500386ab99bd15f514dbb2373e385f26be77531f122bc986e57032f2736a6ce

See more details on using hashes here.

File details

Details for the file zenroom-2.16.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.16.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 a5a186cb2ed81f78bb92f9fe00d2e2c4b3b2a297ac2bebf48c7175b8db40fca9
MD5 9a170d82bfef5cf5f5282913d5b32ac8
BLAKE2b-256 e6830c00a172d925c62d2de0c8cf2c2c66caa0bc866bde635a450233bfde34b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 a8e55aa415dbaa7a724a2f63537b83239025afd418520ccf51caa56fc3c2b1ad
MD5 800f12bee0a12141f73611ab8bf11d65
BLAKE2b-256 01d497d02a0d1000a44accefb2ce155d17e888a260a26985f2c431f06f5aaffc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 6bebbb32f07a3f02aca58fc11f8a9e1c148a333ac5d03edcf438bf4a90532ced
MD5 b24a9c8a99844694fa8ae84724447647
BLAKE2b-256 d3cddb9939b6df64040e07218213639bdb1921680351649d8618715d3f27673f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b533bfe4b61bc835879fe1346042b088eadd931e70ccac2bb1fe86d52f2af1d1
MD5 aff4f28dbe3c276e467075c805f9e924
BLAKE2b-256 812459190e510239ac30d6449f670eb1cbbf5f4789bb7e88ca8f30020b89f527

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 aaf22b461dfe910778090a3a6514312dfbb55bb95799c0dd2de80f9392f53d1b
MD5 84448fd4f1bf8fffe7ed4920ac7ffbc0
BLAKE2b-256 9f5724f9311230cd6edf01c65efb134bff1d22f74bbfd1a165fa85aa113cc0a4

See more details on using hashes here.

File details

Details for the file zenroom-2.16.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.16.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 188920efed9de77a7ebd1582c74fca714df38e484d55bde27a2a7cb5d4643620
MD5 a7b90cbe4977f05e26f7e8f69f04063f
BLAKE2b-256 f10efd79306dba8db24ce65d484de0a14ef634f01cc34c902f1013e8ce9fe841

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2e82926f49884ed5da0f4167bba597bf5d322e71ac0ad9fdf2cab732fa8a6361
MD5 d09d203c6d9e71b15e6e9d753aa47962
BLAKE2b-256 ba130cdbbc17ee2f5726e74f06ad8765190056f88dc757b90bab265741f89515

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 6f014b31719ca97f00a1494df7c48dd974765eaf4cfa1ce8a296e612a88e9b8b
MD5 5740cf898a1ebcb178dfd9df7943dde8
BLAKE2b-256 08f72214db869100eba278127fa6c7c7784c7248de85ecd70e540178301b03d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d3f352d3c0509a443495b0df079599ea770e03f4298f86bd0d27d66cfb8fb8da
MD5 e4780467c13b6a48e5b8af3bacf4810d
BLAKE2b-256 ddee1e576fdb7cd4ac0105a32e9dbbc03c33ef6196b8f1dfe5c7828c2f41039b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 672035654a5b006dc0cecbb872d7b68734ece6948f3906e95a0091104aca1fd7
MD5 d2a17ac322c7b46264bd61cc67dac51c
BLAKE2b-256 036084439595ab4321df22a1467496cd157c728ce1360a7501bdd4b0bd65e4fc

See more details on using hashes here.

File details

Details for the file zenroom-2.16.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.16.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f1fc7fd8a5f88e5c74c76ce05bca10175113b7e340363ba68608b77ae438ddcd
MD5 73bbe1b616377dd169d7d904bc7ab815
BLAKE2b-256 da0965a3b57b484ebb337427b60ecf78f29825f8c6d53e6d29bae73032d02efb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 42e4d76de795753f2f052f4fff4059b0d18be71fb4f3e7ecc1e884f38d200960
MD5 ad1a2c1b5e017ed37df430d8d4b91025
BLAKE2b-256 0a600cc42d064afe91a26f155bc25d50550e2fc0466ca31c3ba1cbebc735f262

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 2bdb75c7230a0d48d9607012cf31bd43ff59b8d1e0fd11235aafb4a00543ce5b
MD5 45e2452fcc1f36eb9f4787f205ec17c2
BLAKE2b-256 3e0eacb1881c5a8b870b1e9e2196105cec3a54d911e97ccd1defb0577733944e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d5f471f41eca5841bfe100cd13c30638c61bda371c1f76aedb75fcd91332a114
MD5 72452ba2e2074e9ea94aa6c5d912cc57
BLAKE2b-256 3502fd8310f10793c6a6c9444a2208fe6b6b3609ba15e915a1a2762c969e3429

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 d21504365b867ad66adbcbc3b1ddc35df012c434557cbc1a7638c54eb4118f23
MD5 16e455a1e8aac6ec22b4d824a2932e1a
BLAKE2b-256 9866f7bca9a5590890658350884f45e3709dc90b8fc440482265f9af2cd497ea

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