Modular Data Model
Background
Iroha Modular Data Model is a concept of "low-level" API for Iroha Peers processes configuration. It should be compared with Iroha DSL and decision about inclusion of this functionality in 2.0.x versions should be made.
More details on initial research:
Problem
The idea behind DM or HL Transact is to decouple business logic from the blockchain. It will allow to run Iroha with a subset of ISIs required for a specific deployment, or solely with Burrow EVM, or WASM as business logic layer, for example.
Solution
A data model (further referred to as DM) is a business model abstraction. It may provide interfaces to execute some commands and query some state. A DM implementation is a module that can be attached to an Iroha node. In that case, the set of commands delivered to a DM module is strictly determined by the ledger, which enables to build extensible blockchain applications.
Data Model approach gives an ability to extend basic Peer-side (server-side) functionality with general purpose languages (python, C++, etc.) and environments.
Iroha Users can deploy payload schemes for commands and queries:
message Set { string key = 1; string value = 2; } message Nuke {} message Command { // extends CallModel message Payload { oneof command { Set set = 1; Nuke nuke = 2; } } Payload payload = 1; .iroha.protocol.DataModelId dm_id = 2; }
And their implementations:
Implementation has no strict API, so it can work with disk and network I/O, use available libraries, global static memory, etc.
It also has no Iroha API inside, but it can be added if needed.
Decisions
Use protobuf schema for Commands and Queries payloadsUse some schema for Commands and Queries descriptions- Commands and Queries implementation should align to appropriate interfaces (rollback_block, load_persistent, etc.) in available SKDs?
- Executor makes a decision to proceed with command/query or not
Alternatives
- Use client-side transformers and adapters to support 3rd party tools via Client-side Iroha API
- Use already existing WASM runtimes as a backend
Concerns
- No strict requirements to environment is powerful yet dangerous solution
- Solution did not align well with Iroha 2.0 in it's current form
Assumptions
Clients and Iroha use gRPC or another protocol with Protobuf- Custom commands and queries has no obvious API for Iroha
Risks
Protobuf will not be enough for 3rd party applications and users `[9;7]`- Powerful environments will require a lot of resources `[9;5]`