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

Uploaded Source

Built Distributions

zenroom-3.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.8 kB view details)

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

zenroom-3.11.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.1-cp311-cp311-macosx_10_9_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.11.1-cp311-cp311-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.11

zenroom-3.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.8 kB view details)

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

zenroom-3.11.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.1-cp310-cp310-macosx_10_9_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.11.1-cp310-cp310-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.10

zenroom-3.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.8 kB view details)

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

zenroom-3.11.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.1-cp39-cp39-macosx_10_9_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.11.1-cp39-cp39-linux_armv7l.whl (776.5 kB view details)

Uploaded CPython 3.9

zenroom-3.11.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (788.7 kB view details)

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

zenroom-3.11.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (796.8 kB view details)

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

zenroom-3.11.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (748.2 kB view details)

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

zenroom-3.11.1-cp38-cp38-macosx_10_9_x86_64.whl (654.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.11.1-cp38-cp38-linux_armv7l.whl (775.9 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.11.1.tar.gz
Algorithm Hash digest
SHA256 828f653257e0cf612a53a228235dc7d90945c89f4192a22886946379992d2619
MD5 78cf2a3bc3323260cd8c682f9b5a4bc9
BLAKE2b-256 9ef6054c68fb0fbd877e0658de368caae1c4b14c0230b56595b1ad9c6d59a563

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 59cd45269f111b24ee44f39131fdea2923dc3b03dae8489744364332d9a25b44
MD5 c3843a69d79434dfa45a8a6c2ae74e54
BLAKE2b-256 3bd82216c81e9a05f02888dc0b9c368e133c9c71b4db6c3ab6e2fd886f01cc8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 1d5ed6e10a9ed1310cb93c713cd837c8038fa3cf39067fa158d42744398e9599
MD5 ed0db441eb9424923b43de336b4c9eb8
BLAKE2b-256 f6443572c22ac67d8acfa43fdb3399764e4e2ebe0b5de6a8d5d0d297e88cb54a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 7c24a454a0030e5b3c2617d5a4a2b532b923fd45b32a86a5916b49bd0b14b3ad
MD5 68e9d20be7c6437b6e237aa9c5daf231
BLAKE2b-256 fefad4d4c78b75edc33b586e12807ec45ffed84f6118e2a2a172dd3d60684f27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bb3771e44e4eb1570211c9c6a4d7de85e2e87d43805aa2544a75ad1bd7845d07
MD5 6d16baacd8f7954bea3b04d43b652867
BLAKE2b-256 829f8fbf5da1a169e83d3e1daf5e974d7590c7ef55e32abb5909f5568e7d2ba7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 d776caa2530155d5ba21fc5c7ae00b7401e07887339978b0af987de6692ae195
MD5 9033e5487fd8f883882b61d7fd48febe
BLAKE2b-256 ab66e7a0a04c8ef85979bb7794ccf6bfde5a7b78104d16edffd1aa7a4ae75c9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 59af0339d12e501df826eae5e78870967c03ff032f737af000527835bacfe98f
MD5 b0ed5a721cbf4ee0970d1ce7f2223723
BLAKE2b-256 f739b0af820983c90c2ae51d543394d12df3e4157036fba4382a3958bd3b0e16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c81cca56f21d544f33f3a3b6bb8ac72b99b067774d8a3f9cde36d95f78b0c26d
MD5 5c16830576fb763ea7b4395e3c4f68e4
BLAKE2b-256 975c438890821510b4ed42b9847358bf446d153252fca1b39bea3bf2c3783c98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 954405f4fdfdb4d605c15a470cae148f182271dca6cf799d551ddda484a4d5da
MD5 6f4d316cece7e38754b87774b25e3012
BLAKE2b-256 205c8e70bfd1b3e60a64e7e6a403f39a8a06cba4fb55ccff6f1b704e3562f75c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 89386e20a65b240c72b751f386824e16c69ed96820ebdd3a517289ecd579bdb4
MD5 fd9f822578b05ca6d0509b536c737053
BLAKE2b-256 1270fc4a3f4dbd74c45053122a1b0cb3fdecdea40cdcfde39703f0bf8082fbf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 89053ab61369ae0161a94df76156a3d970acacf74b9e375be4cf74d9005c3550
MD5 a86fbdb31e8f95bcdfec887d29d6d759
BLAKE2b-256 72e2e6ec1573e2417d38d7d17bde08f621de1d2a6137a2a756f8d03c494fa587

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 703f541f974d085616f375423cfd339f65af219f32a7ae58783e573b9c8ac70f
MD5 2977ef37fc08f820d043f92853f58ea5
BLAKE2b-256 c3e935a43e249b3e9297d1a44a6c0f71036d9f99c13b68b8b9c2763fa47efadb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 6d8a8671d1af88d3868b971a3a303405bfcc1ac891689f96a54444c7973a27d3
MD5 eb85c42ba5f9a04b578b31f03306bd7e
BLAKE2b-256 1d0ac0e66ef68c6721523026d0aee1e02e75328ec4f5c6053e0803762a483652

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 65f8a0059eab1e5b19d803ca49d7c6d1ae83e96c446588e5d0531f2493bdd94f
MD5 adb3f114409e2b429b0ad230313799e2
BLAKE2b-256 1c6d6073ef2448a3c7d7353c1d6201703680546fa95d3417aeb4d8d5dc1d2161

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e5f82a8a16f0ef5b5424cacc21afa1b7eccc35c823fbdf844ba52200b03eb4e8
MD5 62bead64492d062a80361b8da128b414
BLAKE2b-256 4d1e82306ec88441053ac2e5c111514f123aafb266a08e7811ed334117469775

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 b4651313ccd3c47cd4d41356a328520fdea924a6d04efd63366736c335cd1b25
MD5 f7922446f59b1cb92e971c876d6d9f73
BLAKE2b-256 8bcf53a99b2a30971aa7b2c66a01fc877bfd1477c4e466dcc29bc406af7211a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c4364b0fb6c4243546a621a6fa0ebf570cfd24b56ea60c475dc1d18e693c0417
MD5 cc2dc7c1181d5fe4d6ee799a80f36ca3
BLAKE2b-256 33fe5b1fe7e07fdd1c084508cae1d9f6e75b69b2382ae7657fa417f888e05a9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 cf036ee06b8c68529f7cb1bbb4d7f9b3d001696ea0706566d28267f9466bf616
MD5 6ca0057d06e354ad5c035a753c4aa8ee
BLAKE2b-256 503e90e15f813f3f3369c15899c56bab318df211dcd88416d4c54e5fa05426ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 a5d80cad0015994351a53c7c55dd04eaf5e10dbc512d5cb410784dbab6217f9f
MD5 849ce92eb41f359c9f7ff2be03c063c1
BLAKE2b-256 75b391dad42f00a4ee70b1f760873e0c0b8204081fc8ad0c229046378355e015

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ad5fb31fe284da74cededf5c820f5a901818a8e805834024bdcd6cb326d40fa7
MD5 e703f36f31301bfaa9224e9139d1a9b5
BLAKE2b-256 4fa9438fcd482c03b8eb97876b59642c5be46454d1bb27ce90e9b0f65c78707c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.11.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 8b96ad7bd36acf2a2ce5e85b905d2d7a05f35ddbcae46b19885c9a06cea98b88
MD5 a608d4d0e106669a7cb39e46c5bc7062
BLAKE2b-256 aa11d3295944aced70a4b413d21089531dc2be70dcbeceddc5a049b6867babec

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