Skip to content

randomchain/pysloth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pysloth

Python wrapper around the sloth algorithm by Benjamin Wesolowski in A random zoo: sloth, unicorn, and trx

The python module exposes an api for the sloth c-extension.

Install

Note: this module is only tested to work on linux (ubuntu)

Can be installed with pip or by running python3 setup.py install. The setup process includes compiling the c-extension, which has the following requirements (both installable via apt):

  • libgmp-dev
  • libssl-dev

Usage

Usage example:

from sloth import Sloth

sloth = Sloth(data=b'testdata', bits=2048, iterations=5000)
sloth.compute()
sloth.wait()

print("sloth computation done")
print("witness", sloth.witness)
print("output", sloth.final_hash)

sloth.verify()
sloth.wait()
print("sloth is", ("valid" if sloth.valid else "invalid"))

You can enable/disable a sloth progressbar by setting PROGRESS on the sloth module to true or false.

If in doubt read the code

About

Python wrapper around the sloth algorithm by Benjamin Wesolowski in A random zoo: sloth, unicorn, and trx

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published