Package: tinysig
Pure-Python implementation of athreshold ecdsa signature schemebased on a secure multi-party computation (MPC)protocol for evaluating arithmetic sum-of-products expressionsvia a non-interactive computation phase.Installation and UsageThis library is available as apackage on PyPI:python-mpipinstalltinysigThe library can be imported in the usual way:importtinysigfromtinysigimport*Basic ExampleThis implementation includes the emulation of a network comprised of computing nodes and clients. We can either deploy
a network for DSA or ECDSA. In this example, we will show the Elliptic Curve version with 3 nodes and 1 client with id set to 1.>>>N=3;C=1;client_id=1To kick things off, let’s initialize the network using ECDSA with the P-256 curve:>>>ecdsa_setup=ECDSASetup(curve="P-256")>>>ecnet=ThresholdSignature(N,C,setup=ecdsa_setup)The first protocol involves distributing a key triple among the nodes:>>>ecnet.distributed_key_generation_protocol(client_id)The signature protocol unfolds in two phases: the preprocessing phase and the signing phase.
Let’s run the preprocessing phase:>>>ecnet.ts_prep_protocol(client_id)After defining a message we can sign it as follows:>>>message="Let me tell you a secret about Nillion.">>>ecnet.ts_online_protocol(message,client_id)We run the following to print the signature owned by the client (ID=1):>>>ecnet.print_signature(client_id)For a deeper dive, please check thedemosfolder.DevelopmentAll installation and development dependencies are fully specified inpyproject.toml. Theproject.optional-dependenciesobject is used tospecify optional requirementsfor various development tasks. This makes it possible to specify additional options (such asdocs,lint, and so on) when performing installation usingpip:python-mpipinstall.[docs,lint]DocumentationThe documentation can be generated automatically from the source files usingSphinx:python-mpipinstall.[docs]cddocssphinx-apidoc-f-E--templatedir=_templates-o_source../src&&makehtmlTesting and ConventionsAll unit tests are executed and their coverage is measured when usingpytest(see thepyproject.tomlfile for configuration details):python-mpipinstall.[test]python-mpytestStyle conventions are enforced usingPylint:python-mpipinstall.[lint]python-mpylintsrc/tinysigContributionsIn order to contribute to the source code, open an issue or submit a pull request on theGitHub pagefor this library.VersioningThe version number format for this library and the changes to the library associated with version number increments conform withSemantic Versioning 2.0.0.PublishingThis library can be published as apackage on PyPIby a package maintainer. First, install the dependencies required for packaging and publishing:python-mpipinstall.[publish]Ensure that the correct version number appears inpyproject.toml, and that any links in this README document to the Read the Docs documentation of this package (or its dependencies) have appropriate version numbers. Also ensure that the Read the Docs project for this library has anautomation rulethat activates and sets as the default all tagged versions. Create and push a tag for this version (replacing?.?.?with the version number):gittag?.?.?gitpushorigin?.?.?Remove any old build/distribution files. Then, package the source into a distribution archive:rm-rfbuilddistsrc/*.egg-infopython-mbuild--sdist--wheel.Finally, upload the package distribution archive toPyPI:python-mtwineuploaddist/*