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

Uploaded Source

Built Distributions

zenroom-2.21.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (918.3 kB view details)

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

zenroom-2.21.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (932.5 kB view details)

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

zenroom-2.21.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (863.8 kB view details)

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

zenroom-2.21.1-cp311-cp311-macosx_10_9_x86_64.whl (779.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.21.1-cp311-cp311-linux_armv7l.whl (880.0 kB view details)

Uploaded CPython 3.11

zenroom-2.21.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (918.3 kB view details)

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

zenroom-2.21.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (932.5 kB view details)

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

zenroom-2.21.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (863.8 kB view details)

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

zenroom-2.21.1-cp310-cp310-macosx_10_9_x86_64.whl (779.2 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.21.1-cp310-cp310-linux_armv7l.whl (880.0 kB view details)

Uploaded CPython 3.10

zenroom-2.21.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (918.3 kB view details)

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

zenroom-2.21.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (932.5 kB view details)

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

zenroom-2.21.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (863.8 kB view details)

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

zenroom-2.21.1-cp39-cp39-macosx_10_9_x86_64.whl (779.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.21.1-cp39-cp39-linux_armv7l.whl (880.0 kB view details)

Uploaded CPython 3.9

zenroom-2.21.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (918.3 kB view details)

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

zenroom-2.21.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (932.5 kB view details)

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

zenroom-2.21.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (863.8 kB view details)

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

zenroom-2.21.1-cp38-cp38-macosx_10_9_x86_64.whl (779.2 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.21.1-cp38-cp38-linux_armv7l.whl (879.8 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.21.1.tar.gz
Algorithm Hash digest
SHA256 4cba4860b0f9f80db0be1334ca32d2f29e72c7c5eba10bced4270ab55db4078c
MD5 de7d1cf6f9cc81f7945706763a1ce02d
BLAKE2b-256 24c60a46eb0a5707821d4446bc992ff36fe24293286bf64a095df8fe63a55bb5

See more details on using hashes here.

File details

Details for the file zenroom-2.21.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.21.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f185989918fdb44154fe27808f1b9731efd2888066b5c843594eacdc3d7340e5
MD5 eca234b45a4360c3a7bafd1a22b3a2f0
BLAKE2b-256 b739095c0e25518c3b13270e05c98626a238a727533cab94f2602163f24ff509

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 01f032cef4e45ac99de8995d62b19ed9bd3fb6221634e6ae6d8754f5df37c0c0
MD5 5f31a2aff9b0fd62aa7f253b23ceb9b6
BLAKE2b-256 4f6bef450a7c5e819c29bc1ef5dbcc2ae6640414ff772b44c91a99a7c96d132f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bd0e53ac82fd80dbb68c7ef315ae47192111a6cad9ab43c12eabcdafd1b090d9
MD5 323ab503f619aa8a3f1ed16e69ee5b2e
BLAKE2b-256 f963e3622e2f7231dc6cac0ef4dc45c99f1263fe21e8f71903fa4cf464c2050a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5ca2395c062606704ba4151a8778ea0eb6dfe34a8b1ceebcd599e071726ae185
MD5 b1e7931171c44dfce04335f20db4ff54
BLAKE2b-256 75cd9445f0abb35b0a34159ccbecc2fd4fd5d297ebd14d11da79c3bc8cf262c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 006184da3df4152ac3cc6d983440053e5096db5602464338c52d75319e9221b0
MD5 8f8b2092115e2893d918857026b61a01
BLAKE2b-256 66a4f9ceb58286ae13d24d692c47064dd42f9933c521da8658cf5435c87f04a6

See more details on using hashes here.

File details

Details for the file zenroom-2.21.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.21.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0647e527cf554c2f0e0bc2ea6aa1f61233168ab6b82cb82d83f5644d9f7a074a
MD5 316e6276e0d43b61ea2b3bccb5e7ee06
BLAKE2b-256 7d0651382362dfb103eb948aa0fe689b85bc95f1a137bc21af1e6869a51035e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 11710787cedad368223f4c8408c10c8c50b117cbcfaf8ea24d02c55933fbc4c2
MD5 be9351a4f00d2a6f5a109c594b3a4cf6
BLAKE2b-256 f80de6157b8aa55f6cc0704f9ac688425a2d7e145115f7722a8416de4b8a4d36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 404951b959a46b601ce09aab6c35abd59235c92ca0be1189f03562d275c29489
MD5 04cab4e488cab25ad1ca6b1d4be4d005
BLAKE2b-256 805fdc4ec9f4f462e1472f01010163cb55a91c3a716c1aa00f7efbff553d2b6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bb029780b91210b50e45540c6584f81ea38e43342ca17e9c91b38f0de4482f2b
MD5 d4e2a2646a3cdf1461541d66d24400e5
BLAKE2b-256 6ed87b8608f4632a2bcca9ba16a4e6a59c05c2a027ce89d5d84b52481e9c60a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 94eae9452c7983772f41bbbf43c6c874abdefdff085e46d6e924b308c34f0dfb
MD5 0ed5c58f91142b97340c5969378392f6
BLAKE2b-256 d578d7267b6e5f7a1a0e814e02a832992c68fb3679b53cf42ec1644505d40ae0

See more details on using hashes here.

File details

Details for the file zenroom-2.21.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.21.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b2243d356ebc639c379dc61c98f71243f49291b5001b9e42688ce6872f3999e0
MD5 435bb574405ea9026ac06df929cbf380
BLAKE2b-256 b70d5018f9bf9b6d5d56702acacd884f3f6ed39c12683ec4fe1e17c8c029df5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 94e8990ed7e0e9a18034309f9225a5aca4379732d3a7a0207350ef55c6503a3b
MD5 527f6cdd7b6ed2abf5d27c11d57ff3c2
BLAKE2b-256 ba193a4c5252ac00f20f5698727d6dddb19dc75ed3cffe9f2772b45811ebe124

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 5030c0f0086b65544dd7a2b7475a2e23d277fd18bf53af8e02a79902d0bdda8b
MD5 98bafa8aa328f97e973066c6e5ca1d38
BLAKE2b-256 4db9e879be71fdebea6686eaaacbde2fee1eb1a4409d615fa915d240b4d4422b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a3e82e291ffc81e568253cb2e75ce3157a742ce60b97697cbc5f9e42215094fa
MD5 f2333f8f0474d92b97376b1834cc7e4e
BLAKE2b-256 b63bc6d093b2eee21d4adbfdc49a5ceb2b12010676d3880fd2666f80594be47f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 e63377b701875d20d89c70087383258da8b4f4713fe700e63d446dc15f800b76
MD5 d351be08c3614d71552eb6d46063c8cc
BLAKE2b-256 c8c10f9878a5acbab5f794d1edd8f06497a662253bd3c1ed52a7413b3251418a

See more details on using hashes here.

File details

Details for the file zenroom-2.21.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.21.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 1ef900ddb08001fe9fe00a5764c477ed34d7a1d0a8f976145fa4a6614a77d10a
MD5 f7660898e917732ef98fd79e8bf0ae32
BLAKE2b-256 fe8cdda59165135a9aa03355d80357697992f2f3dc33516f6ea5818bb835a8e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b64f21a85639da9fdc4dcd9c5787ad56880b19ab2a4cf21846b018a8ee0f1855
MD5 05c808e23e7073fda11ef675bb04467a
BLAKE2b-256 35d9b37e4a161fd46547cd2ff283fd9a241b4b9fcf2e03374f7bc5351f88491c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 bfeab3c4af7d3fc09027d53d2b1b2ef85ea697f7b9c9fdf98abb4787d52f6fce
MD5 de6e3c38f13bfdcd3b6fb5eb67bfe9de
BLAKE2b-256 0d153e4d55cebc8edecbcd2bc122857905999517f165724672d51cd8f711eea8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 32a36f163bc5777e4343681ff843f7785915b8c110337ef8afbaaa4805704bd4
MD5 e833363445890e6cd93efdfd55c12ae5
BLAKE2b-256 6474cc5dda87777109eff5cc59aec4e889bd7fbaa6a1ac86d4e5dcc2c6deea6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.21.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 936dd340d5187a7b2733c3b5dcb4b9131a780da598e69128d4c270d1096ab8de
MD5 0b387a85c677f7e1ec07551fa92cd888
BLAKE2b-256 ce851c4555bfac361b893983784ba73f30513a1ac3eba1b41c7d0e5ad4712aa3

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