Interacting with the Contract

When you click the deployed contract, you will see the various public methods provided by the contract. This is shown in the screenshot below.

Deploy Public Methods

The first method send contains an edit box in front of it. Here, you will type the parameters required by the contract method. The other two methods do not take any parameters.

Sending Money

Now, enter some amount such as 100 in front of the send function seen in the contract window. Click the send button. This will execute the contract send method, reducing the value of the contract value field and increasing the value of the amount field.

Sending Money

Examining Contract Value

The previous send money action has reduced the contract value by 100. You can now examine this by invoking the getBalance method of the contract. You will see the output when you click on the getBalance button as shown in the screenshot below −

Examining Contract Value

The contract value is now reduced to 900.

Examining Collected Amount

In this section, we will examine the amount of money collected so far on this contract. For this, click on the getAmount button. The following screen will appear.

Examining Collected Amount

The amount field value has changed from 0 to 100.

Try a few send operations and examine the contract value and the amount fields to conclude that the deployed contract is executing as expected.

Similar Posts

  • Summary

    You learned how to write your own digital contract in Solidity. You developed and tested the contract interface in the Remix IDE. For further multi-user testing, you deployed this contract on Ganache Blockchain. On Ganache, you created two user accounts. The first account was used for publishing the contract. The second account was used for…

  • A Quick Walkthrough

    We will now briefly understand what is available on the Ganache desktop. On the Desktop, at the top we have several menu options out of which a few are of immediate relevance to us. The menu bar is highlighted in the screenshot below − Clicking on the TRANSACTIONS menu shows all the transactions performed so far. You…

  • Deploying Contract

    To deploy the contract, select the Contracts menu option as shown in the screenshot below − You will need to enter the contract’s bytecode on this screen. Remember, when you compile your Solidity contract code, it generated a bytecode that runs on EVM. You will now need to obtain this bytecode from Remix IDE. Go to the Remix…

  • Compiling the Contract

    Once you write the complete contract code, compiling it in this IDE is trivial. Simply click on the Autocompile checkbox in the IDE as shown in the screenshot below − Alternatively, you may compile the contract by clicking the button with the title “Start to compile”. If there is any typo, fix it in the code window. Make…