1
CryptoHow To

How To Interact With Your Smart Contract On Binance Smart Chain

2 Mins read

Let’s look at how to interact with your smart contract on Binance smart chain. Hopefully, you have had a chance to create your smart contract here. This is a continuation of that article, so please check it out before proceeding.

How To Interact With Your Smart Contract On Binance Smart Chain

Step I

How To Interact With Your Smart Contract On Binance Smart Chain

Scroll down on the newly created contract and click on the token dropdown, You will see something like this.

Step II

Getting the address

How To Interact With Your Smart Contract On Binance Smart Chain

Copy the address listed on your Account by clicking the copy button

How To Interact With Your Smart Contract On Binance Smart Chain
  • Paste the address on the balanceOf field
  • Click on `balanceOf` and obseerve the results on the debug console
  • Our balance is now 50000 PETER as we anticipate!!

Well done for making it this far! Let’s now look at how to transfer your coins to some other account.

Step III – Sending to another address

How To Interact With Your Smart Contract On Binance Smart Chain

Choose a new address on your Metamask and copy the address.

We will transfer our PETER tokens to that address

Step IV

How To Interact With Your Smart Contract On Binance Smart Chain

Paste the newly copied address in the transfer method, also put a comma and the amount you wish to transfer. In my case I input

<address******>, 1000

This means I wish to transfer 1000PETER from my main address to the new address. Click transfer and confirm the Metamask popup that comes up.

Step V

How To Interact With Your Smart Contract On Binance Smart Chain
  • Note the successful transfer of PETER coin after confirming the transaction.

Confirming the transfer!

In order to confirm the transfer, we need to check that our tokens have actually been transferred to the new wallet address.

First, we need to add our token contract to our Metamask. To do this, copy your token address as shown below.

Step VI

How To Interact With Your Smart Contract On Binance Smart Chain
  • Copy the address of where our contract is deployed by checking the debug logs

Step VII

How To Interact With Your Smart Contract On Binance Smart Chain

Select the new address on Metamask that we just sent the tokens to.

Click import tokens on Metamask

How To Interact With Your Smart Contract On Binance Smart Chain

Click “Add Custom Token” after pasting the token address

Click Import Token on the next page

Confirm that your token has a new value!!

Well done! Now, lets check whether our main account has less amount after doing the transfer!

Step IX

How To Interact With Your Smart Contract On Binance Smart Chain
  • Copy and Paste the address of the main account on the balanceOf field
  • Click on `balanceOf` and obseerve the results on the debug console
  • Our balance is now 49000 PETER as we anticipate!!

Conclusion

  • You could even play around with the new methods we created and see that the contract works as expected.
  • See the screenshot, you should see something similar to that

Wow! Good job if you followed this to the end! Hope you enjoyed this!

You might be interested in how to start buying crypto.

Don’t miss amazing tips!

1
Related posts
How ToProgrammingSoftwareTechnology

How to configure Apache Airflow on MacOS locally

4 Mins read
Table of contents0.1 Creating the project folder and the virtual environment0.2 Installing0.3 Running airflow0.4 Starting the webflow server0.5 Starting the scheduler0.6 Running…
Code ChallengesHow ToProgrammingSoftware

How To Implement Merge Sort and Quick Sort Algorithms In Python 3

3 Mins read
Table of contents0.1 Merge Sort0.2 Quick Sort0.3 Conclusion1 Don’t miss amazing tips! Let’s have a look at how to how to implement…
How To

How to write test with Ruby and Capybara with Examples

11 Mins read
Table of contents1 What are the advantages of using Capybara1.1 1) Webdriver agnostic1.2 2) Works with multiple testing frameworks1.3 Capybara DSL1.4 a)…

Leave a Reply

Your email address will not be published. Required fields are marked *

62 − 61 =

×
Crypto

Common Crypto Jargon You Should Know About