bitshares / bitshares-core

BitShares Blockchain node and command-line wallet
https://bitshares.github.io/
Other
1.17k stars 647 forks source link

given unix time get head and irreversible block number from api #2498

Open litepresence opened 3 years ago

litepresence commented 3 years ago

User Story currently user can approach api with block number and get time stamp but not the other way around.

user made a bitshares transaction at some time in the past. they know the time it occurred from their records, but not the block number or transaction hash. user would like to audit that transaction; and obtain a full receipt of the event.

user wishes to approach api and give a unix timestamp.
api should return head block at that time in the past; perhaps the actual unix blocktime for the block

this makes auditing transactions easier from user perspective.

the current alternative is to approximate the block number in the past; but this can be off due to missed blocks, chain halts, etc.
so user must then search multiple blocks near where he thinks it might be, to find the block containing the pertinent transaction.

alternative to unix stamp could be ISO8601 time format, but this user always prefers to think in unix epoch terms

this functionality may be available through elastic search but elastic search is not always available, is not a distributed application, its also not nearly as easy to query for a lay user as a core rpc audit on the other hand is always necessary for business records and regulatory compliance user prefers to deal with core

Impacts

CORE TEAM TASK LIST

abitmore commented 3 years ago

Firstly, we do not index block time in memory, so a node API querying for a block with a timestamp is not practicable.

Secondly, it's possible to expand the account history plugin and store the timestamp of every operation and index it, so that we could query the history by time via new APIs.

Thirdly, the job is already done in the ES plugin. In ES we have timestamps stored and it's easy to query by time.

So this feature request is likely "won't fix".

abitmore commented 3 years ago

By the way, providing audit service or software can be a profitable business. Anyone who has interest is encouraged to explore in this field.

abitmore commented 2 years ago

Part of the requested feature is covered by https://github.com/bitshares/bitshares-core/pull/2650 and https://github.com/bitshares/bitshares-core/pull/2651.

abitmore commented 2 years ago

user made a bitshares transaction at some time in the past. they know the time it occurred from their records, but not the block number or transaction hash. ... the current alternative is to approximate the block number in the past;

This seems to be a UI issue. In the past, UI could only get the timestamp after getting the block number via the get_account_history API or alike.

abitmore commented 2 years ago

Part of the requested feature is covered by https://github.com/bitshares/bitshares-core/pull/2650 and https://github.com/bitshares/bitshares-core/pull/2651.