TYMLEZ Smart Contract Explorer

This article describes how you can use the TYMLEZ Smart Contract Explorer to execute smart contracts directly from the graphical user interface.

Introduction

The TYMLEZ Smart Contract Explorer is a graphical user interface (GUI) that enables you to run smart contract templates available on TBSP on Google Cloud Platform directly on the TBSP UI. 

In addition to the templates, you can see active smart contract instances and also filter by contract ID or owner.

Description

The smart contract templates are Node-RED flows and are indicated with a Node-RED marker:

Screen Shot 2020-06-30 at 3.58.16 PM

Whenever a template is published using the Smart Contract API, a smart contract instance is created.

The Smart Contract Explorer comprises two components: the template explorer, which contains all the templates available to the platform, and the instance explorer, which lists all smart contract instances. 

Prerequisites

You need to be an admin user in order to access the smart contract explorer.

This ensures that only authorized users are able to view active and completed smart contracts. 

Use the UI

After logging in the TBSP UI as an admin user, the Smart Contract Explorer is visible in the sidebar as a menu item:

Screen Shot 2020-10-21 at 1.24.35 PM

Click on the Smart Contract Explorer. You will see the different contract templates available on TBSP on Google Cloud Platform. 

Run smart contract SC_HelloWorld_Part1

Let's publish and execute a smart contract with the template SC_HelloWorld_Part1.

As outlined in the smart contract tutorials, deploying this specific template will publish a simple smart contract with a value stored in its contract memory.

After publishing this smart contract, you can execute the contract to obtain the value stored in its memory.

Publish a Smart Contract

Click on the template SC_HelloWorld_Part1.

The contract template contains a number of elements:

  • the contract template you have chosen
  • a short description of the contract template
  • functions, which are execution instructions for the smart contract.

In the example below, the init function enables you to publish the smart contract. To publish this specific smart contract, you have to provide an argument, which essentially is the message to be stored in the contract.

The other function is getGreeting, which enables you to retrieve the message stored in the smart contract. 

To begin, enter the desired message of your choice in the "Greeting" field. In this example, we will use the greeting "Hello":

Screen Shot 2020-09-21 at 3.00.12 PM

Click the Publish button to publish this smart contract.

Screen Shot 2020-09-21 at 3.00.33 PM

Click on "Open Instance" to view the published smart contract.

Here, the smart contract ID is visible. 

Screen Shot 2020-09-21 at 3.00.47 PM

In Contract Instance, you can see information such as the owner's public key and the timestamp. 

Execute smart contract

Now, execute the contract by placing a call.

In the Functions tab, navigate to getGreeting and click on the Call button: 

Screen Shot 2020-09-21 at 3.01.12 PM

In the contract instance, you can see the state of the smart contract as well as the result of the call.

Alternatively, you can also access the state of the contract, which is stored in the database, by clicking on "Get State".

Screen Shot 2020-09-21 at 3.01.29 PM

You can also use the Smart Contract Explorer to run more complex smart contract templates, such as the vehicle transfer flow and the escrow flow.  

Navigation

Return to the main explorers page.