This article describes how you can use the TYMLEZ Smart Contract Explorer to execute smart contracts directly from the graphical user interface.
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.
The smart contract templates are Node-RED flows and are indicated with a Node-RED marker:
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.
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:
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":
Click the Publish button to publish this smart contract.
Click on "Open Instance" to view the published smart contract.
Here, the smart contract ID is visible.
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:
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".
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.
Return to the main explorers page.