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

hypercerts-core

v1.4.0

Published

Hypercerts Core component

Downloads

18

Readme

Hypercerts - A Verifiable Claims Platform

Welcome to Hypercerts! The project is under active development and the information on this page is going to be changing a lot in the next months, be sure to stay up to date. 😁

Overview

Hypercerts is a verifiable claims platform, built on top of the Hypercers-Core library. Hypercerts uses IPFS and Ethereum to allow users to create claims that can be verified by anyone. It is completely distributed and serverless. Hypercerts can be used by any platform. For instance, we built Hypercerts-News to demonstrate Hypercerts' potential in dealing with Fake News.

How Hypercerts Works

Hypercerts uses the Hypercerts-Core library to store, retrieve and verify claims. Claims are accessible via their Index. Indexes need not be unique, meaning that the same index can point to several claims. Example: In Hypercerts-News, the index corresponds to the ID of the News Article, meaning that all Claims about a given article are accesible via the same index.

Store Claims

Claims are objects can be generated by any application. For instance, Hypercerts-News-Claims data model, but different applications can use their own data models.

Method 1: To issue a Claim, a user can use hypercerts-core.issue(id, claim). This requires the user to be connected to an Ethereum node and have an account with Ether (see Metamask).

Method 2: An alternative that does not require the client to be connected to an Ethereum node is to use a Publisher, an entity that issues claims (see Hypercerts-publisher).

Get Claims

Claims can be retrieved by their index, using hypercerts-core.getClaimsByIndex(id), which will return all the claims in with that index.

Verifiy Claims

By leveraging the properties of Ethereum and IPFS, Hypercerts-core ensures the integrity of all claims that are stored. Extra degrees of verification can be added on the application layer. For instance, the data model used by Hypercerts-News encompasses a digital signature field that can be used to verifiy the authenticity of the claims, by checking the key used to sign the claim corresponds to the one in the Issuer field.

Usage

⚡️ Instructions with Docker comming soon (will turn steps 2 and 3 into a breeze)

  1. Install the hypercerts-core library
> npm install hypercerts-core --save
  1. Install, configure and run IPFS
> npm install --save ipfs-api
# Show the ipfs config API port to check it is correct
> ipfs config Addresses.API
/ip4/127.0.0.1/tcp/5001
# Set it if it does not match the above output
> ipfs config Addresses.API /ip4/127.0.0.1/tcp/5001
# Restart the daemon after changing the config

# Run the daemon
> ipfs daemon
  1. Configure an Ethereum node

    In the browser: Try Metamask

    In Node.js: Use Geth to run a node (mainnet or testnet), or Truffle for a local node (only for tests)

  2. Import and initialize hypercerts-core

const hypercertsCore = require('hypercerts-core')

hypercertsCore.init().then(res=>{
    // Do awesome stuff
    hypercertsCore.issue("myClaimIndex",{MyClaimObject}).then(res=>{
    hypercertsCore.getClaimsByIndex("myClaimIndex").then(console.log)
    // print: {MyClaimObject}
    })
})

API

  • hypercertsCore.init

    • Initializes Hypercerts-Core. It connects to the IPFS node and to Ethereum

    • Parameters

      • type number 1 for starting a testnode with testrpc or 2 for connecting to an existing node

      Returns Object Instance of Ethereum smart-contract

  • hypercertsCore.issue

    • Issues a Claim in Hypercerts

    • Parameters

      • nkey
      • newClaim object hypercerts-news-claims SingleClaim object
      • claimIndex string The key used to index the Claim

      Returns Array [claimIndex,newClaim]

  • hypercertsCore.getClaimsByIndex

    •   Returns Claims from that index
    • Parameters

      • claimIndex string Value used to index the claim

      Returns Array Array of hypercerts-news-claims SingleClaim objects

  • hypercertsCore.getClaimsCountsByIndex

    •   Returns the number of Claims indexed by that claimIndex
    • Parameters

      • claimIndex string Value used to index the claim

      Returns number The count

  • hypercertsCore.getUserId

    •   Returns the Ethereum address of the active account.

      Returns string Ethereum address