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

Uploaded Source

Built Distributions

zenroom-3.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.6 kB view details)

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

zenroom-3.1.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.9 kB view details)

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

zenroom-3.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (739.7 kB view details)

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

zenroom-3.1.0-cp311-cp311-macosx_10_9_x86_64.whl (648.4 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.1.0-cp311-cp311-linux_armv7l.whl (767.0 kB view details)

Uploaded CPython 3.11

zenroom-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.6 kB view details)

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

zenroom-3.1.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.9 kB view details)

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

zenroom-3.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (738.9 kB view details)

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

zenroom-3.1.0-cp310-cp310-macosx_10_9_x86_64.whl (648.4 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.1.0-cp310-cp310-linux_armv7l.whl (767.0 kB view details)

Uploaded CPython 3.10

zenroom-3.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.6 kB view details)

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

zenroom-3.1.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.9 kB view details)

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

zenroom-3.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (738.9 kB view details)

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

zenroom-3.1.0-cp39-cp39-macosx_10_9_x86_64.whl (648.4 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.1.0-cp39-cp39-linux_armv7l.whl (767.0 kB view details)

Uploaded CPython 3.9

zenroom-3.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (777.6 kB view details)

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

zenroom-3.1.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (787.9 kB view details)

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

zenroom-3.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (739.7 kB view details)

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

zenroom-3.1.0-cp38-cp38-macosx_10_9_x86_64.whl (648.4 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.1.0-cp38-cp38-linux_armv7l.whl (766.5 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.1.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.3

File hashes

Hashes for zenroom-3.1.0.tar.gz
Algorithm Hash digest
SHA256 449a9ef0dac2c345eaf7ff056499a21bd1f3871ba3d6125c02ded6b0333c58ba
MD5 1fb43dbc2d604873654308154bcdc2ee
BLAKE2b-256 bd13844b41b856f4e9537672b5d852ea25b5feed108743ca855a8a7d315cc8a8

See more details on using hashes here.

File details

Details for the file zenroom-3.1.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.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f15660e4fb7ee86d495d882fd7af5fe26659c8a41a9dde2c42bd949adf592d1a
MD5 3c40891a41a74344420e80c8fbd2d723
BLAKE2b-256 3df94a70571e982622af452f7dea1a657e8ded5dfadb8516842e39e0eb28db84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 e4178726c4b19dd4c275031949e68395e3c2d761ed377cd6036239c5a44a2de4
MD5 47434ba0706a88130101676846505b1f
BLAKE2b-256 0620614f9dcd56d3c6774a02d93a1dcb6005146cf3791cb720d0513ba1de342b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 390e39f793534e598bc81f5e4dcbfbef30258fdfa7f8a67cef23d91e3a77ce63
MD5 3ecf833d1d985e943d538838560613d6
BLAKE2b-256 c358bb5dad79d1406ca255776892d28bbdc0e1f4ae942fe2e56b6bd83428073d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 10ab4b55708607c7b4eb9af41b8ce89a31fceb1549b451bca45ac3c2f752b0c4
MD5 fd0420b7ab761ae85fe3bb17bab09d81
BLAKE2b-256 efd3e015c1dcaad164deb7cc128bbbbce8b4bb80dfe75acaf17afe34be683b26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 0b5a3482fcabda62ae9a3a1387d22be2568f2e1fe58f3f76583a4dc661519158
MD5 0c97f0fb559b69e6ed27a239e42cfa0e
BLAKE2b-256 523792b1be4c6769497b6976cb17308819d8e868a415d2083f6eee2158cc333f

See more details on using hashes here.

File details

Details for the file zenroom-3.1.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.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c055f714749a1ba14e7574a2d8ac7d3f3acc51dc544954a2a259199fafcd7123
MD5 8174418c1c771db0ee7917f1641fda05
BLAKE2b-256 a119ad890eacfffbf1eeb7d3b2886652d6c0e167111ee9fb3cc3fd17b80d31fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 7dfdbc03441bc6dcad7e2a69468d260a7bfd47eacb9e691dfc79b3237bd7007a
MD5 684154359c486f51bd3ab5d0e9335233
BLAKE2b-256 d40bd4bc5085418f4eaf2c383dead63c67bafc1425f9ed468633f4a4eede573b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 c351a9b4649f8bb8b24b0e42880a320c52f89c3c3913cad9719f2ae34ecabd28
MD5 e8c36dfec4991cf47be0c81d43475120
BLAKE2b-256 9c3fc88e13d91c9d2ea19acf5a02dbf83b58b5e4aaf1f9e4f08cee184f4ed0a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ec265ab2810ac1780ff03c2dc1cf3c8f81bf66db9ffc4e494efbc5bea348ff65
MD5 ecf01b7587907959694e638c33eaafb0
BLAKE2b-256 251f1ce36ca98566f45aea8bafcf53da9b34fb549cff039aa6066878763af185

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 663c5fb8263932a5a46e11707a789f0991f30ff2cb131e826e2ea5984304c5ca
MD5 c33e609027f0631ce66f1cd22b6a1d4f
BLAKE2b-256 7f762936c2a708c7e601f6ff442d6bd8841b9c61b1ed9dbe0d970b7747f06e47

See more details on using hashes here.

File details

Details for the file zenroom-3.1.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.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 71b1c44d9beb3d18f509d20ec4eae5e652c97f1d6a2907500c2a2b777d43a9de
MD5 7e3625fd0af24f8691d0f72bd9ee279f
BLAKE2b-256 0410ae12f67fe25d8c62d1b5383a8dc6322f0841d2a7ded55d5d210e0717a841

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c84bcc371ed1517cca830c4fbd5891d44864fde490cfc0182ef2847b090c53c9
MD5 36c072da9b7788e50fa226593e752916
BLAKE2b-256 e1526a6c3eccaccaff11c3982a8e20a05db499762cf826cc4d760bb67cea15c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 1dbdd6b7009799682a7fed2acc4b865ed9f30623f895e0c49112457b8bf3fe6e
MD5 25160bfe2ac67f297dd25c74d047b6b8
BLAKE2b-256 26063fcbba36443211321714b58b83ebe0cfc476c8cb2e107289ff365ec5889a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fb7ecde0a403b866affaff792034660e8b29a307010927796d306de198821b9f
MD5 06e0bb07cb9415db4ec9c875d1a588cc
BLAKE2b-256 88debee600b94ee4e9e25808bfe586f5ab7ba6d0e89cecfa5bd07b8743383770

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 1fcc5612eada2e22ec71a1fdbb1d7dfa1ceb7604b46c7e2514239c36a62052d6
MD5 f4b11f190090183b9417b67f39f60fac
BLAKE2b-256 c96ccfb443ad3aa00c19f2a3228b19ca88333f267e60f20c217418659ac13c31

See more details on using hashes here.

File details

Details for the file zenroom-3.1.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.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0e503ea9c483cbe179debc77400bfba608d732dab8e4b2fb3e6bcb132d4ad777
MD5 ad159b455ae7cc84c0699904438c37dc
BLAKE2b-256 cf73a8416697cf5ae1ccfe69f068d0eb7096e51af3c2b98a3afdf98bd176e621

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 b753c8baefbbb5a1843ec99ec4163f6a8ff3c9d7892b8dec881a6ead9adf79e5
MD5 4bce4bd0f3cc35482be22bc94c40e591
BLAKE2b-256 6acb73bbfe5a6b0a7f6398615ef45edbb212f68648954f80c32f6cbb3479c23e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 fa403a5af6b1a4317e43f63d73ffe719941ebc1db950f46686f30f4704627718
MD5 a3ac50443aef89457bb200646374ec1e
BLAKE2b-256 6bbb0a361c5e92db2302d5b99e8a57fc7f28af79823121cbb462a687eb7d5084

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8c4142aea15e7e7fc0d206a508da44f22827f0f463a21613fd48883e3e2f0d49
MD5 3017ba4a4a5f0dca0166f6a7d58afb85
BLAKE2b-256 fe1d54340ec41992bf2a5d8c261ed9f7b8381fed4238e10f6d046942bfe09837

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.1.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 4907dad1c12ad2ecd41ce1bf177351147d5007967b7e2af10391e455cd7dbf4f
MD5 7b281b5c2610666b0e3bdfabfe7c02d8
BLAKE2b-256 8832d9be788978be2bede2e83d5f9e0277d060abbab3e5286070e7ec7b3692f6

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