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

Uploaded Source

Built Distributions

zenroom-3.17.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.9 kB view details)

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

zenroom-3.17.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.9 kB view details)

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

zenroom-3.17.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.6 kB view details)

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

zenroom-3.17.1-cp311-cp311-macosx_10_9_x86_64.whl (680.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.17.1-cp311-cp311-linux_armv7l.whl (788.1 kB view details)

Uploaded CPython 3.11

zenroom-3.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.9 kB view details)

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

zenroom-3.17.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.9 kB view details)

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

zenroom-3.17.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.6 kB view details)

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

zenroom-3.17.1-cp310-cp310-macosx_10_9_x86_64.whl (680.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.17.1-cp310-cp310-linux_armv7l.whl (788.1 kB view details)

Uploaded CPython 3.10

zenroom-3.17.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.9 kB view details)

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

zenroom-3.17.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.9 kB view details)

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

zenroom-3.17.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.6 kB view details)

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

zenroom-3.17.1-cp39-cp39-macosx_10_9_x86_64.whl (680.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.17.1-cp39-cp39-linux_armv7l.whl (788.1 kB view details)

Uploaded CPython 3.9

zenroom-3.17.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.9 kB view details)

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

zenroom-3.17.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.9 kB view details)

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

zenroom-3.17.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.6 kB view details)

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

zenroom-3.17.1-cp38-cp38-macosx_10_9_x86_64.whl (680.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.17.1-cp38-cp38-linux_armv7l.whl (787.5 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.17.1.tar.gz
Algorithm Hash digest
SHA256 6815e26883078647bdaeb17ddcf81f666c27b0ad80d6d1cacea4d2c0cb505cc9
MD5 308cf2b90fb56a0d1475a2f2ab6f14d3
BLAKE2b-256 31be61e6b12ab7122359b7b94e0f4253f566bcdd4ab50da050a20901ce4ac2ae

See more details on using hashes here.

File details

Details for the file zenroom-3.17.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.17.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 07f720f61e3b5aeba49dbe332778225d2d7268ebb5257cdc376009df676eb92c
MD5 2e8a2dd3adee612e0ecb6283092bb754
BLAKE2b-256 211da116a0c3622af5e8f627a7ccb63634e1f0080261e8869091d566070469a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f01debbc61f5ca47beb41ad2407abc628f91bfcda0ec019ba4179b6069d420ad
MD5 b0584a8982e7a943db372d3153a57ca0
BLAKE2b-256 0170b1adef750593b0d5defc4d0c5903568b6626e48bfe4ff8c14930060f7e39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 99ca84a542a75996372069c1f2f58eafe78757377add61f1541d725eca938f4f
MD5 5a30b5dea3487ea179e396eba3586a4c
BLAKE2b-256 8402d59f2e8c3df39c19dde1ca5b5c1c793a518dce30583c5043966a50ee5a10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 498c9f3ce5c2ab99d3a91d955cd06583d86a1410cae062faddf61d78e35a1f46
MD5 600283c109af9b92e5cc76d650aebc3c
BLAKE2b-256 c46d68185c6ed88d5a3a15beb1fc4f6129caae04736bba2f32e632ffe0196787

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 3f825e96dac866dc18142f046665e7d9ebcd90adacd09a49c15d239e3f057ec8
MD5 87e9864892431f24d8813c759f3510d4
BLAKE2b-256 c2379dff3344981b4d370ba9938705c8069e91f01ab7dc82efe6795562505ed2

See more details on using hashes here.

File details

Details for the file zenroom-3.17.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.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 53ec7677461980ff228a6dcd2a56427ae25036bfefc1b0617c2238ea63d91a1b
MD5 63b55a799727196517b2ebace2f098bd
BLAKE2b-256 0beb5c815f6402bb101620985016bf7a8c468c91b6b8f853722fae0ac90d0dd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 328f970e2bd9162ce5c50cb7383153c7f2a793268ab02148b13d0d4c846995cf
MD5 1db6f8f6a30fe8d2ae56adf6b6e8730c
BLAKE2b-256 9b2bce3356291643b3eb077c9163f04a09f68214a4279ff28cfbbfdf8f0212a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 fe78d5cca39f8aedb91a03c48533c4aee34b7002493b4acde4d8b569a2b923c1
MD5 35c7421fdec6543c38be5add2bad6c46
BLAKE2b-256 e38f052a9c93cfce023609d21124803b68bc952de2950c085aab7f389231e5be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7e0b32e0f7bddd3e90a97dc31f7e93a7e69fe8f81167e8969e86b97fd8003e00
MD5 1982efb8ef1bbdb2ced427b10723e7b8
BLAKE2b-256 2c1062a850668c1f7d2cc411ca95d519a68be5f76c6c43102feb71cd8386942b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 c3ba57c611ec74456994444e1e819f15ea92fb2ad14269c3503681d5f687695a
MD5 98f5290170609b4fdedec284ad608a50
BLAKE2b-256 da0442d9c553fac09d16e87f122a59eeb7b39706a8ce28497c418967864fef1a

See more details on using hashes here.

File details

Details for the file zenroom-3.17.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.17.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c3726d29d53fbf21414b28f93f5100434be1e369e396e1a8863ff75162e4554d
MD5 93539e34847d2a7a384095ff21ee9909
BLAKE2b-256 e61b3b13c8374ede38dd44ec4a1cb68c872ca6ee6b91dd66507426e75920a088

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 deba1c32b25d17b1555f250780562bcae17ede52f8df56ae84e1c3714cc2b6fb
MD5 b19db5b89ce613393c0bf428a0b2a4dd
BLAKE2b-256 ac2c26c9c8be40def05a8857539952b21fd51df1f1e337c65461c4777146b11e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 32d9dbe92c76952580f26a88c15283fa816299a09cb7744518e0a482a85387a1
MD5 046c5283701e1ca477d91b3bb39499a7
BLAKE2b-256 4619bd2dce0b2c044d181d8154eb93b1e5f6e7b760f905ed0b472e543d77f68b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1b30570f621856adac9b597250a06c4e3f66e7b001fbeb2ec41031d7121ec7cb
MD5 605bcd2e01fda315a28bf7ce6c9bbee4
BLAKE2b-256 9b083da6598f6e3cb8d81c0fa2a26dc178df95c6733d7de12a65395d622b3641

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 f2a64d602c5624ccd1bc0296e017c1d7bb05f6c176e5f9929147b34755f54856
MD5 eee15f9ddc6981d1e2ba590936802932
BLAKE2b-256 fca4bde4f89d56a63f74b366c04c8a6db3cdfde0768556e1fd71cff8491c88e5

See more details on using hashes here.

File details

Details for the file zenroom-3.17.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.17.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 afd98f2c9db053ff13b7f21363fad7b8b9cbb085015f9de1cdfad52dcef4e2b2
MD5 bab8e7f6707caca8b085ecd3b154e0aa
BLAKE2b-256 f885229869cc7799938e09eb676573ee78940aae4b300fbb5bdc76d398986ead

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f8096ce05f3dfd65b9cbeb6deb940cafc295638f2bc743b0cc406be73ddac1ea
MD5 8aaa3395ad7f07455d02c397382a1f00
BLAKE2b-256 2099661688a7dcfdcb1a5076f2d705432c3ebd40d142a8af0d4fb7b6d5efbdb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 a3b50922dff8a2cc19e43100a6e482fa5ef5d8622415ceac4f192eacc86f6ba8
MD5 6a659bb573ea3f674fca162a5389a517
BLAKE2b-256 1bd1fe8b6b874d97b2431dd1faaaddf5144c4a141c960cb485abe52e343d2ae0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 850481748c2e96eb85c338324ff0b13c1eecf7e5ea25a49694e6c8c266850015
MD5 227e6df7b72633238987ef893d436010
BLAKE2b-256 19daf31790b1715e8693c9da94833e774a8ccb9912a552352ad185817a2263bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.17.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 b46a58df65dc4e21a06008e97cddc8922671a9328e84ed167cd0a2d4503b5290
MD5 193ccb43391571c22c053ff38aa6ef99
BLAKE2b-256 0b81ce5048178e76cecf05d86d0814df65184f643adcd7b2867c7eb1e7156911

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