Replies: 1 comment 1 reply
-
@damip The features explained above seem very desirable! Have we decided something on it yet? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Modular architecture with full account abstraction
Intro
In this concept architecture, the concept of native Massa token is removed and only ERC-20 like tokens exist, with full native account abstraction. The architecture is split in three main parts:
Architecture elements
The Service Provider
The Service Provider exposes an API and has multiple plugins. Someone can ask the Service Provider to perform a given task in exchange for a payment in the outside world or through an internal mechanism.
One of the requests that can be sent to the Service Provider is to execute an Operation in the smart contract realm.
An Operation is a vector of bytes. It is not signed.
When the Consensus modules notifies the Service Provider of an opportunity to include Operations in a block being created, the Service Provider sends the Operations it desires to include.
If a Service Provider misbehaves, users will avoid that Service Provider in the future (local reputation).
The Consensus module
The Consensus module handles block production, and exchanges blocks with other nodes using a P2P system. When consensus is achieved, the module emits a history of timestamped items using a standardized format:
Those items can be block creation, operations to execute, roll changes.
Consensus uses simple bitcoin-style addresses based on digital dignature keypairs, and does not interpret the content of Operations, except the RollTransfer operation.
The consensus module handles the Roll Registry associating addresses (hash of pubkey) to how many rolls that address has.
All rolls are always in the possession of staking addresses. There are no RollBuy/RollSell operations but only signed RollTransfer operations allowing one address to sign the transfer of some of its rolls to another address. When a staker doesn't produce blocks when selected to do so, its rolls are progressively randomly redistributed to other stakers.
The Execution module
The Execution module handles a ledger that associates an account name string (eg. "myaccount") to:
The Execution module runs a VM that executes Operations that are meant for it.
An Operation is anonymous: it has no signature nor owner but only contains a max_gas field and bytecode to execute.
Account creation/deletion is a smart contract ABI.
There is no Call ABI but there is an "ExecuteAs" ABI that takes bytecode to execute, an account name in which context we want to execute, a function name of that bytecode to call, and arguments to be passed to this function, and attempts to execute the bytecode in the context of the target account. This only works if the bytecode is in the list of bytecode hashes allowed for execution by the target account, or any bytecode if called in the context of the target itself.
The Execution module runs on its own time and can execute things without necessarily following the consensus slots.
Modularity
Note that because of this modular architecture and standardized interface, the Consensus module can be replaced by any other system allowing to inject arbitrary bytes and output them in a deterministic consensual orderly and timestamped fashion (the module can be Bitcoin itself !). One or multiple consensus modules can feed one or multiple Execution modules.
Recreating existing concepts
Examples that give an intuituion on how existing concepts can be recreated in this alternative architecture without ever being hardcoded in the consensus. Everything is done in the smart contract realm !
Externally owned accounts
There is no concept of externally owned account in the SC realm.
The only way to interact with an account is through exported functions of the bytecodes allowed for execution by that account.
To emulate an EOA, let's say that one of the bytecodes allowed by the
damir
account (and stored in its datastore under the nameproxy_eoa
) has a genericexecute_bytecode_with_auth(bytecode, func, params, nonce, signature)
exported function that allows its owner to execute arbitrary instructions in its name:Thanks to this approach, the owner of the account
damir
can call something by executing an Operation (remember that operations are not signed and they are anonymous) with the following code:Note that thanks to the
ExecuteAs
concept, the accounts using theproxy_eoa
bytecode don't necessarily need to store it, it can just be stored once elsewhere and simply hash-authorized by all accounts that want to support it.The ERC20 smart contract for the
massa
tokenThere is no native token. But the Massa token is an ERC20-like in the smart contract realm.
The token holds a map of account names to the amount of tokens they have.
It exposes a transfer function that allows the account at the top of the call stack (if any) to transfer its tokens to any other account.
Block rewards
The Massa ERC20 token exposes a
mint
function that allows an arbitrary amount of tokens to be minted by anyone and transferred to an arbitrary account with a limit of X tokens per 500 millisecond timeslot. This function can be called by the block producers at the top of their block to mint new block rewards and distribute them to their accounts.Paying fees to block producers
Every operation that a user asks a Service Provider to execute should also atomically credit the Service Provider with some reward, typically an ERC20 token. If the block producer is not satisfied with the results of simulating the execution of the operation, they won't execute the Operation.
Buying/selling rolls
Since the Consensus realm is separate from the smart contract realm, buying rolls from someone that can be done in the following way:
Paying for storage
Storage is limited to 1TB (any further writes will fail). However storage is free in this architecture.
To emulate storage fees, a
storage
smart contract can be created that does the following:Beta Was this translation helpful? Give feedback.
All reactions