Skip to content

Commit 3e74550

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

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

DESIGN.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# VC-Ethereum Data Service Architecture
22

3-
The pivotal decision in our architecture aimed at storing information for the most recent 50 blocks centers around our database choice. Given the project's scope and requirements detailed [here](https://github.com/srinathln7/ethereum-data-service/blob/main/docs/CHALLENGE.md), Redis was selected as our local store. The rationale behind this decision is thoroughly outlined [here](https://github.com/srinathln7/ethereum-data-service/blob/main/docs/REDIS.md).
3+
The pivotal decision in our architecture aimed at storing information for the most recent 50 blocks centers around our database choice. Given the project's scope and requirements detailed [here](https://github.com/srinathln7/ethereum-data-service/blob/main/docs/CHALLENGE.md), Redis was selected as our local store. The rationale behind this decision is thoroughly outlined [here](https://github.com/srinathln7/ethereum-data-service/blob/main/docs/REDIS.md). This design strives to efficiently combine real-time and historical Ethereum data processing (most recent 50 blocks at the time of launching the application), leveraging Redis for both message brokering and data storage. The API Service ensures that clients have quick and reliable access to the latest blockchain data.
4+
45

56
```mermaid
67
graph TD
@@ -16,7 +17,7 @@ graph TD
1617
1718
subgraph VC-ETH-Data-Service
1819
direction TB
19-
ethereumNode["Ethereum Node<br/>(WebSocket & HTTPS RPC)"]:::ethereumNodeStyle
20+
ethereumNode["Ethereum Node<br/>(HTTPS RPC & WebSocket)"]:::ethereumNodeStyle
2021
blockNotification["Block<br/>Notification"]:::blockNotificationStyle
2122
bootstrapper["Bootstrapper"]:::bootstrapperStyle
2223
redisChannel(["Redis Channel"]):::redisChannelStyle
@@ -99,8 +100,6 @@ The VC-Ethereum Data Service architecture streamlines the retrieval, processing,
99100

100101
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.
101102

102-
#### Data Formatter
103-
103+
### Data Formatter
104104
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.
105105

106-
Overall, this design strives to efficiently combine real-time and historical Ethereum data processing, leveraging Redis for both message brokering and data storage. The API Service ensures that clients have quick and reliable access to the latest blockchain data.

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ This validates that Redis is an optimal choice for our current project requireme
108108

109109
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.
110110

111-
As part of future improvements, we consider the following tasks:
111+
As part of future improvements, we can consider the following tasks:
112112

113113
### Easy-to-Query APIs
114114

@@ -124,17 +124,6 @@ To secure the API, I would implement the following measures:
124124

125125
- **HTTPS:** Use HTTPS to encrypt communication between clients and the API.
126126

127-
### Performance Optimization
128-
129-
To improve the performance of the service, I would consider the following optimizations:
130-
131-
- **Load Balancing:** Use a load balancer to distribute incoming requests across multiple instances of the service.
132-
133-
- **Horizontal Scaling:** Scale the service horizontally by adding more instances behind the load balancer.
134-
135-
136-
### Design to store the entire ETH mainnet data
137-
138127

139128
## References
140129

docs/REDIS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Based on recent Ethereum block sizes from [Etherscan](https://etherscan.io/chart
99
- **Block Data**: Approximately 200 KB per block.
1010
- **Transaction Data**:
1111
- Average of 200 transactions per block.
12-
- Each transaction key (Hash: 32 bytes) and actual tx data (750 bytes) contribute to about 156 KB per block.
12+
- Each transaction key (Hash: 32 bytes) and actual Tx data (750 bytes) contribute to about 156 KB per block.
1313
- **Event Data**:
1414
- Assuming an average of 2 events per transaction, contributing approximately 312 KB per block.
1515

@@ -34,7 +34,7 @@ With additional overhead for indexing and metadata, our total storage requiremen
3434

3535
### Concurrent Requests
3636

37-
- **Concurrency Support**: Redis efficiently handles multiple concurrent client requests thereby enhancing application responsiveness.
37+
- **Concurrency Support**: Redis efficiently handles multiple concurrent client requests thereby enhancing application responsiveness. At the start of our application, both the **Bootstrapper** and **BlockNotification** service starts write concurrently to Redis.
3838

3939
### Performance Monitoring
4040

internal/model/model.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ type Block struct {
1616

1717
// Data represents storage data in Redis DB for Ethereum-related information.
1818
// It includes Ethereum block data, transaction hashes mapped to transactions,
19-
// and event data mapped to specific event addresses.
19+
// and event data mapped to specific event addresses. Block data byitself
20+
// contains Tx hashes but as per the challenge description, we store it explicitly here
2021
type Data struct {
2122
Block Block `json:"block"` // Block holds Ethereum block information.
2223
TransactionHashes map[string]*types.Transaction `json:"transaction_hashes"` // TransactionHashes maps transaction hashes to their corresponding transactions.

0 commit comments

Comments
 (0)