You've already forked electroncash-protocol
Update the ARCHITECTURE document
Also has a pretty line diagram
This commit is contained in:
+47
-47
@@ -1,85 +1,85 @@
|
|||||||
Components
|
Components
|
||||||
==========
|
==========
|
||||||
|
|
||||||
The components of the server are roughly like this::
|
.. image:: https://docs.google.com/drawings/d/1Su_DR2c8__-4phm12hAzV65fL2tNm_1IhKr4XivkW6Q/pub?w=720&h=540
|
||||||
|
:target: https://docs.google.com/drawings/d/1Su_DR2c8__-4phm12hAzV65fL2tNm_1IhKr4XivkW6Q/pub?w=960&h=720
|
||||||
-------
|
|
||||||
- Env -
|
|
||||||
-------
|
|
||||||
|
|
||||||
-------
|
|
||||||
- IRC -
|
|
||||||
-------
|
|
||||||
<
|
|
||||||
------------- ------------
|
|
||||||
- ElectrumX -<<<<<- LocalRPC -
|
|
||||||
------------- ------------
|
|
||||||
< >
|
|
||||||
---------- -------------------
|
|
||||||
- Daemon -<<<<<<<<- Block processor -
|
|
||||||
---------- -------------------
|
|
||||||
< < >
|
|
||||||
-------------- -----------
|
|
||||||
- Prefetcher - - FS + DB -
|
|
||||||
-------------- -----------
|
|
||||||
|
|
||||||
|
|
||||||
Env
|
Env
|
||||||
---
|
---
|
||||||
|
|
||||||
Holds configuration taken from the environment. Handles defaults
|
Holds configuration taken from the environment, with apprioriate
|
||||||
appropriately. Generally passed to the constructor of other
|
defaulting appropriately. Generally passed to the constructor of
|
||||||
components which take their settings from it.
|
other components which take their settings from it.
|
||||||
|
|
||||||
|
Controller
|
||||||
|
----------
|
||||||
|
|
||||||
|
The central part of the server process initialising and coordinating
|
||||||
|
all the others. Manages resource usage.
|
||||||
|
|
||||||
|
|
||||||
LocalRPC
|
LocalRPC
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Handles local JSON RPC connections querying ElectrumX server state.
|
Handles local JSON RPC connections querying ElectrumX server state.
|
||||||
Not started until the block processor has caught up with the daemon.
|
Started when the ElectrumX process starts.
|
||||||
|
|
||||||
ElectrumX
|
ElectrumX
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Handles JSON Electrum client connections over TCP or SSL. One
|
Handles JSON Electrum client connections over TCP or SSL. One
|
||||||
instance per client session. Should be the only component concerned
|
instance per client session. Should be the only component concerned
|
||||||
with the details of the Electrum wire protocol. Responsible for
|
with the details of the Electrum wire protocol.
|
||||||
caching of client responses. Not started until the block processor
|
|
||||||
has caught up with the daemon. Logically, if not yet in practice, a
|
Not started until the block processor has caught up with the daemon.
|
||||||
coin-specific class.
|
|
||||||
|
|
||||||
Daemon
|
Daemon
|
||||||
------
|
------
|
||||||
|
|
||||||
Used by the block processor, ElectrumX servers and prefetcher.
|
Encapsulates the RPC wire protcol with bitcoind for the whole server.
|
||||||
Encapsulates daemon RPC wire protcol. Logically, if not yet in
|
Transparently handles temporary daemon errors, and fails over if
|
||||||
practice, a coin-specific class.
|
necessary.
|
||||||
|
|
||||||
|
|
||||||
Block Processor
|
Block Processor
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
Responsible for managing block chain state (UTXO set, history,
|
Responsible for managing block chain state (UTXO set, history,
|
||||||
transaction and undo information) and processing towards the chain
|
transaction and undo information) and for handling block chain
|
||||||
tip. Uses the caches for in-memory state updates since the last
|
reorganisations.
|
||||||
flush. Flushes state to the storage layer. Reponsible for handling
|
|
||||||
block chain reorganisations. Once caught up maintains a
|
|
||||||
representation of daemon mempool state.
|
|
||||||
|
|
||||||
Database
|
When caught up, processes new blocks as they are found, and flushes
|
||||||
--------
|
the updates to the database immediately.
|
||||||
|
|
||||||
The database. Along with the host filesystem stores flushed chain state.
|
When syncing uses caches for in-memory state updates since the prior
|
||||||
|
flush. Occasionally flushes state to the storage layer when caches
|
||||||
|
get large.
|
||||||
|
|
||||||
Prefetcher
|
Prefetcher
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Used by the block processor to asynchronously prefetch blocks from the
|
Cooperates with the block processor to asynchronously prefetch blocks
|
||||||
daemon. Holds fetched block height. Once it has caught up
|
from bitcoind. Once it has caught up it additionally requests mempool
|
||||||
additionally obtains daemon mempool tx hashes. Serves blocks and
|
transaction hashes from bitcoind. Serves blocks to the block
|
||||||
mempool hashes to the block processor via a queue.
|
processor via a queue, and the mempool hashes to the Mempool object.
|
||||||
|
|
||||||
|
Mempool
|
||||||
|
-------
|
||||||
|
|
||||||
|
Handles all the details of maintaining a representation of bitcoind's
|
||||||
|
mempool state. Obtains the list of current mempool transaction hashes
|
||||||
|
from the Daemon when notified by the Prefetcher.
|
||||||
|
|
||||||
|
Notifies the controller that addresses have been touched when the
|
||||||
|
mempool refreshes (or implicitly when a new block is found).
|
||||||
|
|
||||||
|
Database
|
||||||
|
--------
|
||||||
|
|
||||||
|
The database. Flushed chain state is stored in the DB backend, such
|
||||||
|
as leveldb, along with metadata on the host filesystem.
|
||||||
|
|
||||||
IRC
|
IRC
|
||||||
---
|
---
|
||||||
|
|
||||||
Not currently imlpemented; will handle IRC communication for the
|
Handles advertising of ElectrumX services via IRC.
|
||||||
ElectrumX servers.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user