Comparing Distributed Ledgers by Game of Thrones Use Case — ICON

Paul Plessing
4 min readAug 22, 2019

--

This is the first part of our series “Comparing Distributed Ledgers by Game of Thrones Use Case”. To find out more about the series and the other articles of it, check out our intro article!

Photo by Perry Grone on Unsplash

ICON is a blockchain that aims very high. The idea is to connect existing distributed ledger technologies with each other. Like the internet started to connect intranets all over the world, ICON wants to connect blockchains and other distributed ledgers (DLTs) with each other. This would enable us to move freely between blockchain solutions for health care, for entertainment purposes or governmental concerns. In ICON, these DLTs are called “Communities”, and its native currency is ICX.

To see the source code of our implementation, head over to our GitHub.

Technical Overview

The ICON network is based on Loopchain. Loopchain is a multi-channel blockchain that uses Loop Fault Tolerance (LFT). LFT is an improved PBFT. For both the public ICON network as well as private blockchain implementations for large business clients Loopchain is used. The idea behind private networks is to connect them with each other via the public ICON network later on.

ICON uses Delegated Proof of Contribution (DPoC), a modified version of Delegated Proof of Stake (DPoS), where the reputation of a node is not only defined by the coins at stake but by the overall contribution to the network (incl. the coins at stake). ICONists (holders of ICX) can delegate their I-Score to representatives which then vote for different rules and policies on the ICON network. Such representatives can be P-Reps or C-Reps. A P-Rep is a governance node that doesn’t belong to any community, so it votes in favour of the overall ICON network. A C-Rep is a governance node that votes in favour of its community and the overall ICON network.

As Loopchain is a multi-channel blockchain, there are also different channels. The representation channel is a consensus system where P-Reps and C-Reps decide on different rules. In the Notary Channel, transactions are forwarded between communities. The Public channel is the channel where everyone can participate, e.g. sending ICX or using DApps.

Implementation

The implementation of our lovely Game of Thrones use case was not without challenges, but successful in the end. Remember, in our use case we want to represent many alliances, that each can hold several families. These families in turn can be transferred between alliances.

To begin with, a visit to the official documentation should show us how a beginner can start developing on ICON. To our misfortune, we couldn’t get the local requirements as specified in the documentation for tbears to work. Therefore, we used the tbears docker container provided by ICONLOOP’s DockerHub as our tbears environment. To enjoy the fully working container environment, while still being able to edit files on our favourite editor, we just mapped our working directory into the docker container. This worked wonderfully, and we could start coding.

The official documentation of writing SCORE’s (Smart Contract on Reliable Environment) was really understandable and easy to implement. SCORE’s are written in Python, and are very similar to Ethereum’s smart contract language ‘Solidity’. To persist data on the blockchain, you need to use the inbuilt database structures. This is a cool new concept in the blockchain space. At the beginning, we had some issues because we wanted to use the inbuilt storage structures in very fancy ways. However, we decided to implement our SCORE with good old smart contract coding structure.

To interact with our contract, we used ICON’s SDK for Python. Normally we prefer to use Javascript, but in this case we decided to use Python because the smart contracts are written in the same language, hence we assumed more synergy. The Python SDK is easy to use, everything worked and was straight forward.

Pros and Cons

Pros:

  • Awesome vision
  • Easy to learn smart contract language (especially with Solidity background)
  • Cool storage abstraction
  • Fast
  • Scaleable
  • Can update contract instead of deploying a new one

Cons:

  • Little bit difficult to get started
  • Requires docker knowledge

block42 is a blockchain solution provider developing applications on top of most recognized blockchain frameworks like Ethereum, Hyperledger, BigchainDB and many more.

--

--