forked from sn-ntu/insight-api-zcoin
-
Notifications
You must be signed in to change notification settings - Fork 15
/
package.json
153 lines (153 loc) · 18 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
{
"_args": [
[
{
"raw": "firoorg/insight-api-zcoin",
"scope": null,
"escapedName": null,
"name": null,
"rawSpec": "firoorg/insight-api-zcoin",
"spec": "github:firoorg/insight-api-zcoin",
"type": "hosted",
"hosted": {
"type": "github",
"ssh": "[email protected]:firoorg/insight-api-zcoin.git",
"sshUrl": "git+ssh://[email protected]/firoorg/insight-api-zcoin.git",
"httpsUrl": "git+https://github.com/firoorg/insight-api-zcoin.git",
"gitUrl": "git://github.com/firoorg/insight-api-zcoin.git",
"shortcut": "github:firoorg/insight-api-zcoin",
"directUrl": "https://raw.githubusercontent.com/firoorg/insight-api-zcoin/master/package.json"
}
},
"/home/ab_zcoin/Projects/insight/n"
]
],
"_from": "firoorg/insight-api-zcoin",
"_id": "[email protected]",
"_inCache": true,
"_location": "/insight-api-zcoin",
"_phantomChildren": {
"bn.js": "4.11.8",
"bs58": "4.0.1",
"buffer-compare": "1.1.1",
"elliptic": "6.4.0"
},
"_requested": {
"raw": "firoorg/insight-api-zcoin",
"scope": null,
"escapedName": null,
"name": null,
"rawSpec": "firoorg/insight-api-zcoin",
"spec": "github:firoorg/insight-api-zcoin",
"type": "hosted",
"hosted": {
"type": "github",
"ssh": "[email protected]:firoorg/insight-api-zcoin.git",
"sshUrl": "git+ssh://[email protected]/firoorg/insight-api-zcoin.git",
"httpsUrl": "git+https://github.com/firoorg/insight-api-zcoin.git",
"gitUrl": "git://github.com/firoorg/insight-api-zcoin.git",
"shortcut": "github:firoorg/insight-api-zcoin",
"directUrl": "https://raw.githubusercontent.com/firoorg/insight-api-zcoin/master/package.json"
}
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "git://github.com/firoorg/insight-api-zcoin.git#339b61ebaf4e6fb833a9a217c6ad6b151f166408",
"_shasum": "73814a6737b0d66d7b8bc5c1965f1e91fc033ba8",
"_shrinkwrap": null,
"_spec": "firoorg/insight-api-zcoin",
"_where": "/home/ab_zcoin/Projects/insight/n",
"bitcoreNode": "lib",
"bugs": {
"url": "https://github.com/firoorg/insight-api-zcoin/issues"
},
"contributors": [
{
"name": "Gustavo Cortez",
"email": "[email protected]"
},
{
"name": "Ivan Socolsky",
"email": "[email protected]"
},
{
"name": "Juan Ignacio Sosa Lopez",
"email": "[email protected]"
},
{
"name": "Manuel Araoz",
"email": "[email protected]"
},
{
"name": "Matias Alejo Garcia",
"email": "[email protected]"
},
{
"name": "Mario Colque",
"email": "[email protected]"
},
{
"name": "Patrick Nagurny",
"email": "[email protected]"
},
{
"name": "Braydon Fuller",
"email": "[email protected]"
}
],
"dependencies": {
"async": "*",
"bitcore-message-zcoin": "github:firoorg/bitcore-message-zcoin",
"body-parser": "^1.13.3",
"compression": "^1.6.1",
"decimal.js": "^10.0.2",
"functional-red-black-tree": "^1.0.1",
"lodash": "^2.4.1",
"lru-cache": "^4.0.1",
"mongodb": "^3.1.10",
"morgan": "^1.7.0",
"pg-promise": "8.7.5",
"request": "^2.64.0",
"zcore-lib": "github:firoorg/zcore-lib"
},
"description": "A Zcoin blockchain REST and web socket API service for Bitcore Node.",
"devDependencies": {
"chai": "^3.5.0",
"mocha": "^2.4.5",
"proxyquire": "^1.7.2",
"should": "^8.3.1",
"sinon": "^1.10.3"
},
"engines": {
"node": ">=0.12.0"
},
"gitHead": "339b61ebaf4e6fb833a9a217c6ad6b151f166408",
"homepage": "https://github.com/firoorg/insight-api-zcoin",
"keywords": [
"insight",
"insight api",
"blockchain",
"zcoin api",
"blockchain api",
"json",
"bitcore",
"zcoin api",
"bitcore-node-zcoin"
],
"license": "MIT",
"main": "lib",
"name": "insight-api-zcoin",
"optionalDependencies": {},
"readme": "# Insight API Zcoin\n\n\nWork in progress.\n\n#TODO:\n\nCreate public api for Zcoin price ticker, integrate this in currency.js\nCreate bitcore node zcoin.\n\n\"zcore-lib\": \"^0.13.7\", -- changed to github url\n \"bitcore-message-zcoin\": \"^1.0.1\", -- also\n\n\nA Bitcoin blockchain REST and web socket API service for [Bitcore Node Zcoin](https://github.com/sn-ntu/bitcore-node-zcoin).\n\nThis is a backend-only service. If you're looking for the web frontend application, take a look at https://github.com/bitpay/insight-ui.\n\n## Getting Started\n\n```bashl\nnpm install -g bitcore-node-zcoin@latest\nbitcore-node-zcoin create mynode\ncd mynode\nbitcore-node-zcoin install insight-api-zcoin\nbitcore-node-zcoin start\n```\n\n## Since rich list implementation:\nbitcore-node-zcoin.json:\n```{\n \"servicesConfig\": {\n \"insight-api-zcoin\": {\n \"db\": {\n \"url\": \"mongodb://localhost:27017/insight\"\n }\n }\n }\n```\n\nThe API endpoints will be available by default at: `http://localhost:3001/insight-api-zcoin/`\n\n## Prerequisites\n\n- [Bitcore Node 3.x](https://github.com/bitpay/bitcore-node-zcoin)\n\n**Note:** You can use an existing Bitcoin data directory, however `txindex`, `addressindex`, `timestampindex` and `spentindex` needs to be set to true in `bitcoin.conf`, as well as a few other additional fields.\n\n## Notes on Upgrading from v0.3\n\nThe unspent outputs format now has `satoshis` and `height`:\n```\n[\n {\n \"address\":\"mo9ncXisMeAoXwqcV5EWuyncbmCcQN4rVs\",\n \"txid\":\"d5f8a96faccf79d4c087fa217627bb1120e83f8ea1a7d84b1de4277ead9bbac1\",\n \"vout\":0,\n \"scriptPubKey\":\"76a91453c0307d6851aa0ce7825ba883c6bd9ad242b48688ac\",\n \"amount\":0.000006,\n \"satoshis\":600,\n \"confirmations\":0,\n \"ts\":1461349425\n },\n {\n \"address\": \"mo9ncXisMeAoXwqcV5EWuyncbmCcQN4rVs\",\n \"txid\": \"bc9df3b92120feaee4edc80963d8ed59d6a78ea0defef3ec3cb374f2015bfc6e\",\n \"vout\": 1,\n \"scriptPubKey\": \"76a91453c0307d6851aa0ce7825ba883c6bd9ad242b48688ac\",\n \"amount\": 0.12345678,\n \"satoshis: 12345678,\n \"confirmations\": 1,\n \"height\": 300001\n }\n]\n```\nThe `timestamp` property will only be set for unconfirmed transactions and `height` can be used for determining block order. The `confirmationsFromCache` is nolonger set or necessary, confirmation count is only cached for the time between blocks.\n\nThere is a new `GET` endpoint or raw blocks at `/rawblock/<blockHash>`:\n\nResponse format:\n```\n{\n \"rawblock\": \"blockhexstring...\"\n}\n```\n\nThere are a few changes to the `GET` endpoint for `/addr/[:address]`:\n\n- The list of txids in an address summary does not include orphaned transactions\n- The txids will be sorted in block order\n- The list of txids will be limited at 1000 txids\n- There are two new query options \"from\" and \"to\" for pagination of the txids (e.g. `/addr/[:address]?from=1000&to=2000`)\n\nSome additional general notes:\n- The transaction history for an address will be sorted in block order\n- The response for the `/sync` endpoint does not include `startTs` and `endTs` as the sync is no longer relevant as indexes are built in bitcoind.\n- The endpoint for `/peer` is no longer relevant connection to bitcoind is via ZMQ.\n- `/tx` endpoint results will now include block height, and spentTx related fields will be set to `null` if unspent.\n- `/block` endpoint results does not include `confirmations` and will include `poolInfo`.\n\n## Notes on Upgrading from v0.2\n\nSome of the fields and methods are not supported:\n\nThe `/tx/<txid>` endpoint JSON response will not include the following fields on the \"vin\"\nobject:\n- `doubleSpentTxId` // double spends are not currently tracked\n- `isConfirmed` // confirmation of the previous output\n- `confirmations` // confirmations of the previous output\n- `unconfirmedInput`\n\nThe `/tx/<txid>` endpoint JSON response will not include the following fields on the \"vout\"\nobject.\n- `spentTs`\n\nThe `/status?q=getTxOutSetInfo` method has also been removed due to the query being very slow and locking bitcoind.\n\nPlug-in support for Insight API is also no longer available, as well as the endpoints:\n- `/email/retrieve`\n- `/rates/:code`\n\nCaching support has not yet been added in the v0.3 upgrade.\n\n## Query Rate Limit\n\nTo protect the server, insight-api-zcoin has a built it query rate limiter. It can be configurable in `bitcore-node-zcoin.json` with:\n``` json\n \"servicesConfig\": {\n \"insight-api-zcoin\": {\n \"rateLimiterOptions\": {\n \"whitelist\": [\"::ffff:127.0.0.1\"]\n }\n }\n }\n```\nWith all the configuration options available: https://github.com/bitpay/insight-api-zcoin/blob/master/lib/ratelimiter.js#L10-17\n\nOr disabled entirely with:\n``` json\n \"servicesConfig\": {\n \"insight-api-zcoin\": {\n \"disableRateLimiter\": true\n }\n }\n ```\n \n\n## API HTTP Endpoints\n\n### Block\n```\n /insight-api-zcoin/block/[:hash]\n /insight-api-zcoin/block/00000000a967199a2fad0877433c93df785a8d8ce062e5f9b451cd1397bdbf62\n```\n\n### Block Index\nGet block hash by height\n```\n /insight-api-zcoin/block-index/[:height]\n /insight-api-zcoin/block-index/0\n```\nThis would return:\n```\n{\n \"blockHash\":\"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f\"\n}\n```\nwhich is the hash of the Genesis block (0 height)\n\n\n### Raw Block\n```\n /insight-api-zcoin/rawblock/[:blockHash]\n /insight-api-zcoin/rawblock/[:blockHeight]\n```\n\nThis would return:\n```\n{\n \"rawblock\":\"blockhexstring...\"\n}\n```\n\n### Block Summaries\n\nGet block summaries by date:\n```\n /insight-api-zcoin/blocks?limit=3&blockDate=2016-04-22\n```\n\nExample response:\n```\n{\n \"blocks\": [\n {\n \"height\": 408495,\n \"size\": 989237,\n \"hash\": \"00000000000000000108a1f4d4db839702d72f16561b1154600a26c453ecb378\",\n \"time\": 1461360083,\n \"txlength\": 1695,\n \"poolInfo\": {\n \"poolName\": \"BTCC Pool\",\n \"url\": \"https://pool.btcc.com/\"\n }\n }\n ],\n \"length\": 1,\n \"pagination\": {\n \"next\": \"2016-04-23\",\n \"prev\": \"2016-04-21\",\n \"currentTs\": 1461369599,\n \"current\": \"2016-04-22\",\n \"isToday\": true,\n \"more\": true,\n \"moreTs\": 1461369600\n }\n}\n```\n\n### Transaction\n```\n /insight-api-zcoin/tx/[:txid]\n /insight-api-zcoin/tx/525de308971eabd941b139f46c7198b5af9479325c2395db7f2fb5ae8562556c\n /insight-api-zcoin/rawtx/[:rawid]\n /insight-api-zcoin/rawtx/525de308971eabd941b139f46c7198b5af9479325c2395db7f2fb5ae8562556c\n```\n\n### Address\n```\n /insight-api-zcoin/addr/[:addr][?noTxList=1][&from=&to=]\n /insight-api-zcoin/addr/mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5?noTxList=1\n /insight-api-zcoin/addr/mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5?from=1000&to=2000\n```\n\n### Address Properties\n```\n /insight-api-zcoin/addr/[:addr]/balance\n /insight-api-zcoin/addr/[:addr]/totalReceived\n /insight-api-zcoin/addr/[:addr]/totalSent\n /insight-api-zcoin/addr/[:addr]/unconfirmedBalance\n```\nThe response contains the value in Satoshis.\n\n### Unspent Outputs\n```\n /insight-api-zcoin/addr/[:addr]/utxo\n```\nSample return:\n```\n[\n {\n \"address\":\"mo9ncXisMeAoXwqcV5EWuyncbmCcQN4rVs\",\n \"txid\":\"d5f8a96faccf79d4c087fa217627bb1120e83f8ea1a7d84b1de4277ead9bbac1\",\n \"vout\":0,\n \"scriptPubKey\":\"76a91453c0307d6851aa0ce7825ba883c6bd9ad242b48688ac\",\n \"amount\":0.000006,\n \"satoshis\":600,\n \"confirmations\":0,\n \"ts\":1461349425\n },\n {\n \"address\": \"mo9ncXisMeAoXwqcV5EWuyncbmCcQN4rVs\",\n \"txid\": \"bc9df3b92120feaee4edc80963d8ed59d6a78ea0defef3ec3cb374f2015bfc6e\",\n \"vout\": 1,\n \"scriptPubKey\": \"76a91453c0307d6851aa0ce7825ba883c6bd9ad242b48688ac\",\n \"amount\": 0.12345678,\n \"satoshis: 12345678,\n \"confirmations\": 1,\n \"height\": 300001\n }\n]\n```\n\n### Unspent Outputs for Multiple Addresses\nGET method:\n```\n /insight-api-zcoin/addrs/[:addrs]/utxo\n /insight-api-zcoin/addrs/2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f/utxo\n```\n\nPOST method:\n```\n /insight-api-zcoin/addrs/utxo\n```\n\nPOST params:\n```\naddrs: 2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f\n```\n\n### Transactions by Block\n```\n /insight-api-zcoin/txs/?block=HASH\n /insight-api-zcoin/txs/?block=00000000fa6cf7367e50ad14eb0ca4737131f256fc4c5841fd3c3f140140e6b6\n```\n### Transactions by Address\n```\n /insight-api-zcoin/txs/?address=ADDR\n /insight-api-zcoin/txs/?address=mmhmMNfBiZZ37g1tgg2t8DDbNoEdqKVxAL\n```\n\n### Transactions for Multiple Addresses\nGET method:\n```\n /insight-api-zcoin/addrs/[:addrs]/txs[?from=&to=]\n /insight-api-zcoin/addrs/2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f/txs?from=0&to=20\n```\n\nPOST method:\n```\n /insight-api-zcoin/addrs/txs\n```\n\nPOST params:\n```\naddrs: 2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f\nfrom (optional): 0\nto (optional): 20\nnoAsm (optional): 1 (will omit script asm from results)\nnoScriptSig (optional): 1 (will omit the scriptSig from all inputs)\nnoSpent (option): 1 (will omit spent information per output)\n```\n\nSample output:\n```\n{ totalItems: 100,\n from: 0,\n to: 20,\n items:\n [ { txid: '3e81723d069b12983b2ef694c9782d32fca26cc978de744acbc32c3d3496e915',\n version: 1,\n locktime: 0,\n vin: [Object],\n vout: [Object],\n blockhash: '00000000011a135e5277f5493c52c66829792392632b8b65429cf07ad3c47a6c',\n confirmations: 109367,\n time: 1393659685,\n blocktime: 1393659685,\n valueOut: 0.3453,\n size: 225,\n firstSeenTs: undefined,\n valueIn: 0.3454,\n fees: 0.0001 },\n { ... },\n { ... },\n ...\n { ... }\n ]\n }\n```\n\nNote: if pagination params are not specified, the result is an array of transactions.\n\n### Transaction Broadcasting\nPOST method:\n```\n /insight-api-zcoin/tx/send\n```\nPOST params:\n```\n rawtx: \"signed transaction as hex string\"\n\n eg\n\n rawtx: 01000000017b1eabe0209b1fe794124575ef807057c77ada2138ae4fa8d6c4de0398a14f3f00000000494830450221008949f0cb400094ad2b5eb399d59d01c14d73d8fe6e96df1a7150deb388ab8935022079656090d7f6bac4c9a94e0aad311a4268e082a725f8aeae0573fb12ff866a5f01ffffffff01f0ca052a010000001976a914cbc20a7664f2f69e5355aa427045bc15e7c6c77288ac00000000\n\n```\nPOST response:\n```\n {\n txid: [:txid]\n }\n\n eg\n\n {\n txid: \"c7736a0a0046d5a8cc61c8c3c2821d4d7517f5de2bc66a966011aaa79965ffba\"\n }\n```\n\n### Historic Blockchain Data Sync Status\n```\n /insight-api-zcoin/sync\n```\n\n### Live Network P2P Data Sync Status\n```\n /insight-api-zcoin/peer\n```\n\n### Status of the Bitcoin Network\n```\n /insight-api-zcoin/status?q=xxx\n```\n\nWhere \"xxx\" can be:\n\n * getInfo\n * getDifficulty\n * getBestBlockHash\n * getLastBlockHash\n\n\n### Utility Methods\n```\n /insight-api-zcoin/utils/estimatefee[?nbBlocks=2]\n```\n\n\n## Web Socket API\nThe web socket API is served using [socket.io](http://socket.io).\n\nThe following are the events published by insight:\n\n`tx`: new transaction received from network. This event is published in the 'inv' room. Data will be a app/models/Transaction object.\nSample output:\n```\n{\n \"txid\":\"00c1b1acb310b87085c7deaaeba478cef5dc9519fab87a4d943ecbb39bd5b053\",\n \"processed\":false\n ...\n}\n```\n\n\n`block`: new block received from network. This event is published in the `inv` room. Data will be a app/models/Block object.\nSample output:\n```\n{\n \"hash\":\"000000004a3d187c430cd6a5e988aca3b19e1f1d1727a50dead6c8ac26899b96\",\n \"time\":1389789343,\n ...\n}\n```\n\n`<bitcoinAddress>`: new transaction concerning <bitcoinAddress> received from network. This event is published in the `<bitcoinAddress>` room.\n\n`status`: every 1% increment on the sync task, this event will be triggered. This event is published in the `sync` room.\n\nSample output:\n```\n{\n blocksToSync: 164141,\n syncedBlocks: 475,\n upToExisting: true,\n scanningBackward: true,\n isEndGenesis: true,\n end: \"000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943\",\n isStartGenesis: false,\n start: \"000000009f929800556a8f3cfdbe57c187f2f679e351b12f7011bfc276c41b6d\"\n}\n```\n\n### Example Usage\n\nThe following html page connects to the socket.io insight API and listens for new transactions.\n\nhtml\n```\n<html>\n<body>\n <script src=\"http://<insight-server>:<port>/socket.io/socket.io.js\"></script>\n <script>\n eventToListenTo = 'tx'\n room = 'inv'\n\n var socket = io(\"http://<insight-server>:<port>/\");\n socket.on('connect', function() {\n // Join the room.\n socket.emit('subscribe', room);\n })\n socket.on(eventToListenTo, function(data) {\n console.log(\"New transaction received: \" + data.txid)\n })\n </script>\n</body>\n</html>\n```\n\n## License\n(The MIT License)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git://github.com/sn-ntu/insight-api-zcoin.git"
},
"scripts": {
"test": "NODE_ENV=test mocha -R spec --recursive"
},
"version": "0.4.5"
}