CLI Mosaic Wallet

CLI Wallet

Cache

Download Source Code

This code can be used for your own NEM-based cryptocurrency. It is plug-n-play in that you can simply put the ID of your Mosaic (cryptocurrency) in the mosaic-settings.json file

{
  "wallet_name": "cache wallet",
  "mosaic_namespace": "devslopes",
  "mosaic_name": "cache"
}

Cache Wallet

This is the official wallet for the cache cryptocurrency. cache is built on the NEM blockchain. This is a CLI version of the wallet and requires Node 8.0+ to run.

Cache is the currency powering https://cacheout.io

Cache works on top of XEM and you will need a small amount of it to cover fees for transferring cache.

Download the NEM Nano Wallet to get some XEM:

NEM Nano Wallet

Getting Started

To install run npm i -g cache-wallet.

To see common commands run: cache in your terminal.

Other commands:

To check cache balance: cache balance

To send cache run: cache send <amt> <public address>

ie cache send 12.345 TCUPK5-XWIWZK-PZIKKR-7XJ5EO-L6XJJJ-JSYX4X-IQP6

Can I Use This Wallet For My Own Cryptocurrency?

Yes! Simply create a namespace and mosaic on the Nano Wallet and then replace the data in src/mosaic-settings.json with your own data.

MultiSig

The current version of this app allows creation of a SimpleWallet. Creating BrainWallets or MultiSig accounts is not built yet. If you want to use an existing MultiSig account, export it from the NanoWallet and put it in the wallet path for this app.

Test vs Production

The npm package for cache-wallet is on the MainNet (production)

This repo is set on the TestNet. You can change this any time.

Well Documented

All the code is well documented as seen below:

/**
 * Talk to NEM API to fetch the mosaic balance & XEM balance
 */
const printBalance = async (onBalance: (balance: number) => void) => {
    const wallet = loadWallet();
    try {
        const account = await attemptWalletOpen(wallet);
        selectedAccount = account;
        console.log('\n');
        console.log(`\n${white('Public Address:')} ${white(account.address.pretty())}\n`);
        const spinner = new Spinner(yellow('Fetching balance... %s'));
        spinner.setSpinnerString(0);
        spinner.start();
        const balances = await getAccountBalances(account);
        const mosaic = await mosaicBalance(balances);
        const xem = await xemBalance(balances);
        spinner.stop();
        /**
         * Convert raw number into user-readable string
         * 1e6 is Scientific Notation - adds the decimal six
         * places from the right: ie 156349876 => 156.349876
         */
        const bal = (mosaic / 1e6).toString();
        const xemBal = (xem / 1e6).toString();
        console.log('\n');
        console.log(`\n${white('XEM Balance:')} ${white(xemBal)}`);
        console.log(`\n${white(`${MOSAIC_NAME} Balance:`)} ${white(bal)}\n`);
        onBalance(mosaic / 1e6);
    } catch (err) {
        if (err) {
            console.log(err);
        }
    }
};