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

eth-did-core

v1.1.0

Published

.

Downloads

4

Readme

Ethereum DID Javascript Library

This library is intended to be used as a multi-tool to create and manage Ethereum-based identities and interact with different networks.

Can be also used with the related smart contract that allows you to connect one or more encrypted values to hashes and identities.

Please be 100% you understand that data inside the blockchain are public, so please be sure to use strong-encrypted values or hashes.

## Main features

This library will work with both NodeJS and Browser and it can be used to accomplish following operations:

  • Store and manage mnemonic passphrases in browser or simply local storage
  • Connect to multiple blockchain providers (Ethereum, Polygon, Quadrans)
  • Init contract instances and interact with them
  • Use utilities like encryption and hashing functions

WIP features

  • Interact directly with a dID contract
  • Use same features with a CLI interface
  • Add more EVM-based blockchains

Use the library

Start with inserting it inside a NodeJS project:

yarn add eth-did-core

Then create a new instance:

const EthDiD = require('eth-did-core')
const core = new EthDiD()

You can access the tests by running following commands:

npm run test:wallet
npm run test:rpc
npm run test:contract

Create and manage a new wallet

/* Create a new wallet */
const wallet = await core.createWallet('MySuperPassword', true, 'MySmartAlias')

/* Derive a key */
const derived = await core.deriveKeyFromMnemonic(wallet.mnemonic, 'ethereum', 'm/0')

/* Return the wallet with alias or hash */
const local = await core.returnWallet('MySmartAlias')

/* Decrypt the wallet */
const decrypted = await core.decryptWallet(wallet.hash, 'MySuperPassword')

Connect to web3

/* Connect to selected network */
await core.connect('ganache', mnemonic)

/* Use classic Web3 methods */
const balance = await core.web3.eth.getBalance(wallet.address)

If you want to setup your own JSON-RPC nodes you can setup in this way (if you want, for example, connect to your infura account):

core.blockchains['ethereum']['mainnet'].provider = 'https://mainnet.infura.io/v3/YourApiKey'

Interact with contract

/* First connect to selected network */
await core.connect('ganache', mnemonic)

/* Init contract by passing ABI and address */
const contract = await core.initContract(ABI, CONTRACT_ADDRESS)

/* Interact with selected contract */
await contract.methods.registerIdentity('something', 'something else').send({ from: wallet.address })