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

lightchain-wallet-backend

v1.0.0

Published

![image](https://user-images.githubusercontent.com/34389545/35821974-62e0e25c-0a70-11e8-87dd-2cfffeb6ed47.png)

Downloads

52

Readme

image

Master Build Status

Build Status

turtlecoin-wallet-backend

Provides an interface to the TurtleCoin network, allowing wallet applications to be built.

  • Downloads blocks from the network, either through a traditional daemon, or a blockchain cache for increased speed
  • Processes blocks, decrypting transactions that belong to the user
  • Sends and receives transactions

Installation

NPM:

npm install git+https://[email protected]/turtlecoin/turtlecoin-wallet-backend-js.git --save

Yarn:

yarn add https://github.com/turtlecoin/turtlecoin-wallet-backend-js

Documentation

You can view the documentation here: https://turtlecoin.github.io/turtlecoin-wallet-backend-js/

Quick Start

Javascript

const WB = require('turtlecoin-wallet-backend');

(async () => {
    const daemon = new WB.ConventionalDaemon('127.0.0.1', 11898);
    /* OR
    const daemon = new WB.BlockchainCacheApi('blockapi.turtlepay.io, true);
    */
    
    const wallet = WB.WalletBackend.createWallet(daemon);

    console.log('Created wallet');

    await wallet.start();

    console.log('Started wallet');

    /* After some time...
    wallet.stop();
    */

})().catch(err => {
    console.log('Caught promise rejection: ' + err);
});

Typescript

import { WalletBackend, ConventionalDaemon, BlockchainCacheApi } from 'turtlecoin-wallet-backend';

(async () => {
    const daemon: ConventionalDaemon = new ConventionalDaemon('127.0.0.1', 11898);

    /* OR
    const daemon: BlockchainCacheApi = new BlockchainCacheApi('blockapi.turtlepay.io, true);
    */
    
    const wallet: WalletBackend = WalletBackend.createWallet(daemon);

    console.log('Created wallet');

    await wallet.start();

    console.log('Started wallet');

    /* After some time...
    wallet.stop();
    */

})().catch(err => {
    console.log('Caught promise rejection: ' + err);
});

Logging

By default, the logger is disabled. You can enable it like so:

wallet.setLogLevel(LogLevel.DEBUG);

The logger uses console.log, i.e. it outputs to stdout.

If you want to change this, or want more control over what messages are logged, you can provide a callback for the logger to call.

wallet.setLoggerCallback((prettyMessage, message, level, categories) => {
    if (categories.includes(LogCategory.SYNC)) {
        console.log(prettyMessage);
    }
});

In this example, we only print messages that fall into the SYNC category.

You can view available categories and log levels in the documentation below.

Things To Note

By default, coinbase transactions are not scanned. This is due to the sync process taking quite a long time with the less efficient JavaScript crypto code, and the majority of people not having solo mined any blocks.

If you wish to enable coinbase transaction scanning, run this line of code:

wallet.scanCoinbaseTransactions(true);

Building (For Developers)

git clone https://github.com/zpalmtree/turtlecoin-wallet-backend.git

cd turtlecoin-wallet-backend

npm install -g yarn (Skip this if you already have yarn installed)

yarn build

Generated javascript files will be written to the dist/lib/ folder.

Running tests

yarn test - This will run the basic tests

yarn test-all - This will run all tests, including performance tests. You need a daemon running on 127.0.0.1:11898 for these to work.

Building documentation

yarn docs

Contributing

Please run yarn style to ensure your changes adhere to the tslint rules before committing.

You can try running yarn style --fix to automatically fix issues.