bitpay / insight-api

The bitcoin blockchain API powering Insight
https://github.com/bitpay/insight
589 stars 1.04k forks source link

Transactions by Block/Address not very restful #297

Open liferealized opened 9 years ago

liferealized commented 9 years ago

Currently, the API allows for finding transactions scoped to a block or address.

/api/txs/?block=HASH

/api/txs/?address=ADDR

I believe the proper way of including this type of functionality within a REST API would be something similar to:

/api/block/HASH/tx <- gets all txs for block

/api/addr/ADDR/tx <- gets all txs for an address

maraoz commented 9 years ago

Agreed. We're working on a new spec for the API (which we'll implement in https://github.com/bitpay/bitcore-node). Feel free to check it out and comment/give feedback https://docs.google.com/document/d/1rXQdfr8VDBSzheEn0KynnCKCMB0oAsMunkjdG4aY-18

liferealized commented 9 years ago

Will bitcore-node end up replacing the insight api?

maraoz commented 9 years ago

Not completely. insight-api is currently way too many things (blockchain API, credential storage service, mailbox plugin, historic bitcoin rate service, etc). We're approaching bitcore-node as a more atomic and well-tested version of the blockchain API.

liferealized commented 9 years ago

Understood. Thanks for the clarifications. I've looked over the documentation and you've included the best standard suggested which is awesome.

Can't wait to see it integrated into insight!

dcousens commented 9 years ago

@maraoz would you be open to providing compatibility end points for a https://github.com/dcousens/common-blockchain compliant API?

edit: moved my question to here

posita commented 9 years ago

Not completely. insight-api is currently way too many things (blockchain API, credential storage service, mailbox plugin, historic bitcoin rate service, etc). We're approaching bitcore-node as a more atomic and well-tested version of the blockchain API.

@maraoz, what's the strategy for insight (the UI) then? What will the stack look like?

+--------------+
| insight (UI) |        +-----------------------------+
+------v-------+        |         insight (UI)        |         ___
| insight-api  |        +------v-------+------v-------+        |__ \
+------v-------+  -or-  | insight-api  > bitcore-node |  -or-    / /
| bitcore-node |        +------v-------+------v-------+         |_|
+------v-------+        |          bitcoind           |         (_)
|   bitcoind   |        +-----------------------------+
+--------------+

Or are insight/insight-api going to be EOL'ed?

braydonf commented 9 years ago

@posita Current plan is for bitcore-node to run a variety of services, including something similar to insight-api, as well as others.

posita commented 9 years ago

@maraoz wrote:

insight-api is currently way too many things (blockchain API, credential storage service, mailbox plugin, historic bitcoin rate service, etc). We're approaching bitcore-node as a more atomic and well-tested version of the blockchain API.

@braydonf wrote:

@posita Current plan is for bitcore-node to run a variety of services, including something similar to insight-api, as well as others.

Forgive me, but I'm having trouble reconciling these two things. Are you saying the plan is to do something like this?

+--------------+
| insight (UI) |  <-  or possibly something else with a reduced feature set?
+------v-------+
| bitcore-node |
+------v-------+
|   bitcoind   |
+--------------+

What about the "way too many things" that the insight API does (that @maraoz was talking about)? Will those be EOL'ed?

Also, please forgive my ignorance, but it appears (at least for now) that bitcore-node is a Javascript library, not a REST endpoint. Have I misunderstood?

braydonf commented 9 years ago

That's correct, any type of API exposed would be a service run on top of bitcore-node. However keep in mind that many of the details are still actively being developed. Also feel free to jump on the gitter bitcore channel to ask other questions, since this may be off-topic to this issue.

posita commented 9 years ago

@braydonf, thanks! Yeah, I tried asking some questions on Gitter a while back, but there wasn't very much activity, and some of my questions went unanswered. I'll try again though. I apologize for this being off-topic. One more question:

... any type of API exposed would be a service run on top of bitcore-node ...

I understand things are in flux, but does that mean there are plans to build a bitcore-node-based replacement for insight (the UI/block explorer) or insight-api (the REST endpoint), or is that going to be left up to third parties?

braydonf commented 8 years ago

For reference the updated blockchain api mentioned previously by @maraoz can be viewed at: https://github.com/bitpay/bitcore-node/tree/v0.1.0/api and could make an additional service for bitcore-node, as well as common-blockchain @dcousens.

dcousens commented 8 years ago

More specifically the bitcore-node API can be seen clearly here