Eventeum is a powerful Ethereum event listener that acts as a mediator between smart contract events and backend microservices. By listening for specific events emitted from the Ethereum network, Eventeum broadcasts these events to your middleware layer, creating an efficient architecture that simplifies the management of smart contract interactions.
Features of Eventeum
- Dynamically Configurable: Eventeum offers a REST API, allowing you to dynamically subscribe and unsubscribe to smart contract events.
- Highly Available: Multiple Eventeum instances communicate with each other to ensure consistent subscriptions.
- Resilient Design: Detects node failures, allowing event subscriptions to continue from the failure block once the node is back online.
- Fork Tolerance: Configured to wait for a specified number of blocks before an event is confirmed, allowing for a graceful handling of blockchain forks.
Supported Broadcast Mechanisms
Eventeum supports various broadcast mechanisms, including:
Getting Started with Eventeum
Follow the steps below to run Eventeum on your local machine for development and testing purposes.
Prerequisites
- Java 8
- Maven
- Docker (optional)
Building Eventeum
1. Navigate to the root directory:
$ cd path/to/eventeum
2. Compile, test, and package the project:
$ mvn clean package
Running Eventeum
You have two options to run Eventeum – using an executable JAR or Docker:
- Using Executable JAR:
$ cd server $ export SPRING_DATA_MONGODB_HOST=mongodb-host:port $ export ETHEREUM_NODE_URL=http://node-host:port $ export ZOOKEEPER_ADDRESS=zookeeper-host:port $ export KAFKA_ADDRESSES=kafka-host:port $ export RABBIT_ADDRESSES=rabbit-host:port $ java -jar target/eventeum-server.jar
- Using Docker:
$ cd server $ docker build . -t kauri/eventeum:latest $ docker run -p 8060:8060 kauri/eventeum
Configuring Eventeum Nodes
Eventeum supports listening for events from multiple nodes, which can be configured in the properties.yaml file:
ethereum:
nodes:
- name: default
url: http://mainnet:8545
- name: sidechain
url: wss://sidechain
By default, if an event does not specify a node, it gets registered against the default node.
Registering Events
Eventeum exposes a REST API that you can use to subscribe or unregister events:
To register an event:
POST /api/rest/v1/event-filter
Headers: content-type: application/json
Body: {
"id": "event-identifier",
"contractAddress": "0x1fbBeeE6eC2B7B095fE3c5A572551b1e260Af4d2",
"eventSpecification": {
"eventName": "TestEvent",
"indexedParameterDefinitions": [
{"position": 0, "type": "UINT256"},
{"position": 1, "type": "ADDRESS"}
],
"nonIndexedParameterDefinitions": [
{"position": 2, "type": "BYTES32"},
{"position": 3, "type": "STRING"}
]
}
}
Understanding the Code: An Analogy
Think of Eventeum like the efficient manager of a busy restaurant. The Ethereum blockchain is the kitchen where all cooking (event emissions) happens. However, instead of every waiter (microservice) going directly to the kitchen to take orders (events), they communicate with the manager (Eventeum). The manager listens for all orders coming from the kitchen, understands the details of these orders, and then relays the information to the waiters without them needing to go back and forth to the kitchen. This reduces confusion, improves efficiency, and ensures that each waiter gets the correct information without needing to overwhelm the kitchen staff with individual requests.
Troubleshooting
If you encounter any issues, consider the following troubleshooting steps:
- Ensure that all prerequisite services (MongoDB, Kafka, Zookeeper, Ethereum Node) are running properly.
- Double-check your configuration settings in the properties.yaml file and ensure that all URLs and ports are correct.
- If using Docker, make sure that your images are built successfully without any errors.
- For persistent issues, refer to the Eventeum documentation or raise the query on community channels.
- For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.