API Documentation


SUBMITTED BY: bitminter

DATE: Sept. 12, 2016, 3:03 p.m.

FORMAT: Text only

SIZE: 1.3 kB

HITS: 53856

  1. API Documentation
  2. start() - Will start the node's services in the correct order based on the dependencies of a service.
  3. stop() - Will stop the node's services.
  4. openBus() - Will create a new event bus to subscribe to events.
  5. getAllAPIMethods() - Returns information about all of the API methods from the services.
  6. getAllPublishEvents() - Returns information about publish events.
  7. getServiceOrder() - Returns an array of service modules.
  8. services.<service-name>.<method> - Additional API methods exposed by each service. The services for the node are defined when the node instance is constructed.
  9. Example Usage
  10. var index = require('bitcore-node');
  11. var Bitcoin = index.services.Bitcoin;
  12. var Node = index.Node;
  13. var configuration = {
  14. datadir: '/home/user/.bitcoin',
  15. network: 'testnet',
  16. services: [
  17. {
  18. name: 'bitcoind',
  19. module: Bitcoin,
  20. config: {}
  21. }
  22. ]
  23. };
  24. var node = new Node(configuration);
  25. node.start(function() {
  26. //start the node so the node.on('ready') is actually called.
  27. });
  28. node.on('ready', function() {
  29. console.log('Bitcoin Node Ready');
  30. });
  31. node.on('error', function(err) {
  32. console.error(err);
  33. });
  34. // shutdown the node
  35. node.stop(function() {
  36. // the shutdown is complete
  37. });

comments powered by Disqus