Open dahemmer opened 5 years ago
In short - no.
Every capability that the API exposes means more storage used, or more computing power. If we expose the ability to get all accounts with a balance > 10k, it means we either need to maintain an index, or iterate over all the account when this information is requested.
Which is fine in an API server, but Sebak is the core node of BOSnet. We had discussions about splitting the two (Horizon/Stellar-core like), but didn't have time to address it before BOSCON. If/When this is done, that's definitely somewhere where we will have more freedom.
This issue, extending the capability of API will be always welcome. As you suggested API should provide the sophisticated way to get the specific data. As @Geod24 said, devteam already have discussed how to extend API and how to make node to be simpler. At this time, I suggest to use watcher mode + jsonrpc for storage. You can run SEBAK node as watcher mode and you can access the node storage thru jsonrpc.
Sometimes, I feel that RPC or GraphQL is better than REST API for supporting like balance > 10000 BOS
. But I am not sure that queries like balance > 10000 BOS
is available with generally blockchain nodes such as btcd
or ethd
.
I'm creating this issue to debate the features and responsabilities of the SEBAK API.
The SEBAK API provides endpoints to obtain data such as blocks, transactions, operations, accounts, etc. This allows third parties to get the SEBAK blockchain state in real-time.
Third parties currently have two options to query data, through path parameters and through query parameters.
Path parameters
/blocks/{height}
returns the block for the provided height/accounts/{address}
returns the account for the provided address/transactions/{hash}
returns the transaction for the provided hashQuery parameters
limit=x
returns x amount of recordsreverse=x
sorts data in x ordercursor=x
returns data starting from cursor xWhile these options allow third parties to retrieve specific information, they don't provide many ways to query the data. If a third party for example wants to obtain all accounts having a balance > 10000 BOS, then there is no way to actually to retrieve this data through the use of the SEBAK API. This is just one example, but the possibilities could be endless as far as querying options are concerned.
Will the SEBAK API ever expose endpoints and query parameters for statistical purposes and data analysis? Would that be considered as a (future) responsability of the SEBAK API?