- Ethereum Tutorial
- Ethereum - Home
- Ethereum - Introduction
- Ethereum - Smart Contracts
- Ethereum - Solidity for Contract Writing
- Ethereum - Developing MyContract
- Ethereum - Compiling the Contract
- Ethereum - Deploying the Contract
- Ethereum - Interacting with the Contract
- Ethereum - Limitations of Remix
- Ethereum - Ganache for Blockchain
- Ethereum - Ganache Server Settings
- Ethereum - A Quick Walkthrough
- Ethereum - MyEtherWallet
- Ethereum - Creating Wallet
- Attaching Wallet to Ganache Blockchain
- Ethereum - Deploying Contract
- Interacting with Deployed Contract
- Ethereum - Creating Contract Users
- Ethereum - Summary
- Ethereum Useful Resources
- Ethereum - Quick Guide
- Ethereum - Useful Resources
- Ethereum - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Ethereum - 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.
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.
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 −
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.
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.