DEV Community

Muwawu Moses
Muwawu Moses

Posted on

Writing Smart Contracts using Vyper, Remix IDE and deploying them on BNB Smart Chain.

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.

  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.

  1. Create a new file named testing12.vy:

Choose the create new file icon

  1. Copy and paste the following code into testing12.vy:
# A simple Vyper contract
@external
def sayHello() -> String[13]:
    return "Hello, World!"
Enter fullscreen mode Exit fullscreen mode
  1. It's time now to compile our code.

Compiling our code

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

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

Block number
and paste it into the search bar and press enter. You'll get such a result;

Deployment Details

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.
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)