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

Uploaded Source

Built Distributions

zenroom-2.8.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.8 kB view details)

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

zenroom-2.8.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.1 kB view details)

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

zenroom-2.8.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.0 kB view details)

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

zenroom-2.8.1-cp311-cp311-macosx_10_9_x86_64.whl (777.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.8.1-cp311-cp311-linux_armv7l.whl (876.5 kB view details)

Uploaded CPython 3.11

zenroom-2.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.8 kB view details)

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

zenroom-2.8.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.1 kB view details)

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

zenroom-2.8.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.0 kB view details)

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

zenroom-2.8.1-cp310-cp310-macosx_10_9_x86_64.whl (777.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.8.1-cp310-cp310-linux_armv7l.whl (876.5 kB view details)

Uploaded CPython 3.10

zenroom-2.8.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.8 kB view details)

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

zenroom-2.8.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.1 kB view details)

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

zenroom-2.8.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.0 kB view details)

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

zenroom-2.8.1-cp39-cp39-macosx_10_9_x86_64.whl (777.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.8.1-cp39-cp39-linux_armv7l.whl (876.5 kB view details)

Uploaded CPython 3.9

zenroom-2.8.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (915.8 kB view details)

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

zenroom-2.8.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.1 kB view details)

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

zenroom-2.8.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.0 kB view details)

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

zenroom-2.8.1-cp38-cp38-macosx_10_9_x86_64.whl (777.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.8.1-cp38-cp38-linux_armv7l.whl (876.1 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.8.1.tar.gz
Algorithm Hash digest
SHA256 bdc9788a348ab4e9635496dff6f49715c5c98e2393319e304fe3d0b84ee2d7a2
MD5 df75865c0623b4dfc01fc73194ab3b33
BLAKE2b-256 0a105076ec78a2443fc00ad1db5200d41e301e3d13f87e9e363fe5363a219906

See more details on using hashes here.

File details

Details for the file zenroom-2.8.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.8.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 36bc604f93c3585f0170e26c38eb1e2dc28a6d824705e404b9f30c548ad5afa9
MD5 9c36cbcd950d32f1cead945ab02ae8bc
BLAKE2b-256 765a2455079d68d110299768321ca8cbe5aa9e9dd7d4aa39572aad44e32ad8ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 fd14a49ebff82376e0ddf1e2647f17f1a70b6e203aa9125d27f26b33f382bd71
MD5 04c0c83cfc359d6e904e174aa27c9819
BLAKE2b-256 991232b323d8eb0dec311edb85f23623d6f165ec34ae10c8af0836bf5d9a169e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d78372e54bc97eb37e29ea4c90e6f366fb5be181d2ea5846aaa465a6a4ceb6ec
MD5 0d94207366e47bd1c688c640f44e521f
BLAKE2b-256 09cf7f72f245330dc15933773ca95fa6f427f43890b9ad5bb0740fed1a378d5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9342785c9d88cc0b51bfba44dacf2322c1d95ef8182e392671a1f532ea4e7e62
MD5 f0db3a978b425ffbcfd2fccb24508280
BLAKE2b-256 7e8593f099b16e0e71ee08a5c994829514f24e2c690123e6fb1588d40b2313cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 b0b6a145d449bdc33ca239c62da97bbff24c0e33bfff7b8ae965ec3e9b2af8fa
MD5 6d279bb09c0522330509a061b967de1c
BLAKE2b-256 5b2120c2a2287610895fe85efa34a7bad7d0970563a89433504c1c9bb33d1bff

See more details on using hashes here.

File details

Details for the file zenroom-2.8.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.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2f35375ce08734b9b0aa515f59351cb56a64c00130024a74dd490eaba77412e3
MD5 08f2e2212788e9547b5466ab25e7a9e5
BLAKE2b-256 800b6de29f00179ce5ff68421d31cba831327ef1d6266f9c6591cc6a3aa4a2de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c296c8f5d2e1259985b83aee0f0a665c8fc7add29399ef2c5b6724631ce8c0e5
MD5 276e9f28d3a13db1b5110fa0de531d12
BLAKE2b-256 fa1038f591b4977e9fb0540dab4aebd3bfa519f1fafe2d7ec8aeda356dd2d2f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 dbef6bd56ec2d16dc290c787035f17968d02c90ecb304d195cd0a5325d670a16
MD5 68f4bcddff74b73059f639ef6330b7a5
BLAKE2b-256 0fa4fe4ebdcd9105ffdbe93cdf5c205d443fe5f823022d31e47876582dc1edb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9ea001226756f23aa9e1e428653557747e1697e80ea34f543e4672c074ced997
MD5 202070dc8b22d3d1e1f3cc332bd054f1
BLAKE2b-256 bb223fde1eca99a0d413f32de5c558f47c479aaf899b796a88c869e48306ee9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 cc0b1fa586c8db2d154593708dbd59c5cc3de5b09bf0802ca88f7181b2559c3d
MD5 1cc86aeab1db48d9945fd2b10f9646e6
BLAKE2b-256 28d0621145083d5bb91a8bb6d0ea9b841585ddbf1d51fd1033a96ea00e18d436

See more details on using hashes here.

File details

Details for the file zenroom-2.8.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.8.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 667323d3b1a8fa783de6d96513d8eba49884b11c214180e311d9c86eb1d1a3af
MD5 6c8ab73b47fdfe9541c3be7449a563ce
BLAKE2b-256 87df940c013c4a72ece00f14737682f2832270cab30005be8ad4fadcba515c0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 48221e29cd1839dce48edde1da4f232de337c2adf66c0f740cbd7cbbaf71a3f1
MD5 d6eca59c3b1829711dfaf4dd4f2e63db
BLAKE2b-256 f7544075eb5675de3f2080f75cf3f6490d211b1984050e8713a8b5014c8b11e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0af85d3d8fdeb0532fa9f6d1d2bba5dcba9f1519fdbfead8fef375f63cb6f067
MD5 04950fc1e4c8a424cd77cce0f64b7bfe
BLAKE2b-256 53bc4f1bddaee7df4b30a64eea2b2838d7d7635958fe356a2ca548a8d8210b11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 264975f8d6d3fb2e9616d555d57c9ede6a110e91da840c3f44a15332dc7018a6
MD5 65f8043ac9cb1f09db36f964722b4fc8
BLAKE2b-256 6670c8af12e4182beded98483f4dd9d6fb780c0ac26e9e3a907c63048b65fe6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 ae58af1a77a9bfcf499d0624947916b0452c93817b89dd59e4e2733615976dbc
MD5 3d56e42eeb29b036aefe5b8b441c9491
BLAKE2b-256 9cf2fef531839acf9548396f201cd51c0bbc8ac5d618280c7b93dd3204b7bdce

See more details on using hashes here.

File details

Details for the file zenroom-2.8.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.8.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 35e3547b524bc3f39253152a808887e7b007cbe8ae8f91c91467112c1e9c8948
MD5 f9d7e9075e89543831a297bff2a4aeeb
BLAKE2b-256 52b351d9e2a35da583f6b76a31aaeb1663e3bc157727dec138e38f9138d6355b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f12723b580ed500a060206ae9b695a0ce8b05b784b08c0fddda7995c7b76ff20
MD5 36d9e5bf2565e420936c650ec44583b3
BLAKE2b-256 833552c8b1a7e71d1b113c386cf98c1f089dbf29105a48deac90dd6343d300f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 d6932d7a1adce2aec318281b859c173de34c04e7562e10a8bdd65a49e95fe91c
MD5 aacae0eae59d95e439e4b9e6e4a01288
BLAKE2b-256 0c5586e1d1db3e03455082967e3f0516e53602408432d359c10a141e2a17a33e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dff658c81d3ec8555ed3f2533e2247b5dd2aebfee10c65bad65945956dd873c5
MD5 e5d9e4b21bad38be6ad78c3631ecc158
BLAKE2b-256 a7d8bf2857d0e85c377e0a1a4cae26b471e91c97cf3aec35c0d4ccc4e7f3192a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.8.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 c3737ca50e760c89eadf1db3f0d1c94efa466e9f09ae96ba9d03f2d79d726d95
MD5 0bac1efc1715bd3b07f98428af50a741
BLAKE2b-256 8ca7a4b0bc79c6cfa2934280ea7843c5aa820e11fc8610e3eeb657bf8a5d4094

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