Contract interaction can be accessed by clicking the respective button (Interact) located at the left side menu (the mouse icon).
Interaction is only available after a given contract has been deployed. The address of the deployed contract is a requirement for interacting with it. When trying to access Interact mode without having the contract deployed, the following message will appear in the Interact window:
"No contracts deployed in this network"
Taking the Hello World template as an example, deploy the HelloWorld.sol contract by clicking the Deploy button at the editor top bar (the play icon). After the deployment process finishes with a successful message, stating that work has been "Done", the Interact mode will be available.
The interaction window is organized on a per contract basis.
The legend of colors is as follows:
- Constant (green color): a constant function which runs outside of a transaction and can return one or many values. Running it does not consume any gas nor can it mutate the state of the contract.
- Transaction (yellow color): a function which always runs inside a transaction. It consumes gas and doesn't allow any ether to be sent with it. A transaction always returns a transaction hash. In order to retrieve the transaction status, it is necessary to read the transaction receipt.
- Payable (red color): a payable function which always runs inside a transaction. It consumes gas and allows ether to be sent along with it. A transaction always returns a transaction hash. In order to retrieve the transaction status, it is necessary to read the transaction receipt.
The interaction window lists all publicly available operations for a given contract. The data is auto-generated, based on the contract source file. For each operation, there will be a list of input arguments, when the function signature contains such element. The gas specification parameters (limit and price in Wei) are set based on the configuration preferences.
Clicking the yellow or red button, named after the contract function signature, sends the transaction using the parameters defined in the previous steps, taking into consideration the selected network and account. At the end, after the transaction has been sent, the resulting transaction receipt will appear in the Output window.
Following the publicly available operations, there can also appear a list of publicly available data and read-only operations, which don't require a transaction to execute. The data for this is also auto-generated, based on the contract source file. For each available operation, there will be a list of input arguments, when the function signature contains such element, followed by a green button named after the contract data or function name.