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

Uploaded Source

Built Distributions

zenroom-2.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.11.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.0 kB view details)

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

zenroom-2.11.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.6 kB view details)

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

zenroom-2.11.0-cp311-cp311-macosx_10_9_x86_64.whl (778.5 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.11.0-cp311-cp311-linux_armv7l.whl (877.4 kB view details)

Uploaded CPython 3.11

zenroom-2.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.11.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.9 kB view details)

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

zenroom-2.11.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.6 kB view details)

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

zenroom-2.11.0-cp310-cp310-macosx_10_9_x86_64.whl (778.5 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.11.0-cp310-cp310-linux_armv7l.whl (877.4 kB view details)

Uploaded CPython 3.10

zenroom-2.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.4 kB view details)

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

zenroom-2.11.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.9 kB view details)

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

zenroom-2.11.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.6 kB view details)

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

zenroom-2.11.0-cp39-cp39-macosx_10_9_x86_64.whl (778.5 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.11.0-cp39-cp39-linux_armv7l.whl (877.4 kB view details)

Uploaded CPython 3.9

zenroom-2.11.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.5 kB view details)

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

zenroom-2.11.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (930.9 kB view details)

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

zenroom-2.11.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (860.6 kB view details)

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

zenroom-2.11.0-cp38-cp38-macosx_10_9_x86_64.whl (778.5 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.11.0-cp38-cp38-linux_armv7l.whl (877.0 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.11.0.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.11.0.tar.gz
Algorithm Hash digest
SHA256 72464efb9f90bff70d585774a1383cd891791a170d422efab1bba8db168eb28b
MD5 ae20e041cc92bd3c6e662315871b29e4
BLAKE2b-256 80d7ebdf76bc99084e9f16bc71954ef1a1d03873e3f1ce4c670e0197c9450d03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 4bcdb13868c7b1c4b6645d57f577b6190955dc99c270051ba724af69aac7255f
MD5 7b969f2a12ed9c55ece37ea12a0b5739
BLAKE2b-256 0db232b94a74135751b19f6c926e6b823f2b5f6b4e112f9c99839295f3c28382

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e520992dbf07e424702c4209762b4f2de68055b3cabf07a4a7987ec3a0358b2b
MD5 599f1e5566759613957da4c30b1d6198
BLAKE2b-256 ad954aab297fedd59826000cd75e64a0361c6145b1dde585e0d84eed8414b2d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 7b10db762457a422b9ceca619101a7d07a37b2939ac49c728cbc25fa7baff750
MD5 03b660b5406ef316611e2e2fd4ee7880
BLAKE2b-256 de7ee62abf6bd892280c8ecb6ea8b80acd71367b711e40db49eba22d736353e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 55d8d0a444ebded4061e705043606e7ac723d40ab3877fea24a70b028b268ca8
MD5 f2a217f65db09d0288e9981a428e773d
BLAKE2b-256 48a01932b14ba278e0fea884dfda29e489cf62024a74d963bf204e4382066d82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 c8e153f40c7e8fba9df88e716ea2bf425562ef3ca9e1ed6fc7e02bbb91e39f08
MD5 812aadedbbb2c5cbdafe5af9bc44ca3c
BLAKE2b-256 71cf47500f58b3359409f7853add5e5e122ecf37bfeba15cdbd1a0cf96c16099

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 04ce28f176be644ddb4f41988b653b5f9072e3d7d60d4dae16bd4e73212e3827
MD5 1940c48a093d76c020cfa026e68d2bfb
BLAKE2b-256 2ce14cc4321fb377b7b6e8b8772c61fa386a7eb2cbb179baf0b39d01cec073cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 9fcbc8fb3bc3ad10c6d99b09f32521c60abe2b36f41d22dcf121f7be47499a70
MD5 94de9191f2136a945e7f9d9b4a287baf
BLAKE2b-256 612b5b1e006043db27d280f554d2a48a8022dcf218a1d3e1f9434fcd50fbf616

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 08bf2f885841e86d247143d545a18892248fc8d17300c3dc26007915e41a231d
MD5 37ad6f746104899f4fd5117a1658250e
BLAKE2b-256 b51f69ad52665becdc013a483004ab48d634eef99a66ef5595c6144e5ee8f122

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 988c2ed1303d26bdb2804be7d53710d3a43c0129f5692df951b5c9780e13b778
MD5 688de82b44f366f3f047a694f5558609
BLAKE2b-256 8c1c84292d7dbbce2db717e701d6c659b9462faeb577eb56a5a6a49a4ac14460

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 8c156cf3a396657f25d38c1524420960b1fc7c988cd908aa980bd162634991a9
MD5 30d4b600e17c02af913dc7d6876a7a9a
BLAKE2b-256 8fb8da06b373e9af398509545858d40c0441abe46f5cb68dc00b9fee962527bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 408ee7f5a870cbc450b4355e809a8f542f1e7b58977a3f53934f719455366704
MD5 b3523efe694d55cf8cfbc4ce0f1ef5b2
BLAKE2b-256 b1673af5fde9513d3e881b15ed071d9c9cc4cc7d8704b8e55ee3e55c46342403

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 93c86b9066dce010cf21d45d892b34c93718431dca130ea02afe87097d4387f7
MD5 b20f4320e8a15c1b519b6c202e74d063
BLAKE2b-256 a76c8c95a47ee54fc8754c9555547a0a169a48cf40f86ccf10440d31ac0c34e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 080c992ecda14d9b3d9f44e3025a8c7a3e7966564021398afcb8c191239904b0
MD5 d028867f3920b2dd5093e7b6ef90cacd
BLAKE2b-256 e8c5928e413220bcda10c3e9ad4855f59b4db7ad9a3e29b57e5cf77d6bdf1c90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4f1d2320474f873a9a86003dad40bb06bb4aa3977c7c6bddfafcefbd5afd76e9
MD5 8aa86a942ce8e1630972d44b4e31e101
BLAKE2b-256 84e4a65b2c6948bf7d2655b83a18c36eec24ee43622babdd75d454d6c27ce4c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 41874cc988e0cd2eafa174ae30417640eab3f15e740d2ceffe5f900a7ea64ec4
MD5 4b2e261d925e49eed1c871adc39f936f
BLAKE2b-256 1e65a1a78ea9c19e26df43668eaf19a3e5219afc643e3518296af94084407ba2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f391fc480605d2c5a078243e0f4ae0e181044ef35f53318b58af9e83eb3bc4b0
MD5 587226ff722ad3c03da09d5435c732bb
BLAKE2b-256 4d95cf9b0fa6db67f1e24d6def76c951f9f1378f8aa13ea80577218d965e5bf0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 52ebb64c53ab4d1168165a7b537b29fc58ce54ec9f363aae4e0cc61f4d201e58
MD5 df4ae95da22ff7ac7e51e3c3318f73c1
BLAKE2b-256 906a7f2b3f4798dcdf3f06199db01c3a9ab2dd4c0d4ed5ce8f3699b7e1f28c0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 9723909bf114712d365f09c03c64d8ca1a301dd00a1b4d879fe0b6988bf3a594
MD5 9bb5b54c77594737ea401b8000eec19c
BLAKE2b-256 be27e4066d86f6ca63b57711bb6f029ad99c55238db2cf96179225c8feee7876

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9ed7e48a861bed429994d4fa8036d1db940950359aac38a485b6a4e58db795f6
MD5 45e664b37635e7d7ddd3a5dcc9dd3639
BLAKE2b-256 79cc58bf11f3372297efe1ecb3bed0a2d1ad3d51b5ac1e7d48eeee39c251d577

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.11.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 b59dfbf9e66c7fd1f11dcbd9069d3e3def894d6058910df193699329d807701b
MD5 c3b6c04712dcc9586812458ee5e7b0e4
BLAKE2b-256 0a911d4774970fd4b84509195e2671465f6c9b430a1c2294a918bb3d715a07d7

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