Published 12 Oct by CryptoDiffer Community (@incodewetrust)
KardiaChain Code Review
KardiaChain’s perspective is that each blockchain has a different design to serve specific purposes and should be embraced for their own uniqueness. However, that there are inherited problems and limitations such as scalability and interoperability with regard to data and assets. It’s difficult to disagree with this opinion.
KardiaChain’s goal is to create a unified ecosystem that combines the collective strength of all participants to lay the foundation for the upcoming blockchain mass adoption, and idea which is quite appealing and supports the belief that a single project cannot solve all technical hurdles on its own.
KardiaChain follows an “integration without assimilation” approach which focuses on simplicity and ease-to-use from both the end-user’s and developer’s standpoint. Most proposals for interchain communications, currently require fundamental changes to existing blockchains and a massive wave of adoption of their protocol/framework from newly created blockchains
KardiaChain aims to interconnect dApps between blockchains, allow businesses/dApps on separate chains to interact with each others, and optimise speed and costs by creating a unified blockchain ecosystem. Congested transactions on one blockchain can be routed and processed on another to reduce congestion and combine processing power of other blockchains.
The primary solution of KardiaChain is the Dual Master Node.This solution offers a non-invasive way to facilitate decentralized inter-chain connection reduces costs and increases speed, further supported by KardiaChain’s sharding capability. It enables interactions between smart contracts on different blockchains, allows transfer of assets and data cross-chain
The Dual Master Node simultaneously accesses both ledgers of KardiaChain and another blockchain of choice and uses BFT dPoS consensus model to support the decentralization in cross-chain activities. It breaks down into the following main components:
1. Translator utilizes Kardia unified Smart contract Language (KSML) to break the language barrier between different smart contract platforms, facilitating a middleware for translation of instructions in smart contract between KardiaChain and external chains.
2. Router determines the best chain to direct the translated request based on multiple inputs such as current performance, fee, waiting time, and capacity.
3. Aggregator batches new updates from other chains to reduce strains on KardiaChain, potentially reduce one block of updates to one transaction on KardiaChain.
Smart contract templates that allow customization can be deployed on Kardia and then translated and forwarded as native contracts on correspondent chains. Furthermore, the Kardia ecosystem contains a decentralized exchange which allows atomic swap trading between assets on different blockchains.
Miners can stake KAI to become block creators and validators, join the consensus, secure the network, and earn block rewards. KAI serves as transaction fee when submitting smart contracts, dApps, and making cross-chain operations.
Source code review
The USP of KardiaChain is that it allows developers to create and deploy dApps running on multiple blockchains simultaneously without expert knowledge on how to write smart contracts for those chains.
Inter-chain functionality allows dApps to specify different actions to be executed across different chains, which offloads the congestion on a particular chain at specific time.
We conclude that the functional elements stated in the whitepaper to support the above are covered by the source code made available to us.
The code quality itself is high overall. By basing the product on open source code libraries and extending it with Kardia specific implementation, the project has a solid platform. The code is well structured and its core elements are commented sufficiently for maintenance.
Overall we deem the code to be in a working beta stage and having all the functional elements expected, based on the source file review and the functional test combined.
Download, installation and functional test of KardiaChain code
Complete code provided to us by the KardianChain project was downloaded and installed on InCodeWeTrust server.
An Ubuntu 17.10 Virtual Machine (Virtual Box) was used as target platform running on top of a Windows Server with a typical development environment including C++, Python, Go and other programming language library support. (However the installation is OS independent and will run on all major platforms as long as the referenced libraries are installed).
The docker installation for the Dual Master Node was executed and completed without any issues. We noticed that the team has put a lot of effort into testing this process and making it very smooth. In fact this is one of the easiest, issue free installations we have come across.
The node process was running and we could access it through localhost. There were no signs of instability throughout our test (updating the system with various background tasks while keeping the node alive).
Subsequently we used the npm package manager to install the block explorer (Kardia Scan). The installation went equally smoothly:
We proceed to connect to localhost:3000 in order to view the block explorer in a browser, and make rpc calls to the KardiaChain testnet, which works fine:
Next we built and executed the Kardia crosschain betting demo:
The code build was done without errors, only a few warnings without any actual importance (some references to code elements defined but not used).
The betting contract creation interface was brought up in browser by connecting to localhost:
We deployed the betting contract across Kardia, Ropsten and NEO testnet:
We proceeded to build and execute the Kardia crosschain voting demo:
And bring up the user interface in a browser:
Also this demo executed without issues and was able to create, translate and deploy contracts on all participating networks.
Finally we tried out the newly developed KardiaChain cross-chain exchange demo, which also worked flawlessly across Kardia, Ropsten ETH and NEO testnet. A video capture of the demo in action can be seen here:
The idea of utilizing computation and transaction resources cross-chain in parallel is definitely an appealing one, especially if this is done in a non-invasive way which doesn’t require any changes to the corresponding chains. KardiaChain has come a long way in realizing this, as proven by their core code and demos (especially the cross-chain exchange). Add to this the perspective of relatively quickly (approximately 4 weeks according to KardiaChain) adding cross-chain capability other than ETH and NEO makes this an attractive proposition. Furthermore, the team has solid experience in building large-scale distributed infrastructure and is actively working on several proposals with government/businesses.
Our technical assessment based on reviewing source code text files and installation/functional test of the executable code our conclusion is that the project is in a working beta stage. We have not encountered any issues in executing the code. The run-time behavior is stable and as expected from a functional point of view. The installation packages have been very thoroughly tested and provide a very smooth experience (although we would like to see 1-click deployment option to cloud providers becoming a standard in this type of project to accelerate adoption among non-technical node operators). Furthermore, the core elements of the code contain sufficient functional comments to support the maintenance of the project, which is something otherwise often overlooked in rushed blockchain projects.