Contract interaction can be accessed by clicking the respective button - Interact - located at the left side menu (the mouse icon).

Requirements

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.

Color legend

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.

Transactions

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 hash will appear in the Output window.
When deploying to an external network, it is required to use an external provider. The MetaMask browser extension is supported.

As an example, following the Hello World template, set the network to Rinkeby by clicking the Select a Network button located at the top left side of the screen. After having deployed the contract to Rinkeby, sending a transaction requires transaction signature, which is handled by the external provider. Clicking the yellow or red button will call the external provider to confirm, sign and submit the transaction, passing control back to Ethereum Studio at the end of the process. After the external provider finishes intermediation, interacting with the contract works in the same manner as with any other network.

Read-only operations

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.

Common errors

Below is a list of common errors that occur when trying to send a transaction to interact with a contract using an external provider:

  • When no accounts could be loaded from the external provider, this error message will appear: "There is no account available to do the transaction"
  • When the external provider is found but the account wallet is locked or inaccessible, the following error will occur: "External/Metamask provider is locked. Can't proceed."
  • When a transaction rejection or other unknown error returns from the external provider, the following error message will appear: "MetaMask Tx Signature: User denied transaction signature."
  • When the gas limit is too low, the resulting error message will be: "Error: intrinsic gas too low"
Did this answer your question?