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

Uploaded Source

Built Distributions

zenroom-2.20.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.9 kB view details)

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

zenroom-2.20.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.1 kB view details)

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

zenroom-2.20.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.1 kB view details)

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

zenroom-2.20.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.20.0-cp311-cp311-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.11

zenroom-2.20.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (917.0 kB view details)

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

zenroom-2.20.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.1 kB view details)

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

zenroom-2.20.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.1 kB view details)

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

zenroom-2.20.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.20.0-cp310-cp310-linux_armv7l.whl (878.6 kB view details)

Uploaded CPython 3.10

zenroom-2.20.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.9 kB view details)

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

zenroom-2.20.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.1 kB view details)

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

zenroom-2.20.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.1 kB view details)

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

zenroom-2.20.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.20.0-cp39-cp39-linux_armv7l.whl (878.1 kB view details)

Uploaded CPython 3.9

zenroom-2.20.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.9 kB view details)

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

zenroom-2.20.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.1 kB view details)

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

zenroom-2.20.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (862.1 kB view details)

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

zenroom-2.20.0-cp38-cp38-macosx_10_9_x86_64.whl (778.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.20.0-cp38-cp38-linux_armv7l.whl (878.2 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-2.20.0.tar.gz
Algorithm Hash digest
SHA256 f93e9f50f518ff7db20de2ae6a9ed9fc7cef9df4dceae2f931406a851f19c129
MD5 0047a9f69d1d54a1e58d5da09743b33b
BLAKE2b-256 770d3e7af26814c235c0d83e7b0c88861c869f3ea1239b5d983b89b7222a9def

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 4fbd82e14add498ddb187bcb663a215ecf26bed75df44a0591684f09048c8fd0
MD5 d9036c4db9a5ed95d7bc2e25e5989b4d
BLAKE2b-256 19d304411b17fc8b6d7723695f02a15cec03e33d019a179efe47c540835958df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 d512dc3b2d3038ce6e057f9927dd464ce7d75b74cace20c6b04a2db39367c858
MD5 210914ed3e1a95fba1632185c739b5b8
BLAKE2b-256 46dd3584ca9d12eadc4686404c8ef694aa56467deb703119a22616ceb12dad1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 28c1a14596fafed5cdfdf6805002025dae06a81131c16f61df4129c4f3cc5ddf
MD5 345d36657e68504c85996f6528caa839
BLAKE2b-256 1012c5eb8179dd1c576e95e4ee94180e811df8118b0c88ca254a2e2b187dfc4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a18da55b03572cca9f62863650f36d695e720d565daee85df68784a0c8cc58dd
MD5 babcf006ea54d24ea641b0f6250b2277
BLAKE2b-256 ed8ecda5cfe6039876d8b3183cc1c8b06adf8dd38762543e9a30bd634924d7fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 8207b540548261f10fdd3ce1f06b6a67a9ea2a0b63a270ad55fc3343eb7e4cec
MD5 c2bd7211147a1e35af409f124abfa9f6
BLAKE2b-256 f09b33a0f7568e723fd3936cd43eaa97d4c72393cc40ae80e0e4d4a38c186cf7

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 048e987682474a86ab92fb61ea685a17d20550bd1d833e56b9b6a97ee70540b1
MD5 1584fc4579b33edf90c9b39d996a7565
BLAKE2b-256 1c83272533be327d32a5862ee42dfe724c2f4f7954ed838901e649d3b4ad5a79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2d45d49ddd1142c03923ec1de89600a2140a9a354f9f7dc0c1f85afbc802494a
MD5 3057a7cf542a0d9d9127216c7066172a
BLAKE2b-256 55ad10a33e3ac5c1dd07e618293e1f0eda818bc043e9dbbe8036e4e8a0a73d73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 1e825f5832417e57df7582149b09ecc88324b2dd3a9b3a8f9272f4f924b8978d
MD5 c63abb85ad5b5bdb34f3a53912992efa
BLAKE2b-256 294053b1141987284c54a91dfcfa9640f120e16c6409a6e22f37e8d06be43e39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9db3a1b321a18b95a7b226a093ca7be55ec043ea32633747d7749cee5bde65e7
MD5 e29f1505004b5150f2eda7f5cb43e103
BLAKE2b-256 fa9e47ea4c253bc100fd63d2a0dba1d4280bb696cd111be5717c13f6875bcc48

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 21501ccb1cb6c5e8b5076db633bf812a1f78cf19d923bf21e349087fec92cb29
MD5 57a6bf9c236dcfe50c023fc441693ec5
BLAKE2b-256 1e9630725ba7496b3cb8a6a585814507b382f022870246ada4ba5be72a477255

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 10fce81d4e8327ff0553c5cbf0880bb87f44c09acedefa9cd5bee5bf5afe3ea0
MD5 9cce66033ce95701a61af11553a66cdf
BLAKE2b-256 aa59e4106c6501adc4e1c73ef5b201c560c9f40b44897a6da922bddeac941cba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e38b61071c9f8252f68afec8ba85271c57b7128b7bf0d389a6576a95560cb3c4
MD5 7dc9a3ddb446f03234ec0a3ae1b2fcd8
BLAKE2b-256 4161028a884879b6ce7cc1ccfe8f84fceab1157be71a4edca2379f3330aa6acb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 acecb937fdc3a2a4b7f23d2d580def55491ba47c84cdb063ae879d7cdbfe9e1f
MD5 4ec99ff63b93e1ec5ac3897a13684b7a
BLAKE2b-256 f4de1180a099c599b7af1da3331d0e7fc022dde1b056fd5db36bebd1729124d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 449f9d5d33940004410186d65febeb8f67f8ab0f8fbaa9e2589fdaec9c222a66
MD5 fee48f1d7fc469e447b724636dfe4c0a
BLAKE2b-256 91fb7bd554d40b59d2f80fa398ee0ebda4c34bd51fb7329b9864756c59a0b41c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 d228ede0059f9c59681417e9262382879bf3a9c0905c8b41c090786f858c14af
MD5 cf1b085c46b9967379d32058dac406fc
BLAKE2b-256 61d155b7144144bcc019e789c32ac49f8420025c646d847e91f44c0fe50addcf

See more details on using hashes here.

File details

Details for the file zenroom-2.20.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.20.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 939c46fe61a3fab5c80ce5021031db7b503561ca9012c952b3a3d05e24fe543d
MD5 44b0e16095bdd6da7969f9e37f31cfb0
BLAKE2b-256 59d9dac40a3323fababf535394bb873cd8d20b7ddcffc89fa20b309faec3776e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 8e19fac9578b9f340171e3e25253487083a57721f041b8f61e9b0a965118c6d0
MD5 4d69e0c76123076ba5b88fea4390214d
BLAKE2b-256 aad96f62912dd926fea56df74bb14839ced440147a68a2133a210891bf1870ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 814e53566c112f98c274ef8511adad0fd9d6c840ea44ec89fb0cc87419d7a6d1
MD5 57f9780121921842fefafa08955588a9
BLAKE2b-256 774f0c5eaffa3df5f557579539c23d6298ee1c5f8d13692466f94a56bc7c829f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5eaefa40adcea3638d237cfc99f68d672f513082c47ba6f7abc9108b7ed0db01
MD5 a9d2e598ca302f7a3755015c1350448e
BLAKE2b-256 547a03c11145823195843be8711cb2cf894f4e7b1d4dd6cbe0f23c533d17fdf3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.20.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 1181210982666dc1b5a797d53add4386f0994e13c94af447a474675dcab2ee51
MD5 cc81e4df88ac27b9c27cee5b173f250d
BLAKE2b-256 7ee5a6fa6be66b7ac1ea4c1313ea3f0da95ba17152d6d9e22692986a13987fc8

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