When I started my web3 journey I got a freelance contract: Add web3 features to an existing app and reward the users with our token.
The point of rewarding the community was:
Our users should get 5 tokens when completing their profile (bio, curriculum, social media links, etc.).
But we could imagine rewarding users for many other kinds of actions, such as: commenting on a post or sharing a post on social media.
The first major task was to create a token.
After some research and discussions with other DEV, I decided to use an ERC-20 token.
I made one million token supplies and decided to lock half of it using a time lock contract.
Locking tokens is for purpose to give trust to your tokens to your users.
Then, I had to connect my front-end to Metamask API (or to wallet connect)
The goal is to get the wallet public ID of my users.
With this wallet public ID I will be able to transfer to theses users my reward’s tokens.
I also needed to add our token to their Metamask wallet. Which was something I could handle with the Metamask API.
I then simply saved the wallet public ID on the user table. I will use this public ID later.
When a user completes his profile on the app we need to send him 5 tokens.
Firstly I made a « reward » table on the back-end. I want to know whether that specific type of reward was already given to this user.
Then on my back-end, I needed to make an endpoint that would trigger a function to make a token transaction.
To make a transaction I used etherJs on my NodeJs app. When the conditions are met, I make a new transaction from my wallet ID to the user walletID.
I also pay the gas fee using my wallet automatically. My server can access my wallet using my wallet’s private key.
When a transaction is successful, the user will get a notification and the token will appear in his wallet.
Using Ethereum network is expensive when it comes to pay gas fee. That’s one of the reasons we decided to go for Polygon Matic.
Polygon is also a part of the blockchain network. However, the cost to operate is well cheaper than on Ethereum.
On localhost I was using a Testnet network. A fake network, that I set up with HardhatJs.
I now needed to push my ERC-20 token to Polygon network.
I used again HardhatJs in order to deal with this.
When it comes to Web3 and Blockchain, I had to make sure that my setup was safe 😀
By safe I mean:
This is what I did for this app:
This is how that process looks:
I’m planning in the future, to release Saas App using Web3 and to accept more freelance contract using that technology.
👉 You can follow me there on Twitter, as I continue to document my journey.
just wow imo, ur own work is a clear guide to merge between and go from web2 to the web3, great experience add to mine
Hey Romain,
Thanks for sharing interesting. From your experience how easy is it to go from a Web 2.0 project to a Web 3 project ?
I have an actual mvp around communities built on 2.0 and I was wondering to transform it in 3.0 what would be the actual work needed ?
Is it just an add-on you add (by giving tokens) or do you need to rebuild and refactor the whole code ?
Hey
Really depends what are your needs and what is your current codebase using ;)
For the project I mentioned in this article, there was already a huge codebase with a front-end (VueJs) and a back-end using NodeJs
I didn't have to refactor all the code,
I just had to add some new end-points to the back-end. And some additional logic to handle the smart contracts
I also needed to add the wallet feature on the front-end
You can contact me on tweeter @devvnomad, I might be able to give you a better idea of what needs to be done once I see your current project, 😀
Sure romain ! Thanks for the tip - Will ping you when I tackle this topic :)
Very helpful article for how to implement Web3 features. Thanks for that!
How this is actually from a legal persepctive? I'm currently also investigating a little in the virtual currency space and theoretically users can trade their coins, right? Is this simply possible without registering as - don't know - a money-business?
(Sorry for the noob question, I'm very new to the space...)
Without registering?
The thing is, you need their wallet public ID in order to send them tokens.
There are 2 solutions to achieve that today:
Once you have that wallet public ID, you will be able to:
In most country, except China, I don't think there is any issue trading coins today,
I think this is a really good idea. A few weeks ago I met a start up founder who rewards users with their tokens for certain actions. This is really cool for users who want to get crypto, but don't want to go through all the pain of signing up to an exchange.
yes that process getting more and more popular
this is awesome! I am building an app that rewards tokens for usage. Looking for an advisor. Care to connect? https://twitter.com/thenishantmodi
thanks, Sure, adding you
Great article. I will like to connect on Twitter because am trying to explore web3 during a particular weekend and build something on that weekend. You'll be of great help
hey you can find me on Twitter at @devvnomad
Your DM is closed
Nice article thanks for make it
thanks!
Awesome post Romain! Thank you! We’re looking to integrate web3 at Chessroulette, and you post helps a lot!
sounds interesting, what type of Web3 feature do you plan to integrate into chessroulette?
Looking at gamification through tokens, NFTs as passes to events/community, a web3 version of chess to name a few :).
I'm even thinking of an NFT kickstarter campaign to raise money. Would like to talk to someone with experience to come up with a roadmap.
Does this sound like smtg of interest to you?
surely could, let's connect on Twitter @devvnomad
This is super helpful, thanks!
good to know! thanks;