2019 Summer Mentee Project Update: Integration of EVM from Hyperledger Burrow into Hyperledger Iroha

Hello, my name is Ivan Tyulyandin. I am a student at Saint Petersburg State University. I took part in the Hyperledger Internship Program, working with Andrei Lebedev (my mentor), Iurii Vinogradov and Eugene Kovalev from the Hyperledger Iroha team.

Hyperledger Iroha is a straightforward distributed ledger technology, inspired by the Japanese Kaizen principle — eliminate excessiveness. Users can create and manage their assets via Iroha commands. Iroha is written using C++, Protobuf, Boost and GTest. There are no smart contracts in Iroha.

Introduction

Hyperledger Burrow provides a modular blockchain client with the possibility to change different parts of the system. One modular piece is a permissioned smart contract engine, partially developed to the specification of the Ethereum Virtual Machine (EVM). Burrow is developed using language Go.

The main purpose of this internship was to integrate EVM from Hyperledger Burrow into Hyperledger Iroha. Since Ethereum is de facto the most known platform for smart contract development, the integration will let Ethereum developers use Iroha as a new blockchain in distributed applications.

Project Components

The starting point was identifying the main components the project needed to address: 

  • First of all, there should be a way to pass data (such as Ethereum bytecode, caller and callee) from Hyperledger Iroha to Hyperledger Burrow EVM. For this purpose, a new command to Iroha has to be added.
  • Another issue is to connect Golang and C++ code to bind Iroha and EVM. 
  • The next step is to implement a special Burrow API to store EVM accounts data in Iroha.
  • The final requirement is new functionality testing.

Challenges

One of the challenges was to get deeper into the codebases of Hyperledger Burrow and Hyperledger Iroha. Existing integration examples of Burrow EVM to Fabric and Sawtooth gave me a nice understanding of what to do. From the Iroha side, Andrei Lebedev led me through the Iroha source code.

Results

With this information, I was able to develop a new command EngineCall. I made a wrapper using CGO (special go compiler mode that generates C library from Go source code) that Iroha uses to call Burrow EVM. Now an implementation of Burrow EVM API can send requests to Iroha for modification of its state via Protobuf messages. Every EVM account is stored in a technical account in Iroha. EVM account storage is emulated in the technical account details (which is key-value storage). All of this work was QA’d by writing and completing module and integration testing.

What comes next

More features can be added to this  integration. The first one is web3 interface implementation, which  will call remote EVM instance or use a local one. The next possible improvement is to add permissions to an Iroha account that represents an EVM account. Also, the current support of Burrow EVM in Iroha is not full, since there is no catching of EVM logs.

For more on this project, please read my full report.