Wondering what’s next for npm?Check out our public roadmap! »

    ethereum-public-key-to-address

    0.0.5 • Public • Published

    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

    Install

    npm i ethereum-public-key-to-address

    DownloadsWeekly Downloads

    7,941

    Version

    0.0.5

    License

    MIT

    Unpacked Size

    611 kB

    Total Files

    10

    Last publish

    Collaborators

    • avatar