Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Page properties
label


Status
Status
colourYellow
titleIn progress
Stakeholders
Outcome
Due date
Owner

...


Problem

Previous assumptions about Iroha Network and Web API in general were usage of iroha-client with encapsulation of underlying (plain TCP) protocols.
New needs from dependent projects require discussion of these assumptions and decision how to work with iroha network.

...

Iroha Bridge module provides an ability to connect different blockchains together and needs an ability to communicate between both sides via web interface.

Current Iroha approach is a proprietary TCP based protocol encapsulated inside `iroha_network` crate. `iroha_client` crate uses `iroha_network` inside and should be  used itself by other applications including another other blockchain solutions like `Polkadot`.

...

In this discussion we should make a decision - will this situation impact our current solution?

Introduction

To make a decision we should formalize the problem, allocate and analyze possible solutions.

...

Solution

Requirements from Iurii Vinogradov

  • We need Http compatible interface on Iroha side
  • We need and Http compatible client library which can support all Iroha user ISI, Query, streams.
  • HTTP client library should be implemented in Rust for use from Substrate.
  • We need JS compatible library to interact with Iroha2
  • The deadline is the middle of August.

Problem

Clients with only high level networking support (HTTP/WebSocket) need to do additional development for Iroha Bridge integration and may even have some runtime specific restrictions which will make it impossible.

...

Which can be rephrased as:

  • Iroha should provide HTTP API for:
    • Iroha Special Instructions Submission
    • Iroha Queries Execution 
    • Iroha Cloud Events Consumption
  • Iroha's Rust HTTP client library for Substrate's Off-chain Workers should be developed
  • Iroha's JS client library should be developed

Decisions

  • Iroha Bridge module will provide additional HTTP Endpoints on top of existing Torii Endpoints
  • JS library will use HTTP Endpoints and will not depend on Iroha codebase
  • Rust HTTP Client will be implemented as a separate `no-std` crate
  • Cloud Events will be implemented via HTTP instead of WebSocket because of Substrate's restrictions

Alternatives

  • Iroha provides HTTP API out-of-the-box
    • Need to define scope
    • Need to not duplicate peer to peer communications logic
  • Dedicated HTTP server module on Iorha2 Iroha 2 not included in the core but have an ability to proxy all ISI and queries if needed.
  • Iroha Bridge module provides HTTP wrapper on top of Iroha API (on the Peer side)
    • Need to define scope
    Iroha Bridge has an additional application as a proxy on top of Iroha API (as a standalone app or service mesh)
  • Every client is responsible for HTTP Adapters

Protocol

Also, we need to define protocol for HTTP messages. We have the next proposal:

  • JSON RPC - seems like a clearly define protocol able to generate code for multiple platforms.

Action items

  •  

Concerns

  • Any change in `iroha_network` algorithms and Iroha entities format will break clients
  • HTTP implementation of Cloud Events may be very slow and impact the throughput of the whole ledger

Assumptions

  • Bridge clients will use Substrate's Off-chain Workers with an ability to communicate over HTTP only
  • JS client has additional restrictions
  • All clients will use scale encoding

Risks

  • Backward compatibility breakage `[7; 9]`
  • Performance regress `[8; 5]`
  • Scale encoding will be hard to implement for non-rust clients `[3;5]`

Action items