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

poh-contracts

v0.0.2

Published

Solidity contracts for verifying proof-of-humanity on-chain

Downloads

2

Readme

Solidity contracts for verifying proof-of-humanity on-chain

NPM

Set of convenient utilities for verifying proof-of-humanity on-chain within Solidity smart contracts.

Proof-of-Humanity is signed proof that the transaction sender is a human rather than a bot. We are trusting the proof signer (validator) that they did use some method to prove sender humanity off-chain. That could be a CAPTCHA, biometric verification, and so on. Now we can check the validity and uniqueness of this proof on-chain before processing the transaction.

See also:

Proof-of-HUMANity on-chain: protect your smart contracts from bots

Proof-of-Humanity hCaptcha Validator API

HumanOnly

This is a basic abstract contract you should inherit from. It exposes the following API:

Methods

setHumanityValidator(<address>) – sets the address of the humanity validator you trust. Usually, this is the address of the account used to sign proof-of-humanity in the backend server you are in control or trust. Here is an example server for hCaptcha.

Validator could be set either in contract constructor, or later, by the contract owner.

Modifiers

basicPoH(<proof>) – ensures that the basic proof is valid and never seen before.

sovereignPoH(<proof>) – ensures that the sovereign proof is valid and never seen before.

If the proof is invalid, transaction is rejected.

proof must be provided as a parameter for a modified method (example).

Proof-of-Humanity types

Two types of proof-of-humanity are supported: basic and sovereign.

Basic proof

The basic proof is 101 bytes long. It is a random challenge and a timestamp signed by a trusted validator.

random challenge | timestamp | validator signature
32 bytes         | 4 bytes   | 65 bytes

Sovereign proof

Sovereign proof includes the signature of the transaction sender over the random challenge. This is useful if you want the proof to be tightened to the sender's address. The sovereign proof is 166 bytes long.

random challenge | sender signature | timestamp | validator signature
32 bytes         | 65 bytes         | 4 bytes   | 65 bytes

Install

npm install poh-contracts

Usage

1. Import HumanOnly.sol contract

`import "poh-contracts/contracts/HumanOnly.sol";`

2. Inherit your contract from HumanOnly

contract MyContract is HumanOnly

3. Ensure the validator address is set

constructor() {
  setHumanityValidator(0x...);
}

This is the address used to sign proofs on a backend server you trust.

4. Protect your methods by adding the proof parameter and one of the PoH modifiers

function doSomethingImpotant(bytes calldata proof) public basicPoH(proof)

Ensure to provide a valid proof when calling this function from your dApp.

See also

Author

Alex Bakoushin

License

MIT