Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bitcore-node install insight-api-komodo
bitcore-node start
```

The API endpoints will be available by default at: `http://localhost:3001/insight-api/`
The API endpoints will be available by default at: `http://localhost:3001/api/`

## Prerequisites

Expand Down Expand Up @@ -102,38 +102,38 @@ Caching support has not yet been added in the v0.3 upgrade.
To protect the server, insight-api has a built it query rate limiter. It can be configurable in `bitcore-node.json` with:
``` json
"servicesConfig": {
"insight-api": {
"api": {
"rateLimiterOptions": {
"whitelist": ["::ffff:127.0.0.1"]
}
}
}
```
With all the configuration options available: https://github.com/bitpay/insight-api/blob/master/lib/ratelimiter.js#L10-17
With all the configuration options available: https://github.com/veruscoin/insight-api-komodo/blob/master/lib/ratelimiter.js#L10-17

Or disabled entirely with:
``` json
"servicesConfig": {
"insight-api": {
"api": {
"disableRateLimiter": true
}
}
```


## API HTTP Endpoints

### Block
```
/insight-api/block/[:hash]
/insight-api/block/00000000a967199a2fad0877433c93df785a8d8ce062e5f9b451cd1397bdbf62
/api/block/[:hash]
/api/block/00000000a967199a2fad0877433c93df785a8d8ce062e5f9b451cd1397bdbf62
```

### Block Index
Get block hash by height
```
/insight-api/block-index/[:height]
/insight-api/block-index/0
/api/block-index/[:height]
/api/block-index/0
```
This would return:
```
Expand All @@ -146,8 +146,8 @@ which is the hash of the Genesis block (0 height)

### Raw Block
```
/insight-api/rawblock/[:blockHash]
/insight-api/rawblock/[:blockHeight]
/api/rawblock/[:blockHash]
/api/rawblock/[:blockHeight]
```

This would return:
Expand All @@ -161,7 +161,7 @@ This would return:

Get block summaries by date:
```
/insight-api/blocks?limit=3&blockDate=2016-04-22
/api/blocks?limit=3&blockDate=2016-04-22
```

Example response:
Expand Down Expand Up @@ -195,31 +195,31 @@ Example response:

### Transaction
```
/insight-api/tx/[:txid]
/insight-api/tx/525de308971eabd941b139f46c7198b5af9479325c2395db7f2fb5ae8562556c
/insight-api/rawtx/[:rawid]
/insight-api/rawtx/525de308971eabd941b139f46c7198b5af9479325c2395db7f2fb5ae8562556c
/api/tx/[:txid]
/api/tx/525de308971eabd941b139f46c7198b5af9479325c2395db7f2fb5ae8562556c
/api/rawtx/[:rawid]
/api/rawtx/525de308971eabd941b139f46c7198b5af9479325c2395db7f2fb5ae8562556c
```

### Address
```
/insight-api/addr/[:addr][?noTxList=1][&from=&to=]
/insight-api/addr/mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5?noTxList=1
/insight-api/addr/mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5?from=1000&to=2000
/api/addr/[:addr][?noTxList=1][&from=&to=]
/api/addr/mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5?noTxList=1
/api/addr/mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5?from=1000&to=2000
```

### Address Properties
```
/insight-api/addr/[:addr]/balance
/insight-api/addr/[:addr]/totalReceived
/insight-api/addr/[:addr]/totalSent
/insight-api/addr/[:addr]/unconfirmedBalance
/api/addr/[:addr]/balance
/api/addr/[:addr]/totalReceived
/api/addr/[:addr]/totalSent
/api/addr/[:addr]/unconfirmedBalance
```
The response contains the value in Satoshis.

### Unspent Outputs
```
/insight-api/addr/[:addr]/utxo
/api/addr/[:addr]/utxo
```
Sample return:
```
Expand Down Expand Up @@ -250,13 +250,13 @@ Sample return:
### Unspent Outputs for Multiple Addresses
GET method:
```
/insight-api/addrs/[:addrs]/utxo
/insight-api/addrs/2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f/utxo
/api/addrs/[:addrs]/utxo
/api/addrs/2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f/utxo
```

POST method:
```
/insight-api/addrs/utxo
/api/addrs/utxo
```

POST params:
Expand All @@ -266,25 +266,25 @@ addrs: 2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f

### Transactions by Block
```
/insight-api/txs/?block=HASH
/insight-api/txs/?block=00000000fa6cf7367e50ad14eb0ca4737131f256fc4c5841fd3c3f140140e6b6
/api/txs/?block=HASH
/api/txs/?block=00000000fa6cf7367e50ad14eb0ca4737131f256fc4c5841fd3c3f140140e6b6
```
### Transactions by Address
```
/insight-api/txs/?address=ADDR
/insight-api/txs/?address=mmhmMNfBiZZ37g1tgg2t8DDbNoEdqKVxAL
/api/txs/?address=ADDR
/api/txs/?address=mmhmMNfBiZZ37g1tgg2t8DDbNoEdqKVxAL
```

### Transactions for Multiple Addresses
GET method:
```
/insight-api/addrs/[:addrs]/txs[?from=&to=]
/insight-api/addrs/2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f/txs?from=0&to=20
/api/addrs/[:addrs]/txs[?from=&to=]
/api/addrs/2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f/txs?from=0&to=20
```

POST method:
```
/insight-api/addrs/txs
/api/addrs/txs
```

POST params:
Expand Down Expand Up @@ -330,7 +330,7 @@ Note: if pagination params are not specified, the result is an array of transact
### Transaction Broadcasting
POST method:
```
/insight-api/tx/send
/api/tx/send
```
POST params:
```
Expand All @@ -356,17 +356,17 @@ POST response:

### Historic Blockchain Data Sync Status
```
/insight-api/sync
/api/sync
```

### Live Network P2P Data Sync Status
```
/insight-api/peer
/api/peer
```

### Status of the Komodo Network
```
/insight-api/status?q=xxx
/api/status?q=xxx
```

Where "xxx" can be:
Expand All @@ -379,7 +379,7 @@ Where "xxx" can be:

### Utility Methods
```
/insight-api/utils/estimatefee[?nbBlocks=2]
/api/utils/estimatefee[?nbBlocks=2]
```


Expand Down
14 changes: 14 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,26 @@ InsightAPI.prototype.setupRoutes = function(app) {
app.get('/addrs/:addrs/txs', this.cacheShort(), addresses.checkAddrs.bind(addresses), addresses.multitxs.bind(addresses));
app.post('/addrs/txs', this.cacheShort(), addresses.checkAddrs.bind(addresses), addresses.multitxs.bind(addresses));

//Add in double API for external backward compatibility with Iquidus Explorer
app.get('/address/:addr', this.cacheShort(), addresses.checkAddr.bind(addresses), addresses.show.bind(addresses));
app.get('/address/:addr/utxo', this.cacheShort(), addresses.checkAddr.bind(addresses), addresses.utxo.bind(addresses));
app.get('/address/:addrs/utxo', this.cacheShort(), addresses.checkAddrs.bind(addresses), addresses.multiutxo.bind(addresses));
app.post('/address/utxo', this.cacheShort(), addresses.checkAddrs.bind(addresses), addresses.multiutxo.bind(addresses));
app.get('/address/:addrs/txs', this.cacheShort(), addresses.checkAddrs.bind(addresses), addresses.multitxs.bind(addresses));
app.post('/address/txs', this.cacheShort(), addresses.checkAddrs.bind(addresses), addresses.multitxs.bind(addresses));

// Address property routes
app.get('/addr/:addr/balance', this.cacheShort(), addresses.checkAddr.bind(addresses), addresses.balance.bind(addresses));
app.get('/addr/:addr/totalReceived', this.cacheShort(), addresses.checkAddr.bind(addresses), addresses.totalReceived.bind(addresses));
app.get('/addr/:addr/totalSent', this.cacheShort(), addresses.checkAddr.bind(addresses), addresses.totalSent.bind(addresses));
app.get('/addr/:addr/unconfirmedBalance', this.cacheShort(), addresses.checkAddr.bind(addresses), addresses.unconfirmedBalance.bind(addresses));

//Add in double API for external backward compatibility with Iquidus Explorer
app.get('/address/:addr/balance', this.cacheShort(), addresses.checkAddr.bind(addresses), addresses.balance.bind(addresses));
app.get('/address/:addr/totalReceived', this.cacheShort(), addresses.checkAddr.bind(addresses), addresses.totalReceived.bind(addresses));
app.get('/address/:addr/totalSent', this.cacheShort(), addresses.checkAddr.bind(addresses), addresses.totalSent.bind(addresses));
app.get('/address/:addr/unconfirmedBalance', this.cacheShort(), addresses.checkAddr.bind(addresses), addresses.unconfirmedBalance.bind(addresses));

// Chart routes
var chartOptions = {
node: this.node,
Expand Down