216k155 / lux-core-api

A full stack for luxcore and blockchain-based applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lux-core-api

Build Status Coverage Status

A pure, powerful core for your lux-core-api project.

lux is a complete, native interface to the lux-core-api network, and provides the core functionality needed to develop apps for lux-core-api.

#Principles

lux-core-api is a powerful new peer-to-peer platform for the next generation of financial and social technology. The decentralized nature of the lux-core-api network allows for highly resilient lux-core-api infrastructure, and the developer community needs reliable, open-source tools to implement lux-core-api apps and services.

lux unchains developers from fallible, centralized APIs, and provides the tools to interact with the real lux-core-api network.

#Get Started

lux runs on node, and can be installed via npm:

npm install luxcore

It is a collection of objects useful to lux-core-api applications; class-like idioms are enabled viaSoop. In most cases, a developer will require the object's class directly. For instance:

var luxcore = require('luxcore');
var Address = luxcore.Address;
var Transaction = luxcore.Transaction;
var PeerManager = luxcore.PeerManager;

#Examples

Examples are provided here Build the examples by installing and running gulp:

npm install -g gulp
gulp

Javascript files available at /examples folder.

#Security

Please use at your own risk.

lux is still under heavy development and not quite ready for "drop-in" production use. If you find a security issue, please email ren@216k155.com

#Contributing

lux needs some developer love. Please send pull requests for bug fixes, code optimization, and ideas for improvement.

#Browser support

Building the browser bundle

To build lux full bundle for the browser (this is automatically executed after you run npm install):

node browser/build.js -a

This will generate a browser/bundle.js file which you can include in your HTML to use lux in the browser.

##Example browser usage

From example/simple.html

<!DOCTYPE html>
<html>
  <body>
    <script src="../browser/bundle.js"></script>
    <script>
      var luxcore = require('luxcore');
      var Address = luxcore.Address;
      var a = new Address('Ldsi32Hcu41MYgQJm2HJZHmP9Mg89vGGqw');
      console.log('Ldsi32Hcu41MYgQJm2HJZHmP9Mg89vGGqw is valid? '+a.isValid());
    </script>
  </body>
</html>

You can check a more complex usage example at examples/example.html.

Generating a customized browser bundle

To build the main lux bundle, run:

node browser/build.js -m

To build all features into the lux bundle (which will lead to a large file size), run:

node browser/build.js -a

To generate a customized lux bundle, you can specify which submodules you want to include in it with the -s option:

node browser/build.js -s lib/Transaction,lib/Address

This will generate a browser/bundle.js containing only the Transaction and Address class, with all their dependencies. Use this option if you are not using the whole lux library, to optimize the bundle size, script loading time, and general resource usage.

Tests

Run tests in node:

mocha

Or generate tests in the browser:

grunt shell

And then open test/index.html in your browser.

To run the code coverage report:

npm run-script coverage

And then open coverage/lcov-report/index.html in your browser.

#License

Bitcore Code released under the MIT license.

Copyright 2013-2014 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.

Bitdeli Badge

About

A full stack for luxcore and blockchain-based applications

License:Other


Languages

Language:JavaScript 92.0%Language:C++ 7.1%Language:Python 0.6%Language:C 0.2%Language:Shell 0.1%