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

Uploaded Source

Built Distributions

zenroom-3.16.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.7 kB view details)

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

zenroom-3.16.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.7 kB view details)

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

zenroom-3.16.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.4 kB view details)

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

zenroom-3.16.1-cp311-cp311-macosx_10_9_x86_64.whl (680.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

zenroom-3.16.1-cp311-cp311-linux_armv7l.whl (787.9 kB view details)

Uploaded CPython 3.11

zenroom-3.16.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.7 kB view details)

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

zenroom-3.16.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.7 kB view details)

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

zenroom-3.16.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.4 kB view details)

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

zenroom-3.16.1-cp310-cp310-macosx_10_9_x86_64.whl (680.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

zenroom-3.16.1-cp310-cp310-linux_armv7l.whl (787.9 kB view details)

Uploaded CPython 3.10

zenroom-3.16.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.7 kB view details)

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

zenroom-3.16.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.7 kB view details)

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

zenroom-3.16.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.4 kB view details)

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

zenroom-3.16.1-cp39-cp39-macosx_10_9_x86_64.whl (680.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

zenroom-3.16.1-cp39-cp39-linux_armv7l.whl (787.9 kB view details)

Uploaded CPython 3.9

zenroom-3.16.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (811.7 kB view details)

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

zenroom-3.16.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl (819.7 kB view details)

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

zenroom-3.16.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (768.4 kB view details)

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

zenroom-3.16.1-cp38-cp38-macosx_10_9_x86_64.whl (680.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

zenroom-3.16.1-cp38-cp38-linux_armv7l.whl (787.3 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: zenroom-3.16.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.4

File hashes

Hashes for zenroom-3.16.1.tar.gz
Algorithm Hash digest
SHA256 93989d4b45cb91637e193f012d298d420a775996edaa9578281da76132f56ac0
MD5 0ae0f81da6f294b27cd33028ce984909
BLAKE2b-256 b0d4b1844d3c2081353b4ac8851a64e0b52683e7ffeb892549357f435856820a

See more details on using hashes here.

File details

Details for the file zenroom-3.16.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.16.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3c5fed6caa128927c9316076ca93e3dc42f78879469d7e98d2f1f385df584107
MD5 eb02f131b0af1d719ab12f0ef8380826
BLAKE2b-256 87b31a68ba628a94bda2291588c48d0f0f089315dd07003cc00833dc14f959e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 11fdc50287f9337eb28c1f5fd4bbc96e6dd68b9ebc5da4a9ff17dbe6a933e94b
MD5 5fe73c3ebcfc9aefd7a9ba198e42176b
BLAKE2b-256 6f763d703ccbd984f4381861760ae5234210e3a49f98c2045215092340e95be3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 70e0d781e71652171d9cec1bf0784ce8bfc8d9ade06d19aeca2dfec867e9eab3
MD5 7446f83886ac79addd4414cb2263ba2b
BLAKE2b-256 2400b741b99da8d22a2446ec675d0a6c1e30c442126dae86d7a1211f26be0293

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b61bb399b50450772b7d621e71eda48af454f516b19aa7cf518208dc84b71a84
MD5 855ad180e9e8d9d1848de8264cd4e34b
BLAKE2b-256 5ad7665a395e5ef43d3909ab8228b1511b6b92bf4b6e62379e1c1016027cf553

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp311-cp311-linux_armv7l.whl
Algorithm Hash digest
SHA256 3c8150c16f870dc77165541fa23994ca0d933f8c20fb56242409b901bed5157d
MD5 c508ceebf08f41d6b9b65b5f299610b6
BLAKE2b-256 8149623c53a49f02825f26fe1de10f8c4c02659ad83c7b3d70f009ece85022d7

See more details on using hashes here.

File details

Details for the file zenroom-3.16.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.16.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 06285087da52f05a18e66d0b6be51dce9fc705a4e253169baf3db35e1c91de8d
MD5 7947f3123269020ed556ed1c0cd8746f
BLAKE2b-256 b14632e0220307e81234d9035c8de94cc310cd72de8092cd8ff4bcbc17a5ad46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 f11d08afc748ba183840cd0664b9c40c32ed4652bf937f7b30b28790f91b506c
MD5 fc42b2c9f7259b112d1ea68ed96bb722
BLAKE2b-256 2d3b74205902242ef13ce91199890796903551d7c4dc20348e9aef177e48f677

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 73ba281e2f8ae43101dd6b188bd37a35045c3a451a5d6ac7fe57d3dac3b66565
MD5 f0e2e89114996f723a8fe334413cd497
BLAKE2b-256 b95cf8af4f1ef235c04b63f6815571120ec1ab8ef1f1a5ff4c26dc8b0e03c328

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 570e678659a3f5e4cb47679ab1523a3c7abdfae000cf7a36d89eff8eb45012c7
MD5 2e478e4608da8deb05024e2696a7e6e7
BLAKE2b-256 8387a31777cbdee9d6743d845f86bd6a1a79d88e2f268fad03735971f4c176a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp310-cp310-linux_armv7l.whl
Algorithm Hash digest
SHA256 35496afb29def26ffecbfa7540d1963f7f35ad7af3bb5436f09136270f7b7251
MD5 56dc96898a67762e2624f50bbaa9b1ca
BLAKE2b-256 b30ebef91665c4389b629caa196417bb95224f9e2f67eac75ac7afa61e96363d

See more details on using hashes here.

File details

Details for the file zenroom-3.16.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.16.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 595423eb4ec0fb99a19a98e4bac1d687adc9fb9e8b4cd0f38dbaff7caa6c10e2
MD5 21761d679d62bfc5c2dbd6d61d4ebafa
BLAKE2b-256 4facdb99f1109fe09a62cd5473ff75df393848d1cfa939879bb784b4e338d701

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 553691c4f639f34a59c8d55bbfcf9a9f200a098a8f78b06792b11f813d2d4ca1
MD5 f787b13611f8f6446f74900e6cf07bfb
BLAKE2b-256 f0576941cb9377eda2406ef4f8ad763a313f973343951e25daeaea2209d2d568

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 62d1467dbbe7b5b7d0f0a32aea5c898673a8c519c2e826ed9d6a201b28aab1e8
MD5 77c5de748e10c8ea60100a3c84f1d2be
BLAKE2b-256 569289dd844992a67c43c533679921a26a8c500b56b60c3d6fe8b42aac585f16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 db953bc75f8d45169dfd90bf7f58d10cc906f394f60cd40ced4f93fe23178ce5
MD5 6631c74507b361f36e995a1a045311ea
BLAKE2b-256 e802d87ebae9969ee565d9863e4168162b8d00e7e4124683c96553fc9cb86a0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp39-cp39-linux_armv7l.whl
Algorithm Hash digest
SHA256 acc8f2ac0b121481950bb5dc200330f3882152495a3947f786916088229b56e4
MD5 29a6930e73d88811268e07283007cf07
BLAKE2b-256 e2974341abaad4f70c5fb9e59c5c587f9426993b4a7d1227298da83bcb969493

See more details on using hashes here.

File details

Details for the file zenroom-3.16.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.16.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0ca002693701d87f35c3b93c0ee770ab7fe9a9afb09ed73ed2fa84a4c081bb7e
MD5 e04776efcef6ec6752fcfe4a2f1de54c
BLAKE2b-256 45c7bed5a7c206cb837ff0cfe46685a0b4d7ec494e46110f11a9e06e9f17268b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 cad24f0d803fd0ebd8caa08c32fd143358b1e41eeca89cce73fa51a0037073dd
MD5 bb7308f32d9ca0bd5a3a917a65933d49
BLAKE2b-256 6320cec0e06695fb61a3dfa9775520b85a667f9e73a886f6818f384de893292b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 4215ca340809ab74a3ee0cbdd67d425f271a15e60bd3c73ebad9eefabce16a4f
MD5 4ec53525efbaf9fdbe4cdda4449baf5e
BLAKE2b-256 203fad383f66c40390e9077951d0b3d87eb33b67f09ab70292db685177e2160b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4db37d7e1f17eac5326c2c4c0d13e63353381d230932bde9d6be2bd2a32dc3ee
MD5 e846d94d5c16f808dadca8119db7fc4b
BLAKE2b-256 41d41c9cf6334cafbae85af3b5e40753162eb3de282f505c431831916c4e7624

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zenroom-3.16.1-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 828f754bc414fdbe6839ce29d9fb7fe8830e541a74042633998530cb7fe762c3
MD5 b9fb3504823939d42fbd45fabb7f00cb
BLAKE2b-256 4da3cf507b5da491e4f52c9d22355cd39d1f84d118e2e9ac585044c41ee7c25f

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