You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when subscribing to Watch* style API endpoints It's impossible to correlate the values with the actual transactions or blocks that they occurred around. For example, if I subscribe to WatchTransfers I will receive a channel that forwards me Transfer events shaped like so:
type TransferEvent struct {
From signature.PublicKey `json:"from"`
To signature.PublicKey `json:"to"`
Tokens quantity.Quantity `json:"tokens"`
}
The problem is I have no way to tell which block this ocurred in, at what height, what time, or the associated transactions.
An alternative is to not use the Watch methods and instead call GetEvents on every block which will also include a TxHash, but this is much slower when trying to process the whole chain and there is no way to lookup a TxHash using the API yet.
What would be ideal is for common chain information to be included. Things like block height are common to all chains and so I think would be fine to expose regardless of the backing consensus used.
ISSUE TYPE
Feature Idea
COMPONENT NAME
Any API module providing Watch*.
ADDITIONAL INFORMATION
I'm currently avoiding any Watch* API endpoints because they don't provide enough context to be useful, this means instead I'm calling Get* style API endpoints. The problem there though is the more calls I make during a block the slower processing the chain becomes.
The text was updated successfully, but these errors were encountered:
This is true, so for staking there is also the GetEvents endpoint which takes a specific height and provides a TxHash field in the result.
I think one way would be to expose an additional method called WatchEvents which would provide the same results as GetEvents (maybe with an additional Height field). What do you think about this idea?
kostko
changed the title
Provide contextual block information for Watch* call returns.
Provide contextual block information for Watch* call returns
May 27, 2020
That would be awesome! Would adding Height to other Watch* methods be an unreasonable request? I'm not sure how much tooling relies on these methods or what it means for backwards compatibility though. Either way GetEvents alone in this format would be excellent.
SUMMARY
Currently when subscribing to
Watch*
style API endpoints It's impossible to correlate the values with the actual transactions or blocks that they occurred around. For example, if I subscribe toWatchTransfers
I will receive a channel that forwards me Transfer events shaped like so:The problem is I have no way to tell which block this ocurred in, at what height, what time, or the associated transactions.
An alternative is to not use the Watch methods and instead call
GetEvents
on every block which will also include a TxHash, but this is much slower when trying to process the whole chain and there is no way to lookup a TxHash using the API yet.What would be ideal is for common chain information to be included. Things like block height are common to all chains and so I think would be fine to expose regardless of the backing consensus used.
ISSUE TYPE
COMPONENT NAME
Any API module providing
Watch*
.ADDITIONAL INFORMATION
I'm currently avoiding any
Watch*
API endpoints because they don't provide enough context to be useful, this means instead I'm callingGet*
style API endpoints. The problem there though is the more calls I make during a block the slower processing the chain becomes.The text was updated successfully, but these errors were encountered: