Skip to content

Commit 42115f4

Browse files
committed
update README.md
1 parent 3e74550 commit 42115f4

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

DESIGN.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ The VC-Ethereum Data Service architecture streamlines the retrieval, processing,
5353

5454
**Bootstrapper**
5555
- **Role**: Retrieves the most recent 50 block data from the Ethereum Node using HTTPS RPC.
56-
- **Flow**: Initiates an HTTPS request to fetch the latest 50 blocks for initial synchronization.
56+
- **Flow**: Initiates an HTTPS request to fetch the latest 50 blocks for initial synchronization, loads the data to Redis and then exits.
5757
- **Documentation**: For more details, please refer to the [bootstrapper README](https://github.com/srinathln7/ethereum-data-service/tree/main/internal/services/bootstrapper).
5858

5959
**Block Notification**
6060
- **Role**: Listens for new blocks in real-time via WebSocket subscription from the Ethereum Node.
61-
- **Flow**: Establishes a bi-directional WebSocket connection to receive immediate updates on new blocks.
61+
- **Flow**: Establishes a bi-directional WebSocket connection to receive live updates on new blocks.
6262
- **Documentation**: For more details, please refer to the [pub README](https://github.com/srinathln7/ethereum-data-service/tree/main/internal/services/pub).
6363

6464
**Redis Channel**
@@ -71,13 +71,13 @@ The VC-Ethereum Data Service architecture streamlines the retrieval, processing,
7171
- **Documentation**: For more details, please refer to the [sub README](https://github.com/srinathln7/ethereum-data-service/tree/main/internal/services/sub).
7272

7373
**Data Formatter**
74-
- **Role**: Formats raw block data into a structured format using `model.Data` struct definitions.
74+
- **Role**: Formats raw block data into a structured format as per `model.Data` struct definition.
7575
- **Integration**: Modular integration into Bootstrapper and Block Subscriber ensures consistent data formatting before storage.
7676
- **Documentation**: For more details, please refer to the [model README](https://github.com/srinathln7/ethereum-data-service/tree/main/internal/model).
7777

7878
**Redis DB**
7979
- **Role**: Central storage for processed Ethereum blockchain data.
80-
- **Flow**: Stores formatted block data received from Data Formatter and Block Subscriber, enabling efficient data retrieval.
80+
- **Flow**: Stores formatted block data received from upstream services with pre-define expiry time and enables efficient data retrieval.
8181
- **Documentation**: For more details, please refer to the [storage README](https://github.com/srinathln7/ethereum-data-service/tree/main/internal/storage).
8282

8383
**API Service**
@@ -90,15 +90,14 @@ The VC-Ethereum Data Service architecture streamlines the retrieval, processing,
9090
- **Flow**: Initiates HTTP requests to API Service to fetch specific blockchain data of interest.
9191

9292
**Redis Insight**
93-
- **Role**: Analyzes and visualizes data stored in Redis DB, offering insights into key creation and memory usage.
93+
- **Role**: Analyzes and visualizes data stored in Redis DB, offering insights into key creation, memory consumption and CPU usage.
9494
- **Flow**: Provides real-time GUI monitoring of Redis operations, complementing `redis-cli`.
9595

96-
9796
## Remarks
9897

9998
### TTL for Blockdata in Redis
10099

101-
In the design, we start the **Bootstrapper** and **BlockNotification** services simultaneously. The Bootstrapper fetches the latest block height (`h`), retrieves data from `h-50` to `h`, and exits gracefully. This process takes about 5 minutes, so we set the TTL for block info in Redis to 650 seconds (50 * 13 seconds, the average ETH block time). Concurrently, the block notifier publishes real-time block info to Redis with the same TTL. Initially, our datastore holds more than 50 blocks, but it eventually stabilizes at 50 blocks. Despite the initial load, Redis memory usage remains well within its capabilities.
100+
In the design, we start the **Bootstrapper** and **BlockNotification** services simultaneously. The Bootstrapper fetches the latest block height (`h`), retrieves data from `h-50` to `h`, and exits gracefully. We set the TTL for all these retreived block information in Redis to 650 seconds (50 * 13 seconds, the average ETH block time). Concurrently, the block notifier publishes real-time block info to Redis with the same TTL. Initially, our datastore holds more than 50 blocks, but it eventually stabilizes at 50 blocks. Despite the initial load, Redis memory usage remains well within its capabilities.
102101

103102
### Data Formatter
104103
The `Data Formatter` module integrates as a component rather than a standalone service, ensuring uniform data formatting across Bootstrapper and Block Subscriber. This approach maximizes code reuse and data integrity within the VC-Ethereum Data Service architecture.

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# VC-Ethereum Data-API-Service
22

3-
VC-Ethereum Data-API-Service stores block info, transaction hashes, and events for the latest 50 blocks and provides API endpoints for querying events by address, blocks by number, and transactions by hash.
4-
5-
## Objective
6-
7-
Refer to the [project objective](https://github.com/srinathln7/ethereum-data-service/blob/main/docs/CHALLENGE.md) and the project structure. This document outlines the purpose of the project and how the codebase is organized.
3+
VC-Ethereum Data-API-Service stores block info, transaction hashes, and events for the latest 50 blocks and provides API endpoints for querying events by address, blocks by number, and transactions by hash. Please refer to the [project objective](https://github.com/srinathln7/ethereum-data-service/blob/main/docs/CHALLENGE.md) here which outlines the goal of the project and how the codebase is organized.
84

95
## Prerequisites
106

@@ -46,10 +42,14 @@ make builddown
4642

4743
To view logs in real-time for each service:
4844

49-
```sh
45+
```
46+
5047
docker logs -f vc-api-server
48+
5149
docker logs -f vc-bootstrapper
50+
5251
docker logs -f vc-blocknotifier
52+
5353
docker logs -f vc-blocksubscriber
5454
```
5555

@@ -92,8 +92,7 @@ Alternatively, you can test the service in your browser.
9292

9393
## Observation and Analysis
9494

95-
To view real-time analytics of our local data store, click [here](http://localhost:5540) to navigate to the Redis Insight GUI. Then, manually connect the database by clicking `Add connection details manually` and using the following details
96-
95+
To view real-time analytics of our local data store, navigate to http://localhost:5540 in your browser to access the Redis Insight GUI. Then, manually connect the database by clicking `Add connection details manually` and using the following details
9796

9897
```
9998
host: redis
@@ -106,9 +105,7 @@ This validates that Redis is an optimal choice for our current project requireme
106105

107106
## Limitations and Future Improvements
108107

109-
In our current architecture, each service operates with a single instance, making each service vulnerable to being a single point of failure. This becomes particularly critical because if Redis experiences downtime, it impacts the entire application. To address this, we can implement well-known strategies such as deploying Redis in a high-availability configuration using Redis Sentinel or Redis Cluster. Additionally, adopting container orchestration platforms like Kubernetes can enable automatic scaling and resilience by managing multiple instances of each service. Implementing load balancing across these instances can further enhance availability and fault tolerance and incorporating monitoring and alerting mechanisms helps in promptly identifying and mitigating issues before they impact the entire system. These approaches collectively aim to enhance the reliability and availability of our application architecture.
110-
111-
As part of future improvements, we can consider the following tasks:
108+
In our current architecture, each service operates with a single instance, making each service vulnerable to being a single point of failure. This becomes particularly critical because if Redis experiences downtime, it impacts the entire application. To address this, we can implement strategies such as deploying Redis in a high-availability configuration using Redis Cluster. Additionally, we can deploy these service on Kubernetes and enable automatic scaling and resilience by managing multiple instances of each service. Implementing load balancing across these instances can further enhance availability and fault tolerance and incorporating monitoring and alerting mechanisms helps in promptly identifying and mitigating issues before they impact the entire system. These approaches collectively aim to enhance the reliability and availability of our application architecture.
112109

113110
### Easy-to-Query APIs
114111

@@ -122,7 +119,7 @@ To secure the API, I would implement the following measures:
122119

123120
- **Rate Limiting:** Implement rate limiting to prevent abuse and protect the service from being overwhelmed by too many requests.
124121

125-
- **HTTPS:** Use HTTPS to encrypt communication between clients and the API.
122+
- **HTTPS:** Use HTTPS to encrypt communication between clients and our API service.
126123

127124

128125
## References

docs/html/model.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ <h3>Package files</h3>
152152

153153

154154

155-
<h2 id="FormatBlockData">func <a href="/src/ethereum-data-service/internal/model/model.go?s=1232:1314#L18">FormatBlockData</a>
155+
<h2 id="FormatBlockData">func <a href="/src/ethereum-data-service/internal/model/model.go?s=1340:1422#L19">FormatBlockData</a>
156156
<a class="permalink" href="#FormatBlockData">&#xb6;</a>
157157

158158

@@ -199,15 +199,16 @@ <h2 id="Block">type <a href="/src/ethereum-data-service/internal/model/model.go?
199199

200200

201201

202-
<h2 id="Data">type <a href="/src/ethereum-data-service/internal/model/model.go?s=645:1089#L10">Data</a>
202+
<h2 id="Data">type <a href="/src/ethereum-data-service/internal/model/model.go?s=753:1197#L11">Data</a>
203203
<a class="permalink" href="#Data">&#xb6;</a>
204204

205205

206206
</h2>
207207
<p>
208208
Data represents storage data in Redis DB for Ethereum-related information.
209209
It includes Ethereum block data, transaction hashes mapped to transactions,
210-
and event data mapped to specific event addresses.
210+
and event data mapped to specific event addresses. Block data byitself
211+
contains Tx hashes but as per the challenge description, we store it explicitly here
211212
</p>
212213

213214
<pre>type Data struct {

0 commit comments

Comments
 (0)