Skip to content

Latest commit

 

History

History
92 lines (67 loc) · 4.13 KB

main-page.md

File metadata and controls

92 lines (67 loc) · 4.13 KB

Technical documentation for the Ælf project

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.

Table of Contents

Data Structures

Components

This section describes the components implemented in the kernel. It clarifies the roles that they have in the system.

Smart Contracts

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.

World State

Merkle Tree

Provider

  • AccountDataProvider provides entries associated with given Account including:
    • DataProvider
    • AccountDataContext
    • Account Address
  • DataProvider provides entries for data access related to given Account.

Service

  • AccountContextService provides functionality caching AccountDataContext objects in memory.
    • Return AccountDataContext object in memory if cached
    • Return AccountDataContext object new created if not cached
  • ChainCreationService provides functionality creating a new chain including building and appending GenesisBlock.
  • ChainContextService provides functionality caching ChainContext objects in memory.
    • Return ChainContext object in memory if cached
    • Return ChainContext object new created with SmartContractZero if not cached
  • BlockValidatingService maintains BlockValidationFilter collection and provides entry of blocks validation.
  • SmartContractService provides functionality for obtaining SmartContract

Manager

  • BlockManager provides entries(get/set) for BlockStore
  • ChainManager provides functionality of appending the given Block to specified Chain and entries for ChainBlockRelationStrore
  • ChainManager provides entries(get/set)for ChainStore
  • SmartContractManager provides entries(get/set)for SmartContractRegistration storage
  • TransactionManager provides entries for TransactionSotre
  • TransactionExecutingManager contains scheduling algorithm and provides functionality of Transaction executing
  • WorldStateManager provides entry for WoldStateStore and functionality to obtain AccountDataProvider objects associated with given Account

Storage

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

Relation among Service, Manager, Storage

  • 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  |
    |             |  |             |  |            |
    +-------------+  +-------------+  +------------+
    

AElf topology