Coder Social home page Coder Social logo

miguelmota / ethereum-public-key-to-address Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 11.0 198 KB

Convert an Ethereum public key to an address

Home Page: https://github.com/miguelmota/ethereum-public-key-to-address

License: MIT License

JavaScript 65.43% HTML 34.57%
ethereum public-key converter utility cli javascript nodejs secp256k1 keccak256 address

ethereum-public-key-to-address's Introduction

ethereum-public-key-to-address

Convert an Ethereum public key to an address

License NPM version

Demo

https://lab.miguelmota.com/ethereum-public-key-to-address

Install

npm install ethereum-public-key-to-address

Getting started

const publicKeyToAddress = require('ethereum-public-key-to-address')

console.log(publicKeyToAddress(Buffer.from('04e68acfc0253a10620dff706b0a1b1f1f5833ea3beb3bde2250d5f271f3563606672ebc45e0b7ea2e816ecb70ca03137b1c9476eec63d4632e990020b7b6fba39', 'hex'))) // '0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1'
console.log(publicKeyToAddress('04e68acfc0253a10620dff706b0a1b1f1f5833ea3beb3bde2250d5f271f3563606672ebc45e0b7ea2e816ecb70ca03137b1c9476eec63d4632e990020b7b6fba39')) // '0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1'
console.log(publicKeyToAddress('0x04e68acfc0253a10620dff706b0a1b1f1f5833ea3beb3bde2250d5f271f3563606672ebc45e0b7ea2e816ecb70ca03137b1c9476eec63d4632e990020b7b6fba39')) // '0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1'

CLI

Install:

npm install -g ethereum-public-key-to-address

Convert public key to address:

$ ethereum_public_key_to_address 04e68acfc0253a10620dff706b0a1b1f1f5833ea3beb3bde2250d5f271f3563606672ebc45e0b7ea2e816ecb70ca03137b1c9476eec63d4632e990020b7b6fba39

0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1

Piping public key example:

$ echo 04e68acfc0253a10620dff706b0a1b1f1f5833ea3beb3bde2250d5f271f3563606672ebc45e0b7ea2e816ecb70ca03137b1c9476eec63d4632e990020b7b6fba39 | ethereum_public_key_to_address

0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1

Test

npm test

License

MIT

ethereum-public-key-to-address's People

Contributors

alcuadrado avatar miguelmota avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ethereum-public-key-to-address's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.