-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TRC: Tron event subscribe model #12
Comments
Very useful Proposal ! This would be the official TRON event service. Many Dapp developer would like to use this. |
Plugin would help build decoupled, customizable event service. I think asynchronous log&event processing is necessary. Any long-term operation wouldn't affect the Java-Tron. |
That's right. Plug-ins shouldn't affect the performance of nodes. We'll also make some optimization. |
How can I setup the event subscriber to retrieve the events data and insert into the Mongodb? |
Hi |
really interesting, i was thinking more a webhook implementation...... |
i need a way from trongrid after transaction in constract call web hook |
@jiangyy0824 hi, after calling balanceof(address) by http api triggerconstantcontract, will contracteventTrigger have one message? |
Hello vahid, currently trongrid does provide a webhook service but within
your contract you can emit important variables to be stored as events
after which you can send a request to :
https://api.trongrid.io/v1/contracts/<contract name>/events (more details
on this in the picture below)
you can use the following parameters for example:
{"event_name":"<EventName>","only_confirmed":"true","limit":"200"}
and then get the events and store in a database or output in real time if
you want
for more detailed options on parameters, goto
https://developers.tron.network/reference/get-events-by-contract-address ,
you should see:
[image: lafkwjefwef.PNG]
just input your contract address and yu will see different ways to query
the blockchain for the events on your contract via api
in a sleek and understandable way
hope this helps
…On Fri, Jun 24, 2022 at 8:31 PM vahid alvandi ***@***.***> wrote:
i need a way from trongrid after transaction in constract call web hook
please help
—
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKLQMJIR7HTEI4LMRVRS7WLVQYEIHANCNFSM4GLQQWQA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi @simonushie is there any method to get the event via Webhook or just using an event listener? |
Simple Summary
This doc describes event subscribe model of Tron.
Abstract
The following describes a model which is used to subscribe to block chain events, transaction events, contract logs and contract events from Tron FullNode. Developers can set up filters to subscribe to specific events. Plug-ins can be developed to export these events for further development.
Motivation
This will allow dapps developers or exchange to subscribe any event triggered on Tron.
Specification
Events to subscribe
Filter
Notice: No support the historical data query.
Smart Contract log
contractLogTrigger is used to represent the object of smart contract log, which has following parameters:
Smart Contract event
contracteventTrigger is used to represent the object of smart contract log, which has following parameters:
Trigger event
Send trigger
java-tron sends the trigger to the plugin asynchronously, and the trigger must satisfy the filter condition. The following is a filter example, the block number of the trigger must be between fromBlock and toBlock, the contractAddress must be "AddressA", the topics must include "TopicA", and only the Trigger that satisfies the condition will be sent.
Plugin implementation
The function of the plugin is to implement event dump. Developers can customize it according to their needs, such as Message queue, Kafka, MongoDB or writing to local files.
The plugin is independent of java-tron and is not loaded by default. It can be enabled by configuring command line parameters. By default, only subscriptions to smart contract event are supported. Developers could subscribe to other triggers by modifying configuration files.
Developers are flexible in defining plug-in configuration files, including message queue server addresses, defined Trigger types, and so on.
Take Kafka plug-in as an example, define the Kafka server address in the configuration file, Kafka topics (corresponding to the Trigger category). After receiving the Trigger sent by java-tron, the plug-in sends the Trigger to the corresponding Kafka topic according to the Trigger category.
The plug-in implements the ILogsFilterPlugin interface, including the initialization and start-up of the plug-in, receiving Trigger, and loading the plug-in according to the configuration file.
The text was updated successfully, but these errors were encountered: