Writing Smart Contracts using Vyper, Remix IDE and deploying them on BNB Smart Chain.
Tags: smartcontract, vyper, ethereum, binancesmartchain
Published: 2024-05-10 14:34:54

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](https://academy.binance.com/en/articles/connecting-metamask-to-binance-smart-chain) 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.

1. **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.

![An image showing how to change remix IDE to user the Vyper compiler.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xp7ezi9enli6f8ff37xo.jpg)
2. **Create a new file named testing12.vy:**
   
![Choose the create new file icon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w273dgvghohh2zflllg8.jpg)
3. **Copy and paste the following code into testing12.vy:**

```vyperlang
# A simple Vyper contract
@external
def sayHello() -> String[13]:
    return "Hello, World!"
```
4. **It's time now to compile our code.**

![Compiling our code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vfeqr0doexdo5tl28u53.jpg)

5. **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.

![Deploying the smart contract](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sq5rbihk9t6c220dsw50.jpg)

Lastly, we are going to check the status of our transaction.

First, go to [BSc testnet](https://testnet.bscscan.com/) . 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** 

![Block number](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a2sna6eoeihi9gb6fwbw.jpg)
and paste it into the search bar and press enter. You'll get such a result;

![Deployment Details](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8f5seohys5vtsdte6eqw.jpg)

**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](https://dev.to/mosesmuwawu/how-to-interact-with-smart-contracts-locally-using-web3py-2896)
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 😍