npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@blockswaplab/rpbs-sol

v1.0.11

Published

Solidity package for working with Restrictive Partially Blind Signature scheme

Downloads

13

Readme

Restrictive Partially Blind Signatures in Solidity

RPBS-sol package is a package for verifying Restrictive Partially Blind Signatures on-chain.

This package is meant to work in tandem with the NPM package
designed for creating blind signatures.

The package contains 2 contracts: Curve and RPBS

Curve

The Curve contract implements all of the basic operations over the BN254 field and the respective group.

The point on the afforementioned curve is defined in the following structure:

struct Point {
        uint256 x; /// X coordinate of the point
        uint256 y; /// Y coordinate of the point
    }

The following functions help to execute transformations and operations on the afforementioned structure.

multiplyPointByScalarPoint memory _point, uint256 _scalar)

Takes in a point _point = (x,y) and a scalar _k \in [0, max(uint256)] and outputs a point scaled on the elliptic curve: p' = _k * (x, y)

scalarToPoint(uint256 _k)

Takes in a scalar k \in [0, max(uint256)] and outputs a point obtained by scaling the generator point (1,2) by the specified scalar _k: p' = _k * (1,2)

addPoints(Point memory _p1, Point memory _p2)

Takes in the 2 points _p1 = (x1, y1), _p2 = (x2, y2) and outputs a sum of the specified points:

p' = (x1, y1) + (x2, y2)

negateScalar(uint256 _scalar)

Computes an additive group inverse of the _scalar such that (_scalar + negateScalar(_scalar)) mod GROUP_ORDER = 0

reduceScalar(uint256 _scalar)

Computes _scalar mod GROUP_ORDER

encodePointHex(Point memory _p)

Takes in a point in the format (x,y) and returns a point encoded in the string form: '04' + str(x) + str(y). Here str(x) and str(y) are given in the hexadecimal format.

RPBS

The RPBS contract contains 1 main function: verifySignature which takes in the following parameters:

  • Point calldata _publicKey - Public key of the signer
  • bytes32 _infoHash - sha256 hash of the public part of the message
  • Signature calldata _signature - RPBS signature
  • bytes32 _messageHash - sha256 hash of the private part of the signed message

The RPBS signature is defined as following:

struct Signature {
        Point z1_hat;
        uint256 c1_hat;
        uint256 s1_hat;
        uint256 c2_hat;
        uint256 s2_hat;
        uint256 alpha;
        uint256 beta;
    }

The function outputs is a boolean value for signature being correct true or not false