DEV Community

Cover image for What I Learned While Building My First Web3 Project
Konstantin Komelin
Konstantin Komelin

Posted on • Edited on • Originally published at komelin.com

What I Learned While Building My First Web3 Project

I started building MarrySign, a crypto-marriage app, during the Chainlink Hackathon Fall 2022 because I wanted to give any couple regardless of their gender, location or any other factors, a chance to register their union quickly and transparently from the comfort of their homes. Now after the hackathon, I continue working on the project in my spare time.

Since it's the first web3 project I'm building, I'd like to share my learnings.

Addy Osmani tweet about learning through writing

What is Blockchain

I wish I could explain it briefly ;) But let me try to use familiar examples for that...

Blockchain is a distributed database with an acknowledgement mechanism, like in MongoDB, and stored procedures, like in Postgres, directly connected to a payment gateway, like Stripe, but for Crypto.

For the Ethereum network, the “stored procedures” (functions) are grouped together into a “class” (contract). The contract code is written in the Solidity language which resembles a mixture of JS and Go.

Fix bugs in advance

If you once deployed your Solidity contract to the blockchain, you can't change its code. It means that if you find a bug in it, you can't deploy a hotfix. You will need to deploy an updated version to a new address leaving the old contract and user data intact. It adds some challenges, for example migration of user data from an old version of the contract to a new one. There are solutions for that but it's not one button click.

So the idea is to deploy good-quality code to production, well-tested and well-documented.

Taking that into account, I test my Solidity contract with the Hardhat framework, document it properly to generate human readable docs automatically with solidity-docgen. To format my Solidity code, I use solhint and solhint-plugin-prettier.

Gas fees

You pay fees (aka gas fees) for writing to the blockchain, but read data from the blockchain for free. However, it's not guaranteed that your read-only function will return results if it exceeds some network limits.

The Hardhat framework lets you estimate gas fees for running your functions. Not sure if it's 100% accurate but it helps identify heavy functions.

There are also solutions for gas-less payments. It's when the contract creator pays fees for their users through a special gas station, for example Ethereum Gas Station Network.

Staging networks

Since the price of a mistake is normally high on the blockchain, there are a few test networks which you can use to test your contract without paying gas fees on the Ethereum mainnet.

I use the Goerli Ethereum network. People don't like it for some issues but other options are not widely supported yet.

Web3 UX

The UX of some tools and services is not yet ideal, so more and more companies are focusing on web3 UI/UX. I think good UX is a competitive advantage today. I personally liked presentation by Rahat Chowdhury from the Polygon team with ideas on how to improve web3 UX.

Back yourself up with a withdraw() function

I heard stories about contract developers forgetting to implement a withdrawal function and having to lose their earned funds. So if you're going to collect fees from your users or receive any funds to your contract address, make sure you add a withdraw function right from the beginning.

Useful resources

Web3 and Hardhat starters:

Solidity libraries:

Video:

Communities, hackathons and accelerators

Looks like current crypto-winter doesn't slow down web3 progress because a lot is going on in the area actually.

  • There are growing Discord groups for almost every blockchain project.
  • There are many hackathons, dedicated to a blockchain protocol or network, that are happening now.
  • The Techstars accelerator partners up with big players in the area to help web3 and blockchain startups grow.

To sum up, developing for web3 has its challenges and opportunities, so when you get familiar with tools and services available and discover best practices, you can develop something really new, something disruptive.

I wish you best of luck with your current and future blockchain adventures! And if you like the idea of crypto-marriages, follow us on twitter or get crypto-married with us.


I originally wrote this post for my blog but after receiving good feedback decided to share with the dev.to community. Hope you guys like it.

Top comments (6)

Collapse
 
titanxtream profile image
Tamojit Bhowmik

Great Blockchain definition . Nice job!!

Collapse
 
kkomelin profile image
Konstantin Komelin

Thank you Tamojit!

Collapse
 
titanxtream profile image
Tamojit Bhowmik

Can you help me with one question ? That do all blockchains need minning and if not then how does they build proof of work or what alternate does they use to keep the safety with blockchain?

Thread Thread
 
kkomelin profile image
Konstantin Komelin

As far as I understand, Proof of Work (PoW), which is used by Bitcoin for example, implies "mining" - it's when you buy a special computer that mine new blocks to the network and you receive some compensation for your work/resources spent.

Most of the others use Proof of Stake (PoS), which Ethereum has recently switched too. It implies staking - it's when you "deposit" your crypto for the network to use it for validating transactions. Here you receive some compensation as well.

For such theoretical topics, I recommend you watching @WhiteboardCrypto channel on Youtube.

Thread Thread
 
titanxtream profile image
Tamojit Bhowmik

@WhiteboardCrypto channel on Youtube.

I actually follow this chanel and it is great helpfull .
Anyway thank you for your imformation. You were really helpfull!!

Thread Thread
 
kkomelin profile image
Konstantin Komelin

You're welcome buddy.