项目作者: getbitpocket

项目描述 :
Interface to the bitcoin P2P network for Cordova/Phonegap apps
高级语言: JavaScript
项目地址: git://github.com/getbitpocket/bitcore-p2p-cordova.git
创建时间: 2015-12-01T10:52:43Z
项目社区:https://github.com/getbitpocket/bitcore-p2p-cordova

开源协议:Apache License 2.0

下载


Build Status

Interface to the bitcoin P2P network for Cordova/Phonegap apps

Getting Started

  • Add the Plugin to your Cordova project: cordova plugin add https://github.com/getbitpocket/bitcore-p2p-cordova
  • Inside the index.html of your Cordova project add the script: <script type="text/javascript" src="cordova-bitcore.js"></script> (A better solution might be found in the future, which makes this obsolete, however for now it is problematic to automatically add browserified js files)

Example: Connecting to a Peer

  1. var peer = new bitcore.p2p.Peer({host:'bitcoin-peer-ip'});
  2. peer.on('ready',function(message) {
  3. console.log("version: " + peer.version + ", best height: " + peer.bestHeight);
  4. });
  5. peer.on('inv',function(message) {
  6. console.log("received inv message");
  7. });
  8. peer.connect();

Example: Connecting a Pool

  1. var pool = new bitcore.p2p.Pool({
  2. network : 'testnet'
  3. });
  4. pool.on('peerready', function(peer) {
  5. console.log("Peer ready " + peer.host + ":" + peer.port);
  6. });
  7. pool.connect();

Build

  1. npm install
  2. gulp build

Running Unit Tests

  1. npm install
  2. gulp test

Running Cordova Tests

  • Add tests as plugin cordova plugin add https://github.com/getbitpocket/bitcore-p2p-cordova.git#:/integration
  • Follow the Cordova Plugins Tests guide
  • Run the tests by launching app cordova emulate