Emit Transfer Contract Events for Classic Transfers #1553
Replies: 4 comments 9 replies
-
Define "emit"? I don't think this is even logistically possible from Core's perspective. Since smart contracts operate in their own land of execution and thus emit events into metadata via host functions, how would classic operations replicate this? Are you suggesting they inject Don't get me wrong, this sounds really nice, but I just can't see how it's possible. |
Beta Was this translation helpful? Give feedback.
-
While this seems easy enough to support for simple payments, I wonder what should we do for things like path payments, DEX trades, claimable balances etc. In Soroban world these would contain a number of transfer events, as well as maybe some other events. I don't think that's feasible for classic, as we wouldn't want to have an operation to emit a lot of events (these won't have a fee, unlike in Soroban case). I wonder if a subset of operations that move balances is sufficient to support. Basically, it would be nice to identify the requirements/use cases that we can support with certain 'classic' events. |
Beta Was this translation helpful? Give feedback.
-
Just wanted to big ➕ this! There have been a handful of conversations lately (internal + external) that have assumed or implied that we will be rebuilding or recreating the unified data models that we built out in Horizon, but now in RPC. Repeating this behavior would only recreate a lot of the issues we saw with Horizon, and allow RPC to become the defacto backend/monolith for any and all applications that want on-chain data. So yes, I'd wholeheartedly agree that the right layer to solve this at feels like the source-of-truth of the events data (ie. Core).
I think this is the right bit to start with as there's generally a lot of interest around a unified understanding of "what is a payment" or "what moves value" (lots of interest/talk around an open-source payment indexer, for example). |
Beta Was this translation helpful? Give feedback.
-
I'm a big fan of this proposal. I want to point out that there are two layers in this unification effort -- the source of the data and the format of the data. Providing a stream for all stellar asset transactions at the protocol level via events, as opposed to at the application level (like Horizon's /payments endpoint), makes sources of this data interchangeable. Clients can use RPC, a txmeta lake (produced by galaxie), captive core, or some other source of txmeta. However, I think it is equally important that we unify the format of the data provided. We could add events for all stellar asset transfers, providing a unified the stream for this data, but if the format of these events vary, clients will inevitably support a subset of these formats. We have this same problem right now with Horizon's Unfortunately I think we've already introduced multiple data formats in cases where a single format could have sufficed. For example, So lets take path payments for example. I would advocate that the event(s) emitted as a result of a path payment operation use the I'd like to see events in this format emitted for the following classic operations:
Now there are some classic operations where using the same format may not be the best path because there is not an obvious
In these cases, we may need to use a different format. The good news is that most applications won't need to care about these events because they don't use claimable balances or native AMMs. Finally, I think we should also consider emitting events for transaction fees. These are a kind XLM transfer, and anyone using events to update balances won't be able to maintain an accurate XLM balance without this event. |
Beta Was this translation helpful? Give feedback.
-
What
I propose we unify transfer events on the network in smart contract events, by exploring emitting transfer contract events, like those defined by SEP-41, CAP-46-6, and those potentially defined by #1534, for classic transfers (payments, path payments, etc).
Why
To create a singe unified data stream of all movements of assets / tokens on Stellar.
Today there is no single way to consume transfer events on the network. Transfers are divided by the classic vs smart contract divide.
The RPC is the future way developers are intended to stream and ingest events occurring on Stellar. The RPC exposes smart contract events. However any application wanting to ingest transfers must implement complex logic merging the results of streaming smart contract events and transactions containing payments, path payments, offers, so on. The shortest path to a payments implementation today is to integrate with Horizon's /payments endpoint, however Horizon is the past and RPC is the future. There should be a way for developers to ingest all transfers from RPC.
We could explore ways to add payment information to RPC, such as a similar Horizon-like /payments endpoint, however I think that is making the same mistakes of the past and that would solve the problem at the wrong layer.
RPC's API is designed to provide a raw view into the network and live / current network data. It exposes raw transaction XDR, and raw events. RPC doesn't contain "business logic" for understanding network data. This is critical because if you build on RPC, or raw meta, you have access to the same data, so applications can move between them without being disadvantaged, and without artificial / convenience forcing functions causing folks to interact with one when another would be more appropriate.
This has the future impact of not causing folks to push the RPC in a direction (with feature requests) that would be better served by Galexie or some other service.
If the data is added to network events, then applications built on RPC, or Galexie, or other CDP tooling, or directly on transaction meta from core, have access to the same data.
If we solve the problem at the network layer, then events on Stellar can display a unified view into the movement of value on the network.
(In the future we can even emit events for other non-transfer classic events, such as account creation, merge, etc. The Soroban events structure already support events from G addresses.)
How
All transfers / payments on Stellar classic are the result of interactions with Stellar Assets. All Stellar Assets have a reserved contract address and a reserved installation of the built-in Stellar Asset Contract. For example, on mainnet (pubnet) the
native
asset has contract addressCAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA
. Stellar classic operations could emit Soroban events using the asset's reserved contract address, even if the reserved contract address hasn't been deployed to yet for that contract.Links
Discussion on Discord: https://discord.com/channels/897514728459468821/1285736582426394760
Beta Was this translation helpful? Give feedback.
All reactions