Having had a strong background in python, I looked for the language that was fit for me to write smart contracts on the BNB Smart Chain. Since the BNB Smart Chain is compatible with the Ethereum Virtual Machine(EVM), Vyper (a pythonic smart contract programming language) was a perfect choice for me.
Without wasting time , let's dive in the building procedure.
In this tutorial, we gonna be writing a very simple smart contract code that returns "Hello World".
Requirements:
- Remix IDE
- MetaMask wallet chrome extension(recommended)
First, we need to setup our MetaMask wallet so as to be able deploy our smart contracts to the binance smart chain testnet.
Since we have everything properly setup, let's start the building process. Our next target is Remix IDE.
- Set up Remix IDE to work with vyperlang: First, go to the plugin symbol just above settings and activate the Vyper compiler as shown below.
- Create a new file named testing12.vy:
- Copy and paste the following code into testing12.vy:
# A simple Vyper contract
@external
def sayHello() -> String[13]:
return "Hello, World!"
- It's time now to compile our code.
- Next is deploying our compiled code to bsc.
You'll note that after pressing the deploy button, a metamask wallet window pops up requiring you to either accept or reject the transaction.
Lastly, we are going to check the status of our transaction.
First, go to BSc testnet . Here, you'll find a record of your transactions. The question is, how? Simply copy the block number from the remix IDE e.g; 40149350
and paste it into the search bar and press enter. You'll get such a result;
Closing Remarks:
Building on the Binance Smart Chain (BSC) using Vyper is an exciting journey into the world of decentralized applications (DApps). Vyper's simplicity, security and readability make it a great choice for smart contract development, especially for those who are new to blockchain programming or with a background in python. If more interested, you can check on how to interact with smart contracts locally using web3.py
Lastly, if you found this article helpful, don't forget to show your support by liking 👍 and sharing it with others who might benefit from it.
Thank You 😍
Top comments (0)