How to Pass Options To Bitcore/Insight

(Tinkhil Tain) #1

Using bitcore along with insight API installed and running perfectly. I have to change certain options, such as the max number of transactions returned by insight api:

Can’t find a way to pass, although digging around, I found the Hardcoded options in the file: ~/.nvm/versions/node/v4.5.0/lib/node_modules/bitcore/node_modules/bitcore-node/lib/services/bitcoind.js

Bitcoin.prototype._initDefaults = function(options) {
  /* jshint maxcomplexity: 15 */

  // limits
  this.maxTxids = options.maxTxids || Bitcoin.DEFAULT_MAX_TXIDS;
  this.maxTransactionHistory = options.maxTransactionHistory || Bitcoin.DEFAULT_MAX_HISTORY;

Is there a way to pass this options object when using insight API ? Maybe in some config file ? I tried setting maxTransactionHistory in bitcore-node.json, to no effect . I really hope modifying bitcoind.js isn’t the only way to do this.

Edit : I am using insight API like : curl 'http://localhost:3001/insight-api/addrs/1XPTgDRhN8RFnzniWCddobD9iKZatrvH4/txs?from=0&to=51'
Thanks

0 Likes

(Tinkhil Tain) #2

Would really appreciate to know whether this is possible at all?
A simple yes/no would be great.

ty

0 Likes

(Braydon Fuller) #3

Yes, options can be passed into services using:

{
  "servicesConfig": {
    "bitcoind": {
      "spawn": {
        "datadir": "/home/user/.bitcoin",
        "exec":"/home/user/bitcoin/src/bitcoind"
      }
    },
    "insight-api": {
      "enableCache": false,
      "rateLimiterOptions": {
        "whitelist": ["::ffff:127.0.0.1"]
      }
    },
    "web": {
      "jsonRequestLimit": "200kb"
    }
  }
0 Likes