Gravity test framework now supports TRON

Shamil Khalilov
Gravity Protocol
Published in
4 min readOct 27, 2020

In continuation of the series of target chain integrations, today we are describing the integration of TRON testnet into the Gravity test framework, expanding the current scale of Gravity to four target chains alongside with Ethereum, Waves, and Binance Smart Chain. In line with the previous article, this article is focused on providing a case-based overview of how a new target chain can be incorporated into the network.

Gravity’s recently launched devnet version is designed for public testing of upcoming Gravity updates to maintain compatibility and synchronization with regularly updated integrated networks.

One of the crucial ideas that can help retain blockchain agnosticism of the protocol is the integration of a wide range of major target chains, besides Ethereum and Waves, which have been part of the network since the start. This is needed to establish an adequate technical foundation that would encompass the majority of features potentially required by target chains, thus facilitating new integrations.

Tron is a blockchain-based decentralized operating system much like Ethereum that aims to advance the decentralization of the Internet and its infrastructure. At its core, Tron is a smart contract platform that offers high throughput, high scalability, and high availability for all Decentralized Applications (DApps) in the TRON ecosystem. The Tron blockchain is built around the usability of its native token, Tronix (TRX). The Tron blockchain was created by Tron Foundation, a Singapore-based organization that is currently headed by Justin Sun.

In this article we are using Tron as a representative case of integration of a blockchain that is compatible with Solidity contracts. Through this guide, we will showcase the framework for integration tests — a flow for adding new target chains that we are offering to open-source Gravity developers.

Integration test framework

Currently, the integration testing framework contains tests related to cross-chain transfers based on SuSy, a blockchain-agnostic cross-chain asset transfer gateway protocol implemented over Gravity.

The integration-tests repository verifies the entire functionality of a SuSy gateway in a given target chain. Tests for the contracts are written in Golang using a general-purpose library, testing. If the set of Gravity tests executed in a newly integrated target chain is successful, then all stages of the implemented integration, starting from the logic that implements reading from the blockchain (extraction) and ending with on-chain data verification, should be deemed successful, too. Code that has been debugged using the framework can be reused to fully integrate a specific target chain and its smart contracts into the main Gravity network, as will be described in detail in the upcoming articles.

TRON Shasta integration overview

Preparing accounts and infrastructure

In this section, we will take you through the steps on how to launch Gravity tests on the TRON Shasta testnet, accessing the public TRON test network.

To run tests on your machine or a dedicated server, make sure that docker & docker-compose are installed and available for use. For the convenience of developers, we have provided a pre-funded account on the TRON Shasta testnet: 0x657FeC03D0a19Ad719903E3ee1339B762627100d. However, in case there aren’t enough funds, you may need to pre-fund this address with test coins (TRON) using the TRON faucet.

If you want to use your own testnet account to conduct tests, use this guide explaining how to create a TRON Shasta testnet account and fund it with testnet TRON tokens.

After the creation of an account, paste the key into the ./integration-tests/solidity/tron/config.json file, replacing the first private oracle key (“oraclepk”).

Finally, run the test-tron-shasta.sh bash-script to deploy and test contracts in the TRON Shasta testnet.

As you can see on the screenshot, all the tests have successfully passed, meaning that the integration tests for SuSy application have run successfully and that they behave as expected. Moreover, it confirms the compliance of the network to Gravity Protocol requirements, meaning that we are ready to proceed to the next integration step.

This article offers a guide on how TRON Shasta testnet can be interacted with from within the integration test framework that enables implementing and testing Gravity contracts. We believe that this framework can facilitate development experience for external collaborators, ensuring faster expansion of the Gravity ecosystem. In the next article about TRON Shasta testnet integration, we will explain how to finalize the integration by adding the target chain into the Gravity Core interface and deploying all necessary smart contracts to TRON Shasta testnet accounts. Stay tuned!

For more information, you can read the Gravity Whitepaper, visit the Gravity website, join the community on Twitter or Telegram or contact press@gravity.tech

--

--