{"id":18966872,"url":"https://github.com/tronprotocol/event-plugin","last_synced_at":"2025-07-31T04:33:58.206Z","repository":{"id":46396843,"uuid":"163061510","full_name":"tronprotocol/event-plugin","owner":"tronprotocol","description":"Tron eventsubscribe plugin","archived":false,"fork":false,"pushed_at":"2025-06-24T11:19:28.000Z","size":14855,"stargazers_count":43,"open_issues_count":9,"forks_count":38,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-24T12:36:53.830Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tronprotocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-12-25T08:09:45.000Z","updated_at":"2025-06-24T02:34:39.000Z","dependencies_parsed_at":"2025-07-31T04:33:04.222Z","dependency_job_id":null,"html_url":"https://github.com/tronprotocol/event-plugin","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tronprotocol/event-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tronprotocol%2Fevent-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tronprotocol%2Fevent-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tronprotocol%2Fevent-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tronprotocol%2Fevent-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tronprotocol","download_url":"https://codeload.github.com/tronprotocol/event-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tronprotocol%2Fevent-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267988424,"owners_count":24176996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T14:38:52.898Z","updated_at":"2025-07-31T04:33:58.181Z","avatar_url":"https://github.com/tronprotocol.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tron eventsubscribe plugin\n\nThis is an implementation of Tron eventsubscribe model. \n\n* **api** module defines IPluginEventListener, a protocol between Java-tron and event plugin. \n* **app** module is an example for loading plugin, developers could use it for debugging.\n* **kafkaplugin** module is the implementation for kafka, it implements IPluginEventListener, it receives events subscribed from Java-tron and relay events to kafka server. \n* **mongodbplugin** mongodbplugin module is the implementation for mongodb. \n### Setup/Build\n\n1. Clone the repo\n2. Go to eventplugin `cd eventplugin` \n3. run `./gradlew build`\n\n* This will produce plugin zips, named `plugin-kafka-1.0.0.zip` and `plugin-mongodb-1.0.0.zip`, located in the `eventplugin/build/plugins/` directory.\n\n\n### Edit **config.conf** of Java-tron, add the following fileds:\n```\nevent.subscribe = {\n    path = \"\" // absolute path of plugin\n    server = \"\" // target server address to receive event triggers\n    dbconfig = \"\" // dbname|username|password, if you want to create indexes for collections when the collections are not exist, you can add version and set it to 2, as dbname|username|password|version\n    topics = [\n        {\n          triggerName = \"block\" // block trigger, the value can't be modified\n          enable = false\n          topic = \"block\" // plugin topic, the value could be modified\n          solidified = true // if set true, just need solidified block, default is false\n        },\n        {\n          triggerName = \"transaction\"\n          enable = false\n          topic = \"transaction\"\n          solidified = true\n          ethCompatible = true // if set true, add transactionIndex, cumulativeEnergyUsed, preCumulativeLogCount, logList, energyUnitPrice, default is false\n        },\n        {\n          triggerName = \"contractevent\"\n          enable = true\n          topic = \"contractevent\"\n        },\n        {\n          triggerName = \"contractlog\"\n          enable = true\n          topic = \"contractlog\"\n          redundancy = true // if set true, contractevent will also be regarded as contractlog\n        },\n        {\n          triggerName = \"solidity\" // solidity block trigger(just include solidity block number and timestamp), the value can't be modified\n          enable = true            // the default value is true\n          topic = \"solidity\"\n        },\n        {\n          triggerName = \"solidityevent\"\n          enable = false\n          topic = \"solidityevent\"\n        },\n        {\n          triggerName = \"soliditylog\"\n          enable = false\n          topic = \"soliditylog\"\n          redundancy = true // if set true, solidityevent will also be regarded as soliditylog\n        }\n    ]\n\n    filter = {\n       fromblock = \"\" // the value could be \"\", \"earliest\" or a specified block number as the beginning of the queried range\n       toblock = \"\" // the value could be \"\", \"latest\" or a specified block number as end of the queried range\n       contractAddress = [\n           \"\" // contract address you want to subscribe, if it's set to \"\", you will receive contract logs/events with any contract address.\n       ]\n\n       contractTopic = [\n           \"\" // contract topic you want to subscribe, if it's set to \"\", you will receive contract logs/events with any contract topic.\n       ]\n    }\n}\n\n\n```\n * **path**: is the absolute path of \"plugin-kafka-1.0.0.zip\" or \"plugin-mongodb-1.0.0.zip\"\n * **server**: Kafka(or MongoDB) server address, the default port is 9092(MongoDB is 27017)\n * **dbconfig**: db configuration information for mongodb, if using kafka, delete this one; if using Mongodb, add like that dbname|username|password or dbname|username|password|version if you want to create indexes when init\n * **topics**: each event type maps to one Kafka topic(or MongoDB collection), we support seven event types subscribing, block, transaction, contractlog, contractevent, solidity, soliditylog and solidityevent.   \n   **triggerName**: the trigger type, the value can't be modified.  \n   **enable**: plugin can receive nothing if the value is false.  \n   **topic**: the value is the kafka topic to receive events. Make sure it has been created and Kafka process is running  \n   **solidified**: if just need solidified data, just works for block and transaction  \n   **redundancy**: if will also trigger event as log, just works for contractlog and soliditylog   \n   **ethCompatible**: if set to true, will add some fields to transaction: transactionIndex, cumulativeEnergyUsed, preCumulativeLogCount, logList, energyUnitPrice\n   \n * **filter**: filter condition for process trigger.\n **note**: if the server is not 127.0.0.1, pls set some properties in config/server.properties file  \n           remove comment and set listeners=PLAINTEXT://:9092  \n           remove comment and set advertised.listeners to PLAINTEXT://host_ip:9092 \n\n##### Install Kafka\n**On Mac**:\n```\nbrew install kafka\n```\n\n**On Linux**:\n```\ncd /usr/local\nwget http://archive.apache.org/dist/kafka/0.10.2.2/kafka_2.10-0.10.2.2.tgz\ntar -xzvf kafka_2.10-0.10.2.2.tgz \nmv kafka_2.10-0.10.2.2 kafka\n\nadd \"export PATH=$PATH:/usr/local/kafka/bin\" to end of /etc/profile\nsource /etc/profile\n\n```\n**Note**: make sure the version of Kafka is the same as the version set in build.gradle of eventplugin project.(kafka_2.10-0.10.2.2 kafka)\n\n##### Run Kafka\n**On Mac**:\n```\nzookeeper-server-start /usr/local/etc/kafka/zookeeper.properties \u0026 kafka-server-start /usr/local/etc/kafka/server.properties\n```\n\n**On Linux**:\n```\nzookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties \u0026\nSleep about 3 seconds \nkafka-server-start.sh /usr/local/kafka/config/server.properties \u0026\n```\n\n#### Create topics to receive events, the topic is defined in config.conf\n\n**On Mac**:\n```\nkafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic block\nkafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic transaction\nkafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic contractlog\nkafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic contractevent\nkafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic solidity\nkafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic solidityevent\nkafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic soliditylog\n```\n\n**On Linux**:\n```\nkafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic block\nkafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic transaction\nkafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic contractlog\nkafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic contractevent\nkafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic solidity\nkafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic solidityevent\nkafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic soliditylog\n```\n\n#### Kafka consumer\n\n**On Mac**:\n```\nkafka-console-consumer --bootstrap-server localhost:9092  --topic block\nkafka-console-consumer --bootstrap-server localhost:9092  --topic transaction\nkafka-console-consumer --bootstrap-server localhost:9092  --topic contractlog\nkafka-console-consumer --bootstrap-server localhost:9092  --topic contractevent\nkafka-console-consumer --bootstrap-server localhost:9092  --topic solidity\nkafka-console-consumer --bootstrap-server localhost:9092  --topic solidityevent\nkafka-console-consumer --bootstrap-server localhost:9092  --topic soliditylog\n```\n\n**On Linux**:\n```\nkafka-console-consumer.sh --zookeeper localhost:2181 --topic block\nkafka-console-consumer.sh --zookeeper localhost:2181 --topic transaction\nkafka-console-consumer.sh --zookeeper localhost:2181 --topic contractlog\nkafka-console-consumer.sh --zookeeper localhost:2181 --topic contractevent\nkafka-console-consumer.sh --zookeeper localhost:2181 --topic solidity\nkafka-console-consumer.sh --zookeeper localhost:2181 --topic solidityevent\nkafka-console-consumer.sh --zookeeper localhost:2181 --topic soliditylog\n```\n\n### Load plugin in Java-tron\n* add --es to command line, for example:\n```\n java -jar FullNode.jar -c config.conf --es \n```\n\n\n### Event filter\nwhich is defined in config.conf, path: event.subscribe\n```\nfilter = {\n       fromblock = \"\" // the value could be \"\", \"earliest\" or a specified block number as the beginning of the queried range\n       toblock = \"\" // the value could be \"\", \"latest\" or a specified block number as end of the queried range\n       contractAddress = [\n           \"TVkNuE1BYxECWq85d8UR9zsv6WppBns9iH\" // contract address you want to subscribe, if it's set to \"\", you will receive contract logs/events with any contract address.\n       ]\n\n       contractTopic = [\n           \"f0f1e23ddce8a520eaa7502e02fa767cb24152e9a86a4bf02529637c4e57504b\" // contract topic you want to subscribe, if it's set to \"\", you will receive contract logs/events with any contract topic.\n       ]\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftronprotocol%2Fevent-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftronprotocol%2Fevent-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftronprotocol%2Fevent-plugin/lists"}