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

Uploaded Source

Built Distributions

zenroom-3.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.3 kB view details)

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

zenroom-3.5.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.2 kB view details)

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

zenroom-3.5.0-cp311-cp311-macosx_10_9_x86_64.whl (652.5 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.5.0-cp311-cp311-linux_armv7l.whl (775.4 kB view details)

Uploaded CPython 3.11

zenroom-3.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.5.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.3 kB view details)

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

zenroom-3.5.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.2 kB view details)

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

zenroom-3.5.0-cp310-cp310-macosx_10_9_x86_64.whl (652.5 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.5.0-cp310-cp310-linux_armv7l.whl (775.4 kB view details)

Uploaded CPython 3.10

zenroom-3.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.5.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.3 kB view details)

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

zenroom-3.5.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.2 kB view details)

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

zenroom-3.5.0-cp39-cp39-macosx_10_9_x86_64.whl (652.5 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.5.0-cp39-cp39-linux_armv7l.whl (775.4 kB view details)

Uploaded CPython 3.9

zenroom-3.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (787.7 kB view details)

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

zenroom-3.5.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (795.3 kB view details)

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

zenroom-3.5.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (747.2 kB view details)

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

zenroom-3.5.0-cp38-cp38-macosx_10_9_x86_64.whl (652.5 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.5.0-cp38-cp38-linux_armv7l.whl (774.8 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for zenroom-3.5.0.tar.gz
Algorithm Hash digest
SHA256 f6c03e777d232e81458ffa5deff23b9f94a6760743e8f8b52888ae4b9f359b19
MD5 4ac26bd3215e53df7dc4ec1d7dcc30a9
BLAKE2b-256 cba93cbbb56467478343af3d4aa0a97233c4de70aae6956ccbc402ed03e55082

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2e24bae08a349affb9a9150c803a5addad8dcefefdf09f91a6bf40adfb3f66c1
MD5 a1862538ced5b08130976a0578caca6e
BLAKE2b-256 beb307a2e5216a670997ba317f048b16d90a5588710faacdb2fe133fa0fa5549

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 92fe9d3813b39c163ef55fe6871177a7c18201bad07d4333e8b9e019a5f0d55c
MD5 a4d809e34fc58fd4178a4409d455f39c
BLAKE2b-256 74f2be6c12dbe94c6e04fbc0665f38d27690a9069bcc420c6caadc8d703a7cf8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 ed380e8b80d445c9132be907ba64657c484359cdb9e7b8f0f0dec6c43b1d98d5
MD5 aeb0ee7c24b4949f3533caa3c0a4e083
BLAKE2b-256 664e28a02f4220348fd8b32f4c1b535356726bacefdaa768e891f8b20404619c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 43332516e72293f056c04bce2c89432ea5237672ff16427416a16407d624a84b
MD5 47bec59f07657e47b672f85f6f340230
BLAKE2b-256 6cc588251eea2097c9f151c60bd4ce9a172a734fc5a13bfde6d6a86b8dc1738c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 382278dd2ad9ff4e945ae5322473d112e88216593b66e6bb4e0e1be93856c67a
MD5 43dbc4e4d6c0061fcc7fa907838c77aa
BLAKE2b-256 0f14597031d8a967e003635c69656e27a53090840d0eed5bf80dc91407a19ca4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c01f2f4482e67833ca8d1f8b16f8e22e02d8869b6fd972dc16a9fb5b3e4980bf
MD5 e5c525dd8a5de56b9368121269feaf1b
BLAKE2b-256 cc8679220595e6387df6ecc390102aa328cf077774bd1fc0abd430de44a55a55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 2f6411e91a664ff7ef356cba3174a5aa09f12c48cdadfb31d0a2d37a7af77ea7
MD5 b3fe27fca4c109f53021feb82ddfe8d7
BLAKE2b-256 29769c62ca62fd1c9bafca7e373032ebcdb6fc8dfbe765e945d4798f09669510

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 5c0765d29de6c78cf781b553d2300f0568a6bdc7987d51c8423847dbc2655281
MD5 f3ed1c170a4c6b03d7d6d6ee9fbc8366
BLAKE2b-256 fa0670f26347e9c225f0f53b8533677333499d7223aef292d783cf508545beb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ac4cdcbdba89e2f86fb4080e64cfb684452a2af7b67fe31f86f094b3b75ad085
MD5 fddf9d2df31572fd819e4b67f6919f08
BLAKE2b-256 1cb06d4d24beaa81a4f9ebe654c38b2aa83e3e22bdbdf60cd38107bb2905d025

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 041facf091568ed66c2f53fc0c6a09994c5eb8136b5aabf2a925fad482ba80e6
MD5 501ad70510483ac1c69775393349711d
BLAKE2b-256 df7938af2cc291bb61959d77e928b63f98b56d26358503e8bd45ec19f97ec002

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 85d0d48c2bf825e8c1f609f5d3458f36a7d781f63b173ae9fc91ab33faca719e
MD5 8497bf09c7dff703948c6604c089c94d
BLAKE2b-256 f7eef001a9efa95eb5eba7bdea5598bcd59662c6fa8dfebba6d85c0a8dc1b3dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 ede9a2a1d473382793dcbce4c66fe5ae39676b6e7506849aa0d28d18e28769fc
MD5 606432659d8b02fe98d42ce5072dd0f7
BLAKE2b-256 31656243dc5569f4351225002c86cfbdb7815c542f3559e6ee6d7c267290904d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 e1ee03e50293c1776938d01efaa1ed8201ee88910f36c15c4557b7fd03e825a8
MD5 670c482c90fff4377e636d1d690eecab
BLAKE2b-256 4b8b1c08a334804c4d4c20e261d4c56d222a547beb99146879954efed059d78d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 77044c48799fb9fa1570d721cc2fe33de9945faa171099f415ba0f13fb1df723
MD5 ce19935d39af656c3f554b07935b3e81
BLAKE2b-256 e5a068f8468adca0451de570e4bdb43ed482f9e22be054448115f92e723fad5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 7f20e545ab29378d5dbf6ce2664b18ca533c423fe6367346a7b004a63a2b4549
MD5 6bec9238330b4f51a4e857766becb484
BLAKE2b-256 ebc1b4c3b95d2665418713f6ef9eedff31034c3af0830b3b5defa96b8c8fa48c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3835dcac328d85178036a8d14161a7f5a2a8d48a548d3c96e0964bc03c079e4f
MD5 60bc4129e2aa25e2f804a8fdcf760280
BLAKE2b-256 9bfe21847ef3382b00466556268d5bff89621ac07a6309ac5b11f7cb82c58926

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c2b345ee99bb7a13f0baae817950a20a8d85f3126f19bce4fdc931f573822c93
MD5 582409075e4c524bc7a86c26af3e4af6
BLAKE2b-256 b4ee3b41445a398afcb656f09f26ec08101acec97bd41d4c7c3a6207ca8e3c79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 0f2c9ccf87f020f2a359e005c5b9bbf300dc66a3a254b2d32332a2a8a59da0ef
MD5 03da29944cd725105210036c9cf1aa02
BLAKE2b-256 a95394233e742cac666fc3ae27e476e2c43e19a2ac14b520df0a180bcf0a438c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8cdc5eec1bef35b7bc49e4b7ee081e95df3eccaee08ee944e87168abed23207e
MD5 9050a69019bbb47d061a42425695174c
BLAKE2b-256 8445e31cf9f6d6f21fa90e7abaa5e23d2953978c65e63a7fc1615432cd56331b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.5.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 dc9ec930d6ae324fde33c744c3a8df0db693027ca9226fcd0e46c580be2419b6
MD5 7ed43766581acf4d00d2620bd4f274a3
BLAKE2b-256 82cd686854593143e3a0e241d46e38b112900d88051be7e6ec4292634d7b6863

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