Now that you have deployed the Hello World smart contract on the Tron blockchain, you can interact with it by calling the various functions defined in HelloWorld.sol. Tron-IDE provides the function of calling smart contract functions.
If the contract has been deployed, you can also enter the contract address (TAbsq7DzmrFriHZ5Vk2cK4npCcYPvtWhZ8) into the At Address in the deployment tab to call the smart contract function.
The contract contains the functions
postMessage function is state-changing because it changes the message variable within the contract, so when calling this function, it needs to be signed, and it will consume resources and generate transaction records. The
getMessage function is read-only because it only returns the message variable (reading the contract, not changing the state),so no signature is required and no resources are consumed.
A successful function call of
getMessage returns the id and contract_result within the transaction receipt. The id is the hash of the transaction broadcasted to the blockchain, and the contract_result is the output of the function call executed. The
getMessage function returns the variable message, which in this case is an empty string. We can change that by calling
Congratulations! You have successfully created, compiled, deployed, and interacted the HelloWorld smart contract on the Tron blockchain.
Updated almost 4 years ago