From 1eff18b9b964fed90a44e5111a6f7bb892f2679e Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Fri, 31 Jan 2014 13:21:32 -0300 Subject: [PATCH 1/4] Empty page for Developers. Fix responsive menu. --- public/css/common.css | 13 +++++++------ public/js/config.js | 6 +++++- public/js/controllers/header.js | 4 ++++ public/views/developers.html | 8 ++++++++ 4 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 public/views/developers.html diff --git a/public/css/common.css b/public/css/common.css index 2bb5a11..714212b 100644 --- a/public/css/common.css +++ b/public/css/common.css @@ -55,15 +55,16 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { display: block; } -@media (min-width: 768px) { - .navbar-form { - width: 30%; - } +.navbar-form { + width: 30%; } -@media (max-width: 768px) { +@media (max-width: 991px) { .status { - margin: 0 14px !important; + margin: 0; + } + .navbar-form { + width: 20%; } } diff --git a/public/js/config.js b/public/js/config.js index 3aeedbb..d367e71 100755 --- a/public/js/config.js +++ b/public/js/config.js @@ -35,7 +35,11 @@ angular.module('insight').config(function($routeProvider) { templateUrl: '/views/status.html', title: 'Status' }). - otherwise({ + when('/developers', { + templateUrl: '/views/developers.html', + title: 'Developers' + }) + .otherwise({ templateUrl: '/views/404.html', title: 'Error' }); diff --git a/public/js/controllers/header.js b/public/js/controllers/header.js index e5fa3ac..3b17ec5 100755 --- a/public/js/controllers/header.js +++ b/public/js/controllers/header.js @@ -12,6 +12,10 @@ angular.module('insight.system').controller('HeaderController', { 'title': 'Status', 'link': 'status' + }, + { + 'title': 'Developers', + 'link': 'developers' } ]; diff --git a/public/views/developers.html b/public/views/developers.html new file mode 100644 index 0000000..d854ece --- /dev/null +++ b/public/views/developers.html @@ -0,0 +1,8 @@ +
+ +
+ From da75d543f2d9920427c66ed2de6b9e460cdc6bc1 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Fri, 31 Jan 2014 19:16:35 -0300 Subject: [PATCH 2/4] added API documentation to developers page --- public/views/developers.html | 301 ++++++++++++++++++++++++++++++++++- 1 file changed, 300 insertions(+), 1 deletion(-) diff --git a/public/views/developers.html b/public/views/developers.html index d854ece..e153f6a 100644 --- a/public/views/developers.html +++ b/public/views/developers.html @@ -1,8 +1,307 @@
+

Overview

+

The Insight REST API provides you with a convenient, powerful and simple way to read data from the bitcoin network and build your own services with it.

+

The REST API currently only supports JSON for the response formats.

+

The API is free to use.

+ +

API Reference

+ +

Blocks

+ +

Get Block

+ +

URI:

+ +
/api/block/00000000009890591fbacf147ffc6c246fa7bad0f2c75a68e3e1ba48b1636d23
+ +

Result:

+ +
+{
+  hash: "00000000009890591fbacf147ffc6c246fa7bad0f2c75a68e3e1ba48b1636d23",
+  confirmations: 37,
+  size: 1287,
+  height: 177951,
+  version: 2,
+  merkleroot: "4d549d51e0bca64030b7f3ab74fcc9a82f3de7bba5d6c3f9a8cb2028399fc590",
+  tx: [
+    "1b8354de2102f0f3f72f7e59fd3fdc0a406fa92675a78d7bb1f599067685385a",
+    "babe2d8b24649df7951e696a4b1686e28764d2d7bbf94d45f612ff598a14017d",
+    "0351d523fec44a04990b8f9513c44b358eac8b88d5df1074ed36d3ffef5f1582",
+    "09f1a8dd15a989377753690f2293e5509fa0763a26af661cf7b56eebc6999c59",
+    "04d972767c5500805ccd41961e2b538b5334af3e41635b2a2ec3750a3c96565a",
+    "df11424536f618ba511436702f97e886b83a1a0e7d1578a26160177274ca0a39"
+  ],
+  time: 1391192318,
+  nonce: 2374664549,
+  bits: "1c00ffff",
+  difficulty: 256,
+  chainwork: "0000000000000000000000000000000000000000000000000413951687599d9f",
+  previousblockhash: "000000000034a41747ec564a890d8192fbd2ec0bfa71667b81db145575cde08e",
+  nextblockhash: "0000000000868ef72603e45325fc0464a5424b7539c51f5905e0ffd2bafc7115",
+  reward: 50
+}
+ +

Get Block information by date

+ +

URI:

+ +
/api/blocks/?blockDate=yyyy-mm-dd
+ +

Result:

+ +
+{
+  blocks: [ Array information of blocks ],
+  length: 2636,
+  pagination: {
+    next: "2014-01-30",
+    prev: "2014-01-28",
+    current: "2014-01-29",
+    isToday: false
+  }
+}
+ +

Get hash of block by height

+ +

URI:

+ +
/api/block-index/0
+ +

Result:

+ +
+{
+  blockHash: "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"
+}
+ +

Transactions

+ +

Get Transaction

+ +

URI:

+ +
/api/tx/0099d9342edab8a59fa4d84cb807cf599ce2210e5240bc39500d8f6b6f4779c0
+ +

Result:

+ +
+{
+  hex: "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0d0358b702017e062f503253482fffffffff01108a082a010000002321029f58ed5b58f1941664d67bcc2ccb5b25c50cc2324ccc9643ff7f8271118c4609ac00000000",
+  txid: "0099d9342edab8a59fa4d84cb807cf599ce2210e5240bc39500d8f6b6f4779c0",
+  version: 1,
+  locktime: 0,
+  vin: [
+    {
+      coinbase: "0358b702017e062f503253482f",
+      sequence: 4294967295,
+      reward: 50,
+      n: 0
+    }
+  ],
+  vout: [
+    {
+      value: 50.0017,
+      n: 0,
+      scriptPubKey: {
+        asm: "029f58ed5b58f1941664d67bcc2ccb5b25c50cc2324ccc9643ff7f8271118c4609 OP_CHECKSIG",
+        hex: "21029f58ed5b58f1941664d67bcc2ccb5b25c50cc2324ccc9643ff7f8271118c4609ac",
+        reqSigs: 1,
+        type: "pubkey",
+        addresses: [
+          "mt3r2JMiWqGkHUiMqduo2HoHw5iAHMT7P9"
+        ]
+      }
+    }
+  ],
+  blockhash: "0000000000478e746e78012066a14db61ee9a447b35607a42b54d15060eb23d6",
+  confirmations: 10,
+  time: 1391201940,
+  blocktime: 1391201940,
+  isCoinBase: true,
+  valueIn: 50,
+  valueOut: 50.0017,
+  size: 108
+}
+
+ +

Get Transactions by BlockHash

+ +

URI:

+ +
/api/txs/?block=0000000001a6b96db5e1af9f01458c5f0dd880d9cce6e9ed200afb9f0941991b&pageNum=1
+ +

Result:

+ +
+{
+  pagesTotal: 2,
+  txs: [ Array of Transactions ]
+}
+
+ +

Get Transactions by String Address

+ +

URI:

+ +
/api/txs/?address=mqxfgc12qXdm4ekLrCKPDYqamxUEtK78Vg&pageNum=0
+ +

Result:

+ +
+{
+  pagesTotal: 4,
+  txs: [ Array of Transactions ]
+}
+
+ +

Address

+ +

Get Address

+ +

URI:

+ +
/api/addr/mqxfgc12qXdm4ekLrCKPDYqamxUEtK78Vg
+ +

Result:

+ +
+{
+  balanceSat: 5031766000,
+  totalReceivedSat: 5853132000,
+  totalSentSat: 821366000,
+  txApperances: 66,
+  transactions: [ Array of Transaction IDs ],
+  addrStr: "mqxfgc12qXdm4ekLrCKPDYqamxUEtK78Vg",
+  totalSent: 8.21366,
+  balance: 50.31766,
+  totalReceived: 58.53132
+}
+
+ +

Application Status

+ +

Get Information

+ +

URI:

+ +
/api/status?q=getInfo
+ +

Result:

+ +
+{
+  info: {
+    version: 89900,
+    protocolversion: 70002,
+    walletversion: 60000,
+    balance: 0,
+    blocks: 178019,
+    timeoffset: -345,
+    connections: 9,
+    proxy: "",
+    difficulty: 1,
+    testnet: true,
+    keypoololdest: 1389273625,
+    keypoolsize: 101,
+    paytxfee: 0,
+    errors: "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
+  }
+}
+
+ +

Get Difficulty

+ +

URI:

+ +
/api/status?q=getDifficulty
+ +

Result:

+ +
+{
+  difficulty: 1
+}
+
+ +

Get TxOutSetInfo

+ +

URI:

+ +
/api/status?q=getTxOutSetInfo
+ +

Result:

+ +
+{
+  txoutsetinfo: {
+    height: 178020,
+    bestblock: "00000000fc182ffd65fa397dbe0c60b1932bee4ccef407b36b7d6d9d5fdb5962",
+    transactions: 242191,
+    txouts: 421180,
+    bytes_serialized: 25490639,
+    hash_serialized: "68decf93d8c883a31c061fcd393966d36fbed07c05b4df739da85585cb70e077",
+    total_amount: 8900499.25420614
+  }
+}
+
+ +

Get Last Block Hash

+ +

URI:

+ +
/api/status?q=getLastBlockHash
+ +

Result:

+ +
+{
+  lastblockhash: "00000000fc182ffd65fa397dbe0c60b1932bee4ccef407b36b7d6d9d5fdb5962"
+}
+
+ +

Server Information

+ +

Get information of Bitcoin synchronization

+ +

URI:

+ +
/api/sync
+ +

Result:

+ +
+{
+  status: "finished",
+  blockChainHeight: 178009,
+  syncPercentage: 100,
+  skippedBlocks: 0,
+  syncedBlocks: 178011,
+  error: null
+}
+
+ +

Get API Version

+ +

URI:

+ +
/api/version
+ +

Result:

+ +
+{
+  version: "0.0.1"
+}
+
+ +

Sandbox for test API

+ +

API live documentation

From c4a05c10607622e20be552507c418fca5695ec0d Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Mon, 3 Feb 2014 10:35:12 -0300 Subject: [PATCH 3/4] color in developer: titles --- public/css/common.css | 10 ++++++ public/views/developers.html | 64 +++++++++++++++++++++--------------- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/public/css/common.css b/public/css/common.css index 714212b..2820dbf 100644 --- a/public/css/common.css +++ b/public/css/common.css @@ -33,6 +33,12 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { .vm { vertical-align: middle; } +.hightlight_h { + color: blue; + padding-bottom: 5px; + border-bottom: 1px solid #eee; +} + .navbar-default { background-color: #8DC429; border-bottom: 4px solid #64920F; @@ -68,6 +74,10 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { } } +.nav-tabs.nav-justified>li>a:hover { + cursor: pointer; +} + .insight { font-family: 'Ubuntu', sans-serif; font-size: 34px; diff --git a/public/views/developers.html b/public/views/developers.html index e153f6a..a867ecb 100644 --- a/public/views/developers.html +++ b/public/views/developers.html @@ -4,17 +4,23 @@ Developers API Documentation + + + +

Overview

The Insight REST API provides you with a convenient, powerful and simple way to read data from the bitcoin network and build your own services with it.

The REST API currently only supports JSON for the response formats.

The API is free to use.

- +
+ +

API Reference

-

Blocks

+

Blocks

Get Block

- +

URI:

/api/block/00000000009890591fbacf147ffc6c246fa7bad0f2c75a68e3e1ba48b1636d23
@@ -48,7 +54,7 @@ }

Get Block information by date

- +

URI:

/api/blocks/?blockDate=yyyy-mm-dd
@@ -68,7 +74,7 @@ }

Get hash of block by height

- +

URI:

/api/block-index/0
@@ -80,10 +86,10 @@ blockHash: "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" } -

Transactions

+

Transactions

Get Transaction

- +

URI:

/api/tx/0099d9342edab8a59fa4d84cb807cf599ce2210e5240bc39500d8f6b6f4779c0
@@ -128,10 +134,10 @@ valueOut: 50.0017, size: 108 } - +

Get Transactions by BlockHash

- +

URI:

/api/txs/?block=0000000001a6b96db5e1af9f01458c5f0dd880d9cce6e9ed200afb9f0941991b&pageNum=1
@@ -143,10 +149,10 @@ pagesTotal: 2, txs: [ Array of Transactions ] } - +

Get Transactions by String Address

- +

URI:

/api/txs/?address=mqxfgc12qXdm4ekLrCKPDYqamxUEtK78Vg&pageNum=0
@@ -158,12 +164,12 @@ pagesTotal: 4, txs: [ Array of Transactions ] } - + -

Address

+

Address

Get Address

- +

URI:

/api/addr/mqxfgc12qXdm4ekLrCKPDYqamxUEtK78Vg
@@ -182,12 +188,12 @@ balance: 50.31766, totalReceived: 58.53132 } - + -

Application Status

+

Application Status

Get Information

- +

URI:

/api/status?q=getInfo
@@ -213,10 +219,10 @@ errors: "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications" } } - +

Get Difficulty

- +

URI:

/api/status?q=getDifficulty
@@ -227,10 +233,10 @@ { difficulty: 1 } - +

Get TxOutSetInfo

- +

URI:

/api/status?q=getTxOutSetInfo
@@ -249,10 +255,10 @@ total_amount: 8900499.25420614 } } - +

Get Last Block Hash

- +

URI:

/api/status?q=getLastBlockHash
@@ -263,9 +269,9 @@ { lastblockhash: "00000000fc182ffd65fa397dbe0c60b1932bee4ccef407b36b7d6d9d5fdb5962" } - + -

Server Information

+

Server Information

Get information of Bitcoin synchronization

@@ -284,7 +290,7 @@ syncedBlocks: 178011, error: null } - +

Get API Version

@@ -298,10 +304,14 @@ { version: "0.0.1" } - + +
+ +

Sandbox for test API

API live documentation

+
From 6b362d5e7b5fd7a1976c5d261e643802a05191ec Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Mon, 3 Feb 2014 10:39:16 -0300 Subject: [PATCH 4/4] added top messages --- public/views/developers.html | 1 + 1 file changed, 1 insertion(+) diff --git a/public/views/developers.html b/public/views/developers.html index a867ecb..aac25e4 100644 --- a/public/views/developers.html +++ b/public/views/developers.html @@ -1,3 +1,4 @@ +