Published 15 October 2018

Cross-language work with smart contracts

Cross-language work with smart contracts

The term of cross-language work

The term of cross-language work with smart contracts refers to the ability to create smart contracts, execute smart contract methods, view results, monitor the performance of the platform of the programming languages that are supported on the CREDITS platform.

The API is used to implement this capability. The API documentation describes overriding of types, application structures and methods by language constructs of the Thrift interface description language.

Supported programming languages:

  • C++ (complete access, node implementation)
  • Java (within the API, implementation of Desktop Wallet, Contract Executor)
  • C# (within the API, CREDITS Monitor)

Creating a smart contract and executing its methods is only possible in the Java language with the JVM installed.

Thrift (code generation)

Thrift (code generation)

Thrift is a language of interface description, used to create different services for various programming languages. This makes it possible to associate different operating systems and applications written in different languages into a single running system. Thrift is a framework for RPC (Remote Procedure Call) and a binary communications protocol.

api.thrift description language, which contains structures and functions, is used to communicate with external clients. It generates the source code in the required language.

Examples used (C++, Java, C#)

Examples used (C++, Java, C#)

Examples of generated code for the specified languages for the "BalanceGet" method:

Description on Thrift:

C++ (node implementation)

Java (Desktop Wallet (wallet-desktop.jar), Contract Executor (contract-executor.jar)

C# (CREDITS Monitor)

Advantages of using and implementing the API:

  • cross-language serialization with lower overhead costs, as opposed to alternatives such as SOAP, through binary format
  • simple and clean library, does not need a framework for code
  • XML-configuration is not used
  • language bindings are felt natural

 

0 Useful article

Contents