- Add the Plugin to your Cordova project:
cordova plugin add https://github.com/getbitpocket/bitcore-p2p-cordova - Inside the
index.htmlof 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)
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();var pool = new bitcore.p2p.Pool({
network : 'testnet'
});
pool.on('peerready', function(peer) {
console.log("Peer ready " + peer.host + ":" + peer.port);
});
pool.connect();npm install
gulp buildnpm install
gulp test- 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