Are you a frontend developer curious about smart contract development? Or maybe you're just curious about the differences between the two? In this post, I'll share my journey of switching from frontend to smart contract development, and the reasons why I made the switch.
In June 2021, I started my journey into software development by signing up for CryptoZombies.io and purchasing a blockchain development course from Udemy.com. After completing the CryptoZombies course, I began the Udemy course, which included learning about Hardhat.
However, at that point, I felt lost, as JavaScript was confusing to me, and asynchronous functions made no sense. Without any mentors or people to guide me, I thought that knowing JavaScript was a pre-requisite to learning Solidity.
So I decided to focus on learning JavaScript for the next 22 months. Although learning frontend development was a fun journey, I never lost my interest in smart contract development.
So, I made the decision to pivot back to learning Solidity. In this blog post, I'll share the similarities and differences between frontend development and smart contract development, and why I think it's worth making the switch.
Frontend development focuses on creating user interfaces and client-side logic, while Solidity development focuses on creating smart contracts for the blockchain.
The screenshot above is a frontend interface that uses Ethers.js to call the deposit
function on the "WETH9" smart contract. Below is code from the actual smart contract:
function deposit() public payable {
balanceOf[msg.sender] += msg.value;
Deposit(msg.sender, msg.value);
}
Frontend development is typically done in TypeScript and React, while Solidity development is done in Solidity (or other languages like Rust or Vyper).
Frontend development requires a focus on user experience and design, while Solidity development requires a focus on security and reliability.
JavaScript supports dynamic typing, while Solidity has static typing.
The syntax of JavaScript is similar to C-like languages, while Solidity's syntax is inspired by JavaScript but includes additional features unique to smart contract development, such as gas consumption and function modifiers.
JavaScript is executed by web browsers or server-side engines like Node.js, while Solidity code is executed by the Ethereum Virtual Machine (EVM).
function add(a, b) {
return a + b;
}
Above is a JavaScript function adding 2 numbers
function add(uint256 a, uint256 b) public pure returns (uint256) {
return a + b;
}
Above is a Solidity function adding 2 numbers
Both languages use curly braces and semi-colons to start and end code blocks, respectively.
Functions are used to organize and structure code.
Both support the use of if/else statements and loops for control flow.
Comments can be used in both languages to document code.
Understanding JavaScript fundamentals can make learning Solidity easier, as all programming languages boil down to computer science fundamentals. Additionally, frameworks like Hardhat and libraries like Ethers.js use JavaScript, so understanding JavaScript can be beneficial.
While there will always be a need for frontend development, I believe that many frontend developers will become obsolete with the development of AI and no-code tools.
On the other hand, I think there's more room for bleeding-edge innovation on the protocol layer of smart contracts. By staying up to date with the latest tech, I believe that humans can continue to be valuable in this space.
In conclusion, switching from frontend to smart contract development has been an exciting journey for me. Although there are differences between the two, understanding the fundamentals of programming can make the transition smoother. And with the potential for innovation in the smart contract space, it's a field worth exploring.