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.3-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.16.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.9 kB view details)

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

zenroom-2.16.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.7 kB view details)

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

zenroom-2.16.3-cp311-cp311-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.16.3-cp311-cp311-linux_armv7l.whl (876.8 kB view details)

Uploaded CPython 3.11

zenroom-2.16.3-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.16.3-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.9 kB view details)

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

zenroom-2.16.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.7 kB view details)

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

zenroom-2.16.3-cp310-cp310-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.16.3-cp310-cp310-linux_armv7l.whl (876.8 kB view details)

Uploaded CPython 3.10

zenroom-2.16.3-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.16.3-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.9 kB view details)

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

zenroom-2.16.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.7 kB view details)

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

zenroom-2.16.3-cp39-cp39-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.16.3-cp39-cp39-linux_armv7l.whl (876.8 kB view details)

Uploaded CPython 3.9

zenroom-2.16.3-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.16.3-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (929.9 kB view details)

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

zenroom-2.16.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.7 kB view details)

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

zenroom-2.16.3-cp38-cp38-macosx_10_9_x86_64.whl (778.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.16.3-cp38-cp38-linux_armv7l.whl (876.4 kB view details)

Uploaded CPython 3.8

File details

Details for the file zenroom-2.16.3-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.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 1bbc0d37244fa287edf74066de83d3eac2ad4ac87aa4937e73991e1d9bd3adea
MD5 874e64f0bd00148630600d2d412b06e2
BLAKE2b-256 cae2d4fc521db1c02330af4fc3d9c1f556f16d118391b1c27cd8ee2ee5916cb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9fb438a21653347282c860ebe7ad3f7f1861899f3d68f38b2925873edebce0eb
MD5 be30c78f0c1b6046b53cb484daffd34f
BLAKE2b-256 7c5b0448f58dad0fbd78a0fc48ebbc685f430ec79d1577caaaf5dc82aafc06b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 a4ed42594b83f5b0d1d127d2d42fd150b0f94075d0c367b34fda924dd5dd9b8d
MD5 860f28c2b4ef1d5c654858451b1f8a8c
BLAKE2b-256 b7d2745a928b689f2cc12d7bdec2b200bac2b97ab9792d0c2341f41b4d6f5d13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4699837152a5f7cd3edc038e3bbbb99f341d9a084284866028c181e24112b891
MD5 c5ba1260fa15de65a60f37ead84a40a1
BLAKE2b-256 99a3d8db3ee3c296addbb55f635afdd1b488d6baf571b54e4368001ac85b5a1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 df79a5dd04b366b691439d311dc4b12e8fc0d51a9133e184fb52e59cd0400110
MD5 3e503a1f8343309ab58f8c59b1f29168
BLAKE2b-256 70e8a57d3a1e2c0c441ceaa470218117486a81d23d90371c03dbeb52698888ea

See more details on using hashes here.

File details

Details for the file zenroom-2.16.3-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.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f25701a47acc49191800e435a6b94f50771282dba5b37cc75225a5cf12da10f4
MD5 882c3365437338edf82135d0c538a143
BLAKE2b-256 e80fe1d88818609cec3a0b86da5f2ea97098b470c30df46a0ff372a15e1aefa4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 24af38c51ef9accaf5d1bbfd007de13fb5f79485cdd1cf553c23b93125c820eb
MD5 f233d63d9fecd0f9a36c97feedfdba1f
BLAKE2b-256 ee2b9384f03cc58e8b64f00d5df1d2b8a97a8f711057c26e57ad6569e4db94d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 711e5b6e414c894de7209e7203ea217dc58bdf30e530ad49fdd777fea0bb3bbd
MD5 e237455276e62187d305afb394d4e085
BLAKE2b-256 4672789d99139aa427efa580e9da34e1de1eac3b7d214bb10caf76319dafc6d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 95ec3b9635492234b79cefa1283b7d6f44b42f15b90a5bd43753ab5970ed47b1
MD5 713ed826380457beb55d263ccbabb17f
BLAKE2b-256 32915aa548472cdc131d6f484850403e5f3574c493e0416abf253fed9e7d03c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 a8f1b7c7d7dc815fa2705bda3c02c188c2a07b9858892c1ee70571337c915dcd
MD5 7819c2fe4d75623b31b1074f7402aea8
BLAKE2b-256 176f310d12cedca0e6ea601d4f530380fbb23a53ee078d07c0470d7ab3e45188

See more details on using hashes here.

File details

Details for the file zenroom-2.16.3-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.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 6a28d6f5ffc50e19f5b26b599ac5fbb07112e118c6d8b81cd02d5f829b1893a1
MD5 f35b9242711f31128782c984f76712f4
BLAKE2b-256 6267e58f13741094dcbdcfd4cefcee7b56b1e3e93cebb7534c59f59ba9eff497

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f6210844ae3d62834519667edd80ce6872d34f623a513203a88483e7f4bd9b7b
MD5 daf1a3b82bd462acfd11edfcd99cd66d
BLAKE2b-256 63977fedd4b45a2b894b396e59f0cc3266f6880abb5ab9c34389cd7cad96d8ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 8d36f5e496eeccb9e4f2774bc47cd18d562c0ed0010ec06fbdbc2f559a43a085
MD5 971a39cf53c03150a84a07b25174a458
BLAKE2b-256 eff29c642fef627df583ee8bd3deabc90e70d811650527c0aba8f9d166ec5960

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e371a7ffb6eed4e2ed73042cbcd4e89c155079171295e84945a719bcc41ea2cf
MD5 08fc54bd1aece3f18996afafe6b652ee
BLAKE2b-256 3d1728a734e929b27fc08825be1ae8544b95b01b9395079cf16320b9ed099ba4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 1f2d928a7fcedf8667c891a9d27a04d8569d2c8a925d81680f76da5d90990be0
MD5 92cfb86256b1a08daf67e47a59acf12e
BLAKE2b-256 2dc5f571c3338dbf45e78a128cd317f50ed6960d1fabe0e43113d57828beff8a

See more details on using hashes here.

File details

Details for the file zenroom-2.16.3-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.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e70fd75ae1661d2da94c5b522899ac387d07f37823d6f6cc3d2bf0c3d6e8bb03
MD5 7fbd40aebbea018bebf387d12739858b
BLAKE2b-256 5730119b5fa3553b717649049ecff45380c9729493a8c1643e49cff80c5d521a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c3ad91f5715a130917e55d443224e2a2f330905f481b77b59d14dd795e4de05c
MD5 23f83b13d5e221030e85b80a122329f8
BLAKE2b-256 15f4888adf3aa5effee31cf4ecbe5ea075b91a18edc944ba0bb40906ba47abf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 9138eb8cbbef3fdc677e4e7030f0ac947b56c6710bd9f1cd6c9735130ba3e52d
MD5 ab890489377b86fef5d9e3254aaf61fb
BLAKE2b-256 181eb8a8bb2f1175187075deddc6bd00f5e971668444b562a49036b9a26fdfae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 88c3f345455e35b0a8dfe8d2c403888c2e7d7902e651867c3a437679df88564d
MD5 c5363d697d340755239beb5ba3107240
BLAKE2b-256 7b7be6a44e7f05fe507714883d8038c9d28c7a043cc65256c5d41625ac5c7479

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.16.3-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 b52c6636bcfa6d98b8559ca1d2786cce282e84d96cd869efabcbed5bfc172def
MD5 ba94075d6a8542c4f92bf03803544c22
BLAKE2b-256 29d60b33e3ea0e2173e1d177ccbb457ac51a57639a291ab26b6860e5f6a4eff7

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