Creating Contract Users

In this chapter, we will learn the creation of contract users on Ethereum. To create a user for our published contract, we will create another MyEtherWallet client attached to the same Ganache Blockchain that you have been using in the previous steps. Go to the MyEtherWallet screen and create a new wallet.

Click on the contracts menu and select the “Interact with Contract” option as in the earlier case. Note that this new user is going to simply interact with the already published contract and not deploying his own contract. Specify the contract address and the ABI that you used in the earlier case.

Interact with Contract Address

Now, click Access button and invoke send method. When asked, input some value say 100 ETH to be sent. Submit the transaction. Upon submission, the following screen will appear.

Interact with Contract Access

To attach this new client to our Ganache Blockchain, go to Ganache Console. Click on the keys icon of account # 2 as shown in the following screenshot −

Ganache Console Screenshot

You will get the private key for account # 2.

Ganache Console private key

Copy the key that you receive and use it in your newly created wallet as shown here −

Newly Created Wallet

Click on the Unlock button to attach the wallet.

When the wallet is successfully unlocked, write the desired send transaction.

Wallet Successfully Unlocked

Generate the transaction by clicking on the “Generate Transaction” button.

Generate Transaction

Make the transaction and wait for some time for it to reflect in the Blockchain. Now, execute “getAmount”, the amount shown should be 200 now.

Generate get Amount

Execute “getBalance”. The value field should now be 800.

Generate get Balance

Examine the transaction log to see the various transactions performed by different users.

Examine The Transaction

Similar Posts

  • MyEtherWallet

    For client application, you will use MyEtherWallet. Download MyEtherWallet software from the following URL − If required, unzip the downloaded file and open index.html. You will see the following interface for creating a new wallet.

  • 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…

  • Creating Wallet

    In this chapter, we will learn how to create Ethereum wallet. To create a new wallet, enter a password of your choice and then click on the “Create New Wallet” button. When you do so, a Wallet would be created. A digital wallet is essentially the generation of a public/private key pair that you need…