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

Uploaded Source

Built Distributions

zenroom-2.14.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.2-cp311-cp311-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.14.2-cp311-cp311-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.11

zenroom-2.14.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.2-cp310-cp310-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.14.2-cp310-cp310-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.10

zenroom-2.14.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.2-cp39-cp39-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.14.2-cp39-cp39-linux_armv7l.whl (877.7 kB view details)

Uploaded CPython 3.9

zenroom-2.14.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (916.7 kB view details)

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

zenroom-2.14.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (931.4 kB view details)

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

zenroom-2.14.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (861.2 kB view details)

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

zenroom-2.14.2-cp38-cp38-macosx_10_9_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.14.2-cp38-cp38-linux_armv7l.whl (877.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.14.2.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.14.2.tar.gz
Algorithm Hash digest
SHA256 7534930e912c66f58e1d7d48094439dbd624cfd81145676815d2bbabf2e6a896
MD5 d8b83d0f64f387d27422b90422ef10b8
BLAKE2b-256 1fbf3fbae8481e94a8e86ef06bfa2aca65848260f1614d35afd46cef968c0901

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 4ab4409beb471709d048fef5a2dd63f21bdd5a588736d95864eea177af99754e
MD5 ee7115a5bc06a6abf9fe6866870be3a9
BLAKE2b-256 0059c0cc89a8f2be22ca5a1d9a2a4067a8e1a6fd701f0c6d904f4e091dd1361d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 361cb310df810631046ee258d6e8d68c9fef68c484dc42474e68e4f7fc34a017
MD5 38aee4dc1f802ba04d9b19ea76bdd2bd
BLAKE2b-256 deab5ea0434ad916b42da07dc50e1b84dfe932991517ecb825ab3029385ddfaa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 921b1590711e98090a24d9e2d81621346ed91034eb4e533bd387b8c3947240e0
MD5 6c57e76775d55efe297a24f18b3495fb
BLAKE2b-256 c909bce9a373ecf5c6a488d99e0008e5bd69a957c0f46b1bbc9ee4b26a593456

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2b393f787109ba5e6f774f62edc9ce530b6471da52d3bea137db9fca71b47117
MD5 ef4ffe0c07fca06dcc474e0c62413977
BLAKE2b-256 99c60e38215d11a8a793e4755162861a077af692af8c26fd3fe48615a8bcb468

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 f77867374b713acad23aea6a4542c0724a1a67664766a5e53b04fc2346fb3c71
MD5 ce26c58c596b89c2a8364a049d820dff
BLAKE2b-256 24b7f8dba7fcb1b48d98d95a726c7ed6f2e9d24f365fa5ff0fb70785bc70faf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 5b2c6e5199c05033389c1fb854f9fcb5033f1479e5071b1b0d2bec803ce23481
MD5 b7b746416e716571758a286317b9e4bc
BLAKE2b-256 4b887a24d076cf7502f8af98d6ba8d0809bfb69eebb85109406224d3ff964ec7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b72e53a71436b15078d82d79562ca645c4aa31fa72052e588cb4096336ac0804
MD5 e7d549286f1b50a637d53d79baadaf10
BLAKE2b-256 2bb17be5fdc6fffbdd2c0b38441d36ed7467b03262904bbd38f5a5ea7c2cdf93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c376180665ffc795edb8d3f73e70e47719b6c1b3ca38cc37f42cf89a69ecbcf4
MD5 8cabc3398014af58ddc8662581bf6db8
BLAKE2b-256 5f3e11c6f94f28896275fd8b4368bdda297f25c7f88a99e350c0af101db61c92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 956b49a4d8be272a4ffec52dc96303789c5b37911b46490535aee3619bebe259
MD5 5c15bc139bbebb3bf01fe787111e03fd
BLAKE2b-256 1d9760d5ccf3f60bc57a11230660d1ea0f90c76ee0168b9eff488db9b1053ce4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 f54143aee61591f5f21ebd2fdf2186ddb7dd373464ca3e50fd2f1e8bac279b59
MD5 abf48cd94ef1cf797fef6ace419d2267
BLAKE2b-256 cb46bcdfff5cd3865bc583f816fc54b7bd4a23d62f91475a46f17b7106c0e459

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 1e6ac54a5872e44d409303c8504b07da2c95af78bfdd8de93906d24838c03fca
MD5 3f9044384063228adc8caefe62ee4499
BLAKE2b-256 ba09f66e71d42ed8e52c9ec06918c3cfcf412ea275b53ae28901b7435aaa57f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 857d49fd68912832e2ef1f81e7dfaef31156de42ebdb58d826c5d57c85fd4f4e
MD5 4d23eb93cef319866283ae26cc253906
BLAKE2b-256 ee28ed9cf58d56a002cf1bb220b30401a63983fc363193a66c1237203ccfd0aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 dff2f0aa8a8978c39acb7a8d38777b4b597d10df44e7af866963f07f47d9bd12
MD5 740b93cca623f5620d708414173c226a
BLAKE2b-256 792c3fe4d61d0d2e5c61357d52f307a6a13d664af5fe2999e22c036ad069b3e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d632f89e11a97482643085c560737b9e2fc90b604a7c398a22ee7b3efd5a3973
MD5 98790b40fd84525d43b68d9de531c7e2
BLAKE2b-256 e9d55e0df1ae6f200504414138e0018b3bdaed4aa1fa888c81dd257046e18a0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 ad7dea7a32e6607c396bcaf91246ad90a4851a3f8c9e3f49669a6c3e60c6933d
MD5 5af2797640cf5ff0406662d739e9623e
BLAKE2b-256 3d1480ec7d06bff473d1920695216b860ea610735e42392a751605545c0423d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 119015a4e68356f1445dc8c507b22e49fae837eec3ec2e8e3dc1e00d896b6a00
MD5 e8e82d42537ccaa7f04c8ce5fc0ac8e3
BLAKE2b-256 23a245dfe5071751394d02b0ebf88d1a7ad0afcf166b8f5fb796f18b6f10a72f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 0b8e3d6b0bc83023800a10c06cb0fca5f8b72853202722dd139806decdb16f17
MD5 70b9a1fac1b235a40d959cf4266f5370
BLAKE2b-256 46dbbd1ea5708e31fc1b7133e7542d7a3361f6cf4e4397c6a9e54fcefb0b63ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 adf4e507d698f0c3b8c5936b3ef00d9a024e0e55cfd4cdadae5753a772dc6f96
MD5 a868f8dfd7f496f83d2e94317e402d75
BLAKE2b-256 d66e4dd474194bb5008056da04277b99bc62c5c3b379d2be2409eedee31642cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 599a823d690501211b525655e9f3c43088753641013dba734f6b81d002b8d940
MD5 36f834b5f651cf709b314c31173e0af6
BLAKE2b-256 e35075b53e2dfe9b392d7e73bc5ab36316ec77a4b25c9108b06e4a210fdf7420

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.14.2-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 2268a02adde90df63a41d9969f3710eae0bbab1d04b416d6ffbac13d6b005466
MD5 fabb3b6700975e65e6de1a816684846f
BLAKE2b-256 1526d6f3a76803440c6777c2d9616b66d787f33b2de6e8cf5e88658c6256363f

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