Blockchain system architecture is a very interesting subject. Despite its apparent complexity, it consists of fairly simple elements widely used in the software industry, not just in blockchains. It is both complex and simple at the same time. A paradox? Let’s identify the key elements that make up all blockchain systems and distributed ledgers.
Event Store
Let’s start from the beginning. Users interact with blockchains by sending transactions. We won’t detail transaction signing; while cryptography is fascinating, here it serves only as a validation stage. Transactions—user requests to the system—are sent, validated, queued, and stored forever. This suggests the use of the Event Sourcing pattern. This means one can always process the entire event sequence to derive the system’s current state. Since events are stored indefinitely in strict sequence, we can conclude that a blockchain is a kind of event store. Kafka is a popular event store option in traditional software development.
Validator
The next step is validation. The user’s signature and other parameters are checked. An important validator function is limiting user activity to prevent network congestion. How the validator works depends on its configuration. Systems like Ethereum have custom validators. Smart contracts allow you to configure the validator, determining which requests are processed. The validator may have a state affected by processed requests, but persisting this state isn’t critical, as it can be restored by reprocessing the request sequence.
Consensus
All distributed systems, including blockchains, require a consensus algorithm. Its purpose is to ensure data synchronization between network nodes. Raft is a widely used traditional consensus algorithm. However, it is unsuitable for blockchains due to potential dishonest nodes. Instead, variations of Byzantine Fault Tolerance (BFT) algorithms are used. You must also determine which trusted nodes can vote in the consensus process.
Consensus is the most important and complex part of the system, determining resilience to technical failures, network problems, and malicious attacks.
And More
These three elements are key to any blockchain system. While storing the current state and adding search indexes is desirable, these are auxiliary elements for convenience. However, most existing blockchains do not pamper users with convenience.