As the whitepaper already states the AElf kernel will be built in a similar way to the Linux kernel. It will implement the basic building blocks that will allow other developers to build “functionality” on top of it. The whitepaper also states that users can redefine the “core” through interface.
This section describes the components implemented in the kernel. It clarifies the roles that they have in the system.
A Smart Contract
can be seen as a protocol. It’s implemented as a service (micro-service).
For example, this means that since the Consensus Protocol is defined as a Smart Contract
, it is in fact a service.
When a chain is created, it needs genesis block with a collection of Smart Contracts deployed. This collection, named as
Genesis Smart Contract Collection, can be changed in the future by vote. The contract code will be encapsulated in
SmartContractRegistration
and registered into AccountZero
. Smartcontract
objects should be cached in memory.
SmartContractZero
provides entries for Smartcontract
using SmartContractRegistration
.
AccountDataProvider
provides entries associated with given Account including:DataProvider
AccountDataContext
Account Address
DataProvider
provides entries for data access related to given Account.
AccountContextService
provides functionality cachingAccountDataContext
objects in memory.- Return
AccountDataContext
object in memory if cached - Return
AccountDataContext
object new created if not cached
- Return
ChainCreationService
provides functionality creating a new chain including building and appendingGenesisBlock
.ChainContextService
provides functionality cachingChainContext
objects in memory.- Return
ChainContext
object in memory if cached - Return
ChainContext
object new created withSmartContractZero
if not cached
- Return
BlockValidatingService
maintainsBlockValidationFilter
collection and provides entry of blocks validation.SmartContractService
provides functionality for obtainingSmartContract
BlockManager
provides entries(get/set) forBlockStore
ChainManager
provides functionality of appending the given Block to specified Chain and entries forChainBlockRelationStrore
ChainManager
provides entries(get/set)forChainStore
SmartContractManager
provides entries(get/set)forSmartContractRegistration
storageTransactionManager
provides entries forTransactionSotre
TransactionExecutingManager
contains scheduling algorithm and provides functionality ofTransaction
executingWorldStateManager
provides entry forWoldStateStore
and functionality to obtainAccountDataProvider
objects associated with givenAccount
Storage | Description |
---|---|
BlockStore |
Insert and get BLock |
ChainStore |
Insert, update and get Chain |
ChangesStore |
Insert and get a change of path-pointer |
PointerStore |
Insert and get pointer (by path) |
TransactionStore |
Insert and get Transaction |
WorldStateStore |
Insert and get World State of each Block |
ChainBlockRelationStore |
Insert and get chain-block relations by Hash |
-
Service is processing logic associated with chain state.
-
Manager provides functionalities having nothing to do with chain state.
-
Storage provides storage access and persistence without logic.
+-------------+ +-------------+ +------------+ | | | | | | | Service +-----> Manager +-----> Storage | | | | | | | +-------------+ +-------------+ +------------+