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

web3-and-three-quarters

v1.0.1

Published

web3 interaction in web2 manner.

Downloads

6

Readme

Web3 and Three Quarters: A Library for Secure Web3 Interaction.

Build Coverage npm version install size Downloads License: MIT

This is the library for users who want to interact with blockchain-based applications without having to worry about the underlying technology. It allows secure managing private data (private keys, mnemonic, etc) on behalf of users, while they focus on DApp interaction in web2 manner. Using Web3 And Three Quarters library users can:

  • geneate a BIP32 standart wallet;
  • securely store generated wallet data locally on device used while generation;
  • create & sign transactions with private key, broadcast them to blockchain;
  • interact with DApps when all web3-related processes (e.g., transaction creation, signing, verification & broadcasting to the blockchain) are performed implicitly;
  • basically, interact with Blockchain DApps similar to usual web2 applications.

The main use cases that can benefit from this library are:

  • services / applications that want to onboard users, who don't know (or have little to nothing) about Blockchain, public - private keys, the importance of responsibility of managing sensitive data, but... At the same, they time want to use blockchain Decentralized Applications;
  • games (or other apps) that require frequent interactions with blockchain. For example shooters, fast items collecting games normally would require crypto wallet to show a promt to sign a transaction for DApp interaction. Imagine users have to perform this actions multiple times a minute or a second. In this case, the user experience would be unacceptable (better to say awful).

You can think of Web3 And Three Quarters library as a crypto wallet that allows users to interact with blockchain without even knowing they do so. Please read the following section to get more details.

🛠 How to use

Installation

npm i web3-and-three-quarters

Generate new wallet

import { Web3AndThreeQuarters } from "web3-and-three-quarters";

const wallet = await new Web3AndThreeQuarters().generateWallet();

Encrypt wallet

import { Web3AndThreeQuarters } from "web3-and-three-quarters";

const encryptedWallet = await new Web3AndThreeQuarters().encryptWallet(wallet, 'PassphraseUsedFor_encryption_2023@');

Decrypt wallet

import { Web3AndThreeQuarters } from "web3-and-three-quarters";

const decryptedWallet = await new Web3AndThreeQuarters().decryptWallet(encryptedWallet, 'PassphraseUsedFor_encryption_2023@');

Sign message

import { Web3AndThreeQuarters } from "web3-and-three-quarters";

const signature = await new Web3AndThreeQuarters().signMessage(wallet, 'Hello Web3 World');

Get message signer

import { Web3AndThreeQuarters } from "web3-and-three-quarters";

const recoveredSigner = await new Web3AndThreeQuarters().getMessageSigner('Hello Web3 World', signature);

Check whether address is message signer

import { Web3AndThreeQuarters } from "web3-and-three-quarters";

const isSigner = await new Web3AndThreeQuarters().isMessageSigner('Hello Web3 World', signature, '0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B');  // use correct address to check

Sign transaction

import { Web3AndThreeQuarters } from "web3-and-three-quarters";

const tx = {
  to: '0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B',
  value: ethers.parseEther('0.001'),
  gasLimit: '21000',
  maxPriorityFeePerGas: ethers.parseUnits('5', 'gwei'),
  maxFeePerGas: ethers.parseUnits('20', 'gwei'),
  nonce: 0, // use correct nonce for your account
  type: 2,
  chainId: 5, // Corresponds to ETH_GOERLI
};

const res = await web3AndThreeQuarters.signTransaction(wallet, tx);

💡 Motivation for developing

Not many Internet users are web3-savvy. The more power you have, the more responsibility you also bear. As a blockchain user, you are responsible for wallet creation, storing your private wallet data (key, mnemonic) securely, and using it to sign and broadcast transactions.

Using a private key for signing and broadcasting transactions can be cumbersome and inconvenient in some cases. It requires additional steps, such as showing a pop-up for the users to confirm their intent of using a private key. The mobile experience is even worse, with users having to switch between apps to sign and broadcast transactions. This can make it difficult and frustrating to interact with blockchain frequently, such as when playing a games that requires frequent transaction broadcasting to blockchain.

Web3 And Three Quarters library proposes a solution that makes the user experience of web3 interaction very similar to web2, where users can know nothing about web3 that is used under the hood. Secure storage of private keys (mnemonics) and seamless interaction with the blockchain are essential for this idea.

This library provides the following features:

  • new wallet generation. Users can generate an wallet compatible with BIP32 standart;
  • seamless blockchain interaction. Users can interact with blockchain without having to switch between apps or interactions with pop ups to sign a transaction;
  • familiar web2 user experience. Users will have a web2 user experience, which they are used to, even though they are interacting with the blockchain.