Giter Club home page Giter Club logo

subaddress-js's Introduction

Monero Subaddress javascript utility

This library generates subaddresses.

To use, first find your public spend key and secret view key from your Monero wallet. In the GUI, these are available in the Settings->Seed & Keys area. In the CLI, open your wallet and use the commands spendkey and viewkey to find the keys.

Monero wallets can have multiple receiving addresses called subaddresses. These are organized into accounts. Each Monero account can have multiple subaddresses.

Subaddresses are unlinkable. This means that it is impossible for someone to look at two of your subaddresses and know that they both are addresses for the same wallet.

The first address of the first account is the same as the main wallet address.

Example code

The following example will display the second subaddress (subaddress index 1) of the first account (account index 0) in the wallet.

const subaddress = require('subaddress');

let publicSpendKeyHex = "3a4a80eada742b2e21025df7ee00dd95227441c64f4f7ed63886c19fd619a6ab";
let privateViewKeyHex = "3d09263424487cbdc78d56e1f411ff1c171f84d756b736a2ced698011278d709";

let addr = subaddress.getSubaddress(privateViewKeyHex, publicSpendKeyHex, 0, 1);
console.log(addr);

NPM package

To run the example code, you must have the node and npm packages installed.

If you are using Ubuntu, type:

sudo apt install nodejs npm
npm install subaddress

To run the example code, put it into a file called example.js and type:

node example.js

subaddress-js's People

Contributors

jorgeelmundoso avatar knaccc avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

subaddress-js's Issues

subaddressIndex >= 256 differ from the addresses generated with monero-wallet

const subaddress = require('subaddress');
 
let publicSpendKeyHex = "3a4a80eada742b2e21025df7ee00dd95227441c64f4f7ed63886c19fd619a6ab";
let privateViewKeyHex = "3d09263424487cbdc78d56e1f411ff1c171f84d756b736a2ced698011278d709";
 
let addr = subaddress.getSubaddress(privateViewKeyHex, publicSpendKeyHex, 0, 256);
console.log(addr);

will generate a different address as was generated with monero wallet binaries

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.