How to use the bitcore-lib-cash.Block function in bitcore-lib-cash

To help you get started, we’ve selected a few bitcore-lib-cash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitpay / bitcore / packages / bitcore-p2p-cash / lib / peer.js View on Github external
this._addSocketEventHandlers();
  } else {
    this.host = options.host || 'localhost';
    this.status = Peer.STATUS.DISCONNECTED;
    this.port = options.port;
  }

  this.network = Networks.get(options.network) || Networks.defaultNetwork;

  if (!this.port) {
    this.port = this.network.port;
  }

  this.messages = options.messages || new Messages({
    network: this.network,
    Block: bitcore.Block,
    Transaction: bitcore.Transaction
  });

  this.dataBuffer = new Buffers();

  this.version = 0;
  this.bestHeight = 0;
  this.subversion = null;
  this.relay = options.relay === false ? false : true;

  this.versionSent = false;

  // set message handlers
  var self = this;
  this.on('verack', function() {
    self.status = Peer.STATUS.READY;
github bitpay / bitcore / packages / bitcore-p2p-cash / lib / messages / builder.js View on Github external
function builder(options) {
  /* jshint maxstatements: 20 */
  /* jshint maxcomplexity: 10 */

  if (!options) {
    options = {};
  }

  if (!options.network) {
    options.network = bitcore.Networks.defaultNetwork;
  }

  options.Block = options.Block || bitcore.Block;
  options.BlockHeader = options.BlockHeader || bitcore.BlockHeader;
  options.Transaction = options.Transaction || bitcore.Transaction;
  options.MerkleBlock = options.MerkleBlock || bitcore.MerkleBlock;
  options.protocolVersion = options.protocolVersion || 70001;

  var exported = {
    constructors: {
      Block: options.Block,
      BlockHeader: options.BlockHeader,
      Transaction: options.Transaction,
      MerkleBlock: options.MerkleBlock
    },
    defaults: {
      protocolVersion: options.protocolVersion,
      network: options.network
    },