Skip to content

getbitpocket/bitcore-p2p-cordova

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

var peer = new bitcore.p2p.Peer({host:'bitcoin-peer-ip'});

peer.on('ready',function(message) {
  console.log("version: " + peer.version + ", best height: " + peer.bestHeight);
});

peer.on('inv',function(message) {
  console.log("received inv message");
});

peer.connect();

Example: Connecting a Pool

var pool = new bitcore.p2p.Pool({
    network : 'testnet'
});

pool.on('peerready', function(peer) {
    console.log("Peer ready " + peer.host + ":" + peer.port);    
});

pool.connect();

Build

npm install
gulp build

Running Unit Tests

npm install
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

About

Interface to the bitcoin P2P network for Cordova/Phonegap apps

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published