Architecture
Smart Contract Architecture#
A blockchain platform works like a distributed database that stores all smart contracts. Each contract has a unique address used for state queries and updates. Methods in the contract code handle permission checks and logic.
Smart Contract Parts in aelf#
Smart contracts in aelf are divided across the Kernel, the runtime, and the SDK. The Kernel handles core components and execution abstractions. Contracts rely on runtime modules and the SDK.
A smart contract consists of methods that interact with state variables. Transactions trigger these methods to modify the blockchain state.
Architecture Overview#
aelf defines Smart Contracts as micro-services, making them language-independent. For example, the Consensus Protocol is a service defined by a smart contract.
Chain Interactions#
Smart contracts interact with the chain and access contextual information via a bridge and a bridge host. The SDKs implement features to communicate through the bridge.
Key contextual information provided by the bridge includes:
The bridge also allows:
State#
Smart contracts read and/or modify state. The language SDKs provide state helpers and access through the bridge’s StateProvider.
Runtime and Execution#
When a block’s transactions are executed, each transaction generates a trace containing:
SDK#
aelf has a native C# SDK for developing smart contracts in C#. It includes:
Any developer or company can create an SDK and runtime for a specific language by adapting it to communicate with the bridge through gRPC.
Edited on: 15 July 2024 03:23:28 GMT+0