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

email-to-ethereum-address

v1.3.1

Published

Email to Ethereum address directory.

Downloads

29

Readme

Email to Ethereum Address

An email to Ethereum address directory Web3 library. This library is a Web3js wrapper which manages interactions with an Ethereum smart contract application.

Note: This library currently runs on the Ethereum ROPSTEN (Revival) TESTNET and is intended for demonstration purposes only. This library requires a Web3 compatible client.

Workflow Diagram

Install

npm install email-to-ethereum-address

Build (from source)

npm install

// Bundle for web browser use.
// Outputs to dist/EmailToEthereumAddress.web.js
npm run build

Usage

Node (ES6)

const EmailToEthereumAddress = require('email-to-ethereum-address');
const Web3 = require("web3");

// The address transactions should be sent from.
const FROM_ACCOUNT = "0x0000000000000000000000000000000000000000";

// Initialize your web3 provider.
const web3 = new Web3.providers.HttpProvider("http://localhost:8545");

// Initialize the EmailToEthereumAddress library.
// Pass your web3 provider and account.
const emailToEthereumAddress = new EmailToEthereumAddress(web3, FROM_ACCOUNT);

// Request a new registration.
// On a successful request, a verification email will be sent to the provided email address.
emailToEthereumAddress.requestAddRecord("[email protected]").then(receipt => {
    console.log("TransactionHash: " + receipt.transactionHash);
});

// Lookup address from email.
emailToEthereumAddress.getAccount("[email protected]").then(address => {
    console.log("Address: " + address);
});

Web

<html>
<head>
    <script src="dist/EmailToEthereumAddress.web.js"></script>
</head>
</html>
<body>
<script>
    window.onload = function () {

        // Verify the browser has web3 injected.
        if (typeof web3 !== 'undefined') {

            // Lookup Etheruem accounts.
            web3.eth.getAccounts(function (err, accounts) {
                if (accounts.length > 0) {

                    // Grab account you wish to use.
                    var myAccount = accounts[0];

                    // Initial the EmailToEthereumAddress library.
                    // Pass your web3 provider and account.
                    var emailToEthereumAddress = new EmailToEthereumAddress(web3.currentProvider, myAccount);

                    // Request a new registration.
                    // On a successful request, a verification email will be sent to the provided email address.
                    emailToEthereumAddress.requestAddRecord("[email protected]", function (error, transactionHash) {
                        console.log("TransactionHash: " + transactionHash);
                    });

                    // Lookup address from email.
                    emailToEthereumAddress.getAccount("[email protected]", function (address) {
                        console.log(address);
                    });
                }
            });
        }
    };
</script>
</body>

Samples

See the samples folder for both node.js and web examples.

Node

Before running these samples, please modify your email and Ethereum addresses within the scripts.

# Get account
node samples/node/get_account.js

# Request Add Record
node samples/node/request_add_record.js

Web

Before running these samples, please modify your email address in the HTML file.

Open the HTML file in a web3 compatible browser.

  • samples/web/get_account.html
  • samples/web/request_add_record.html

Live Demo

Please visit here.