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

Uploaded Source

Built Distributions

zenroom-3.13.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.9 kB view details)

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

zenroom-3.13.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (806.7 kB view details)

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

zenroom-3.13.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.13.2-cp311-cp311-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.13.2-cp311-cp311-linux_armv7l.whl (784.5 kB view details)

Uploaded CPython 3.11

zenroom-3.13.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.9 kB view details)

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

zenroom-3.13.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (806.7 kB view details)

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

zenroom-3.13.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.13.2-cp310-cp310-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.13.2-cp310-cp310-linux_armv7l.whl (784.5 kB view details)

Uploaded CPython 3.10

zenroom-3.13.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.9 kB view details)

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

zenroom-3.13.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (806.7 kB view details)

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

zenroom-3.13.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.13.2-cp39-cp39-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.13.2-cp39-cp39-linux_armv7l.whl (784.5 kB view details)

Uploaded CPython 3.9

zenroom-3.13.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (796.9 kB view details)

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

zenroom-3.13.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (806.7 kB view details)

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

zenroom-3.13.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (755.1 kB view details)

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

zenroom-3.13.2-cp38-cp38-macosx_10_9_x86_64.whl (661.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.13.2-cp38-cp38-linux_armv7l.whl (784.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.13.2.tar.gz
Algorithm Hash digest
SHA256 2ceaf506e53d3d3ec56c4c103dbef612bc8867ae9cba59ee272b10eb74ed29bb
MD5 dac05233e612c9194b3c00b0d7c8ba46
BLAKE2b-256 c76057a1287082026f2fa7425bf463f908c5a14a65d3e3f3df8d0ddb4cd17d09

See more details on using hashes here.

File details

Details for the file zenroom-3.13.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.13.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f1c52089a4f90b0d6e1a851d345848cdd81422cdbb0aef461120fa9d609ab5df
MD5 eedbe99a7b38216817e683822e268669
BLAKE2b-256 9db5c1702e19f9e3426985aa07d0ab6fbcc6767d3021a0018055bf3b26b9ef4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2db8a14145ede05d0f5f9eb1c96b244c3ab7d38508819c3287d8d06cc7c4052b
MD5 6d7da8f1cdbb3059b91a27a0507d88ed
BLAKE2b-256 f604e5247e7febe86e3259cc6f99d7fbcc562bf11c7ddbb806f15d97d1b85d92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 2c9945a74295e570233022aec052717c8c010fe5f02304da752fd79e63c61e41
MD5 b53f6f4f169e5fbd574a8c4e03472378
BLAKE2b-256 bafab224d4c866623c42e273104d0d56dc2b851125876ed57d2b74a5134ff5f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bc2656aca8f4a7f414665b51d321b28f9cdb553adf82a407b6804880f54815a4
MD5 f3dadebddf49c61f2c59803917469927
BLAKE2b-256 aae6f94aafe4881e170b808682eb8e04074b08d0cefc63adb547cacee0bc52aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 461a4399197377b193dd2cff5efe3d18aa643245585155fc64632442d6611016
MD5 22cc9dcba20eeab1ecd5e6deffdb8612
BLAKE2b-256 88f9567a661157b11f84131283846d6daa78004df9a4d0cfdc5d9c2e27eca148

See more details on using hashes here.

File details

Details for the file zenroom-3.13.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.13.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 578853390020b60818db0a3ae91853d1acad71c3983708b186104ac9c961096a
MD5 7d77a63a630a6b47f89dd8fa7838cba2
BLAKE2b-256 c6a119b6f9b7aca4899b9b4c3eb621a475ce746ca712e3be058a294a6214617e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 454a15de397a59e7b19225b36f40052a8e4dde9faeab9d9bb4bfcfd39b71c969
MD5 df276d416b02aff60342550ddd9fca7f
BLAKE2b-256 a509066d0febf16ab68c2342af84590558c4dfeddd8271983ef133170aa5e56a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 17b3f1429868b3b9af61354610529d510fcca6c1475be101dff6da8737a06cab
MD5 8cae5d54d558f6c4e6aea32ac301c095
BLAKE2b-256 c08e608c26988c414e1c6b9deca7ae70bc59110f544f5f15bea837caddf1c6ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e037c1b1b0cc6c3ce1e716f81c0d7a1c0d50b3c346020ea4427af16b572189b2
MD5 37ff58dd0bd4252fcc9df9058c340536
BLAKE2b-256 1421a6db9b0f293a92a7d35e28c4333ae37d50484837c95412fb880bd428d748

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 4c92d4d75822d9cc46d07ece8cc3196763c0249faa4e862e79f2eb8df9f9aa5a
MD5 0de6ea1bc4e8af4caaff659f11feeb40
BLAKE2b-256 ac515716c8e513d9b4b3d092c785f8aa2dd1d7408ca2e812b697aa28e5588084

See more details on using hashes here.

File details

Details for the file zenroom-3.13.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.13.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 33e7293dfed55e6697c45d2b73988a644a548d820c69e48b8a24219503105717
MD5 b64a4ce4d54db95617d7473704cf67ac
BLAKE2b-256 ac050490851b683df946ac2ff70334852b41fc4a7a5a63dbaef538d1d250cc86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d4409b0f1cf0099562b1e4e2dea84302877ca8e1297bdfadd81eb078fe2b63ef
MD5 40b00fee3b0aa5383eb8dc21008b4256
BLAKE2b-256 dad146a69d5b9ede5256773c293dab9e199d17847627123af099b6c413ca15b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 715f768c010787be64728f1c01c1e4359b04c5086ff65f64b00781181116de6d
MD5 47f2eb49c05a7aa548b4c4b95b8edab9
BLAKE2b-256 fd2a6d85fdb981210dcdb5464ebeda2f42c5295be657a0381a9b496cdeaf2ba2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 00298bb32a076f96cb570476fa9e470d1b0189eab783c3bc28511df8b64cf76e
MD5 8742d7b54bef2f2a03f4b1e6764582ed
BLAKE2b-256 8e96cf38d9651e3a9f94b8ad25ffab3ad4312725f3eb50e25308a4e0205e1918

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 4460a86901f02d026691b9c59609dd9ba8bfd99a8578a0fe9638359b614b0e86
MD5 c078788d7f1695a12d0c8c63afe78d14
BLAKE2b-256 e579fcc849e9e8c81755f7d9e309c22e60e53437b0253bfcb4c024bbc129dc90

See more details on using hashes here.

File details

Details for the file zenroom-3.13.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for zenroom-3.13.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 ac5f4a80f4ab1b1c546fb5c9e5d9415d58a6581606b979c2d1b66989cca978f9
MD5 c50a5e41f8bfbf08c5eb175d3d8e958f
BLAKE2b-256 770339c6338fbcce306e53abd44ab9ec7189f688003d408ac4576d4a937b9aad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 11522a17dad723533fc35892ebcb60f5a221aa0afe654ec3fcff498170a2f2ce
MD5 d44c1778e19288181be86138e2e3721a
BLAKE2b-256 ee2d1b3a874152476f1346ea01627cb755cddf3bef7c17ad3904e810c0914ae6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 94fe74a9dbe6fb3d2127d60677e9d7c72e90f0221efa525a60846a3bbda8a5f0
MD5 7e7fcf44dacf3ee722633a253dfe107f
BLAKE2b-256 cc5824c16325753a3180ba47687968c0fcacb01df8b4c2d35fb187a1481640fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6c82709e97cf2411ff24230577b13de86a2841e654781b80eb7f5ed19cf339c8
MD5 cdb6cc1fe00f36f54067a2073e1e663a
BLAKE2b-256 fd7c03239b7bdf3298b3471403d3174b8ddb1c92724ccf281bcd77bc8487c15a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.13.2-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 b7af29f954ab3d299cb0543d5eab7d6ebd4d64aaeeccf920019bf9168140e41e
MD5 6f4ecee6e401104ddabe38aca016f987
BLAKE2b-256 1bb5dbc0966488262c9a4c0790b2123312a119bc8eac2aab0d780e022ce7ae7d

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