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

This version

2.1.0

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

Uploaded Source

Built Distributions

zenroom-2.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (903.6 kB view details)

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

zenroom-2.1.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (914.2 kB view details)

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

zenroom-2.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (846.0 kB view details)

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

zenroom-2.1.0-cp311-cp311-macosx_10_9_x86_64.whl (761.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-2.1.0-cp311-cp311-linux_armv7l.whl (854.8 kB view details)

Uploaded CPython 3.11

zenroom-2.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (903.6 kB view details)

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

zenroom-2.1.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (914.2 kB view details)

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

zenroom-2.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (846.0 kB view details)

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

zenroom-2.1.0-cp310-cp310-macosx_10_9_x86_64.whl (761.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-2.1.0-cp310-cp310-linux_armv7l.whl (854.8 kB view details)

Uploaded CPython 3.10

zenroom-2.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (903.6 kB view details)

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

zenroom-2.1.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (914.2 kB view details)

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

zenroom-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (846.0 kB view details)

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

zenroom-2.1.0-cp39-cp39-macosx_10_9_x86_64.whl (761.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-2.1.0-cp39-cp39-linux_armv7l.whl (854.8 kB view details)

Uploaded CPython 3.9

zenroom-2.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (903.6 kB view details)

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

zenroom-2.1.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (914.2 kB view details)

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

zenroom-2.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (846.0 kB view details)

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

zenroom-2.1.0-cp38-cp38-macosx_10_9_x86_64.whl (761.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-2.1.0-cp38-cp38-linux_armv7l.whl (854.6 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-2.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for zenroom-2.1.0.tar.gz
Algorithm Hash digest
SHA256 4ca1abf3aae2a0ae214de11b7a826061b592b068ca1dd4f9262d8da13feeaa79
MD5 4b1f90778eba4c394bbc12c33707a34c
BLAKE2b-256 6849e8bc93202261ee793c50f505879fc49d5f6f797ab26a509019db5206c8dd

See more details on using hashes here.

File details

Details for the file zenroom-2.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-2.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 789b997c9fb92e861d877f515a242e4afdacfb3c67e2a7fddec35c53338d2993
MD5 151a7c60b469cbb52b4a5867fecd868e
BLAKE2b-256 88511ce1244be6d474f1f0ff9bac5f00d035ef04ae802f615eac391a1a9ef74f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 56ea0f48413c2066c703b0faaffbd5b5c3c5f8c16e063f5c4b082ccc52aecfb2
MD5 87377b4f8615752a11c81c7d8b3d7587
BLAKE2b-256 11ddbc71733cfd5ed96953ac671545c918f67b4321c77157138a81e67e1ec935

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 9af708eaa36bae97cb4658ce134b9453bde356c5eee2e86a6fe3cf592f44587f
MD5 e47c1c5f3d3a5aa9b1eea8e9d0c24ca4
BLAKE2b-256 da59b66490163f4317eac4b58b622486d0f84e03081caa53d9919a1edda5a7c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 06f5e60d362f2d41a1c7239cc18e534543ab639c9b7b19927a7b7e5da5d011bb
MD5 b89c118fdd8412aa7132d843996ba899
BLAKE2b-256 baaa72b5a42b3e832b14786cbe219580d773c4ea3c26f9228264d743bd1fa444

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 4781da89ca10215019f78ff3f4c7033aa8b6b05c83fb6567c8a07f0790e92686
MD5 63f6e0c3396999b033741e3eea5bfac3
BLAKE2b-256 8573f67525a61604f29dc1ced024eaad7d60271a481e0259a6c4c05825e91f47

See more details on using hashes here.

File details

Details for the file zenroom-2.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-2.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 828e736bb136d316bb01ddd944c2319f0197d7f6a9b8840bfb3bec58a03f6114
MD5 1503b539bdb13ffb7915178e15ef3db3
BLAKE2b-256 d475fb2b14da4aa2a2546b2a61212e9c301e1bb1827ca13f32854bedbe5626bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 82df2648b18181dd2cd25229e3fbe99bf03126cdff6b29b7a010a9ba60a10291
MD5 8a82b185cb9cca420dbb18930462d483
BLAKE2b-256 c58311bd834c5398f3e5c83edfdf6bc584869536478ed8f020da6b2239e2e7d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 89b9f53a166fd64b79c579889356c3165fdbccd5a39aef92a4baaf1c85a69d35
MD5 48757caef2d5051f4259e023592e6523
BLAKE2b-256 46ca1beeec866d969b0c7b9a48e29263f811bd165b917e39e7a3e6d127b7568b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 db538a73a141675793b695ba6b5653051eac058e9f752186116e87a0288e65fe
MD5 eed3f215ddbf2939472fd44d57f525a1
BLAKE2b-256 66357de408071fe32b4e81f3db9d9a920bacfaf1fa1dfe18e940dcb280e0d6ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 8472984f8236737909303bb351fddbd8d325cf334210ffccc7e196da69d45fff
MD5 4c4f789020ee00e1a6899383ca9b7c1d
BLAKE2b-256 2021b2500eb16a477376ca700b63cbfecfcacd657fefbeb841749b490e7362ec

See more details on using hashes here.

File details

Details for the file zenroom-2.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-2.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 42df476dec473a8de41aea54a6854add2a58d3123349db4aa45c32968fe0662f
MD5 388b526493950ab11212d318552f527c
BLAKE2b-256 31db1ad7d0f856080ee4cc56276ecf2337daf2452eeb43277333bddb9877cd43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 512e91ac91ccaed24f3cd2889e3d858b93f40a6bdb12077d0419d4520dedf92d
MD5 4361f18a3bae6efb8759f30e32b97311
BLAKE2b-256 197cd8eb13d5d454a21c94c10244d2c1aa34a670227f272f15218a1438f62235

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 5a5ed28c6e697a0b871aeeec4f2766d4cf6affc5407b1a9e24ecd6245c2fb100
MD5 1cd91533c3aee0739acf67a5776a66ed
BLAKE2b-256 be5b787997157b6f8f53920ec9f7adcab237731e5a03480ef022497268ed53d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 96d7a5292fecde9189dc67f34a35396e1c77f86ee93f2bc0882f2e8529748fc7
MD5 5754a53295321e2c3ddeb6acf71675db
BLAKE2b-256 b48add7463f724f2f9e6a1c9a4f63758215fa4e9152da5d86010d0d3a516921f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 1c04bcc8903584f65bd48e9ebea977597d7cfd9c1e94285fa8bc4ad29455eacd
MD5 1af7617295868d5b4492cb48146f2878
BLAKE2b-256 0f6ced769f4e6036948ac2d84d0047d7231877a20d4aee33aa8b8904d3425b1c

See more details on using hashes here.

File details

Details for the file zenroom-2.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-2.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 091cdccd2ec566466146c091e7025e0a263a408b139abd63859a44a8da8b7c88
MD5 572987a01b9f788e3e5585f96784025b
BLAKE2b-256 2ecdacd571d33f020e14d9aedee35e8e6f4c91e3973e249b640d2dc134a8c871

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 078a91513f3d405a335be61cd768dc21b4b527f44b9666e4e14adbf3f49abbc7
MD5 669877855db6307009bb7fd415dad043
BLAKE2b-256 ead7a1c563fafb390c6357bd56b13d0d361eb77d8f925f370edbe9f777429b94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 606f0f4dd02b641ed04b77b76bdd571b8a9fd285381a576ae0c4004270026751
MD5 509f886f2b932f17b54498a18285c0e7
BLAKE2b-256 9c9371313b7dd59518e5f50c914c7f355fd5c1ac2eff757f108012d61348a4b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 591e13d4da42893cfb4b148c4fd709cc9ddd3ef2bdaa5c22ca6fd022c1601140
MD5 819dd036e7dfe1ddd3e83cb49a5dfe22
BLAKE2b-256 e2c56eeb1c4115eeebd75cfca3b26c380fe788a6bc198a871e72e529069931dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-2.1.0-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 8079d49a584509e7af7aae3aeff42cb8dff2d0ba3381a8e3d2cbee6f8b083d8c
MD5 79ca3133e51917ec7af6291813f2ee0b
BLAKE2b-256 e332d06cbf8d66af0ab766404587b9d6e7eb4de04deeea0faca7b3203080e8c3

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