How to Use Smart Contracts on Frontend App

Shmoji
Coinmonks
5 min readJun 21, 2022

--

Hey what’s up, in this tutorial I will show you how to use smart contracts in your frontend app.

Before starting, you need to understand how to connect a user‘s wallet to your application and how to enforce one blockchain network on your frontend. I’ll talk about that more later when it’s needed.

There’s a lot of concepts here, so if you can’t figure out how to implement this into your specific project, your best bet is to clone the repo I provide and get a minimal version working.

Resources for this tutorial:

To start off, you need a contractStore file. This will be where you initialize all your contracts into your frontend through global state and a few methods. I will paste that file here and explain it after the code:

Global state is used so that any file in your application can use your contracts. With that in mind, the library I use for global state…

--

--