Learn Solidity: Easy to Learn, Hard to Master? (2024)

Is solidity hard to learn?

Learning solidity as a language is arguably one of the easier languages to learn. However, learning the Ethereum environment is hard.

It looks very similar to javascript, or pretty much any curly bracket language derived from c.

If statements, for loops, class inheritance, variable types, are all very familiar.

Solidity does have some oddities unique to moving cryptocurrency around. For example, each function call has an environment variable that indicates how much ether was sent with the function call and it has some specific APIs for interacting with other smart contracts. Solidity also has strange instructions like delegatecall and selfdestruct which are not found other languages, but those are easy to grasp after mulling over the documentation for a bit.

However, Solidity and ethereum development can be full of surprises. Here are just three examples.

Seemingly minor changes can result in very large differences in gas cost

Learn Solidity: Easy to Learn, Hard to Master? (1)

What this contract does is very simple. It transfers tokens away from another contract to itself, then it transfers it to the caller in the same transaction.

However, openFaucetInefficient and openFaucetMoreEfficient can have wildly different gas costs. Why? Under the hood, ERC20 tokens store the user’s balance as a storage variable. When a storage variable goes from zero to non-zero, this causes the variable to be created on the blockchain. And the creation step has a high cost associated with it. When a variable is set to zero, it is implicitly erased. So the first function is repeatedly creating and erasing a storage variable.

The second function is much more efficient. It creates the storage variable for its own balance, then ensures it doesn’t get destroyed until the end when it transfers away the final token. This prevents unnecessary creation of storage variables.

The third function, which has a bizarre for-loop construction is even more efficient. Because of quirks in the solidity compiler, re-arranging a for loop in this manner is more efficient, even when you tell the compiler to run automatic efficiency improvements on your code.

How would you know this? Well, there is no straightforward way to know. That's why solidity is not easy to master.

I/O operations can be undone

Learn Solidity: Easy to Learn, Hard to Master? (2)

Both x and y are storage variables, and you can think of them as being stored on persistent disk. They keep their values between transactions.

When quizzed, many developers assume that x will be set to the newValue and y will be set to 2 times x if x is less than or equal to 10. For example, if newValue is 5, x will be 5 and y will be 10. If newValue is 20, x will be 20 and newValue will not be changed.

But this isn’t what happens. If a revert happens anywhere in the transaction, the write to X gets undone.

This is very counter-intuitive for developers, because most I/O operations don’t revert. However, all transactions on Ethereum are atomic. So x can never be greater than 10, and x and y must change in tandem.

Innocuous functions can lead to re-entrancy attacks

Learn Solidity: Easy to Learn, Hard to Master? (3)

The code above appears to send people an ERC20 token and an ERC1155 token when they call mintTokens. Ostensibly, each address can only mint one time because of the alreadyClaimed check.

However, it is possible to drain the contract of all the tokens in a single transaction. The _mint function in ERC1155 doesn’t just mint a token, it also hands control over to the sender of the transaction — before it has updated that the sender has claimed their tokens. This allows the sender to claim all the tokens for themselves by recursively calling mintTokens when _mint hands control back to them.

There is no rhyme or reason to which functions hand control over to other contracts. One simply has to memorize them.

Conclusion

As you can see above, a seemingly simple language can be full of surprises. We’ve only scratched the surface here. Did you know it’s possible for “immutable” smart contracts to change their bytecode? How about bad code designs that allow buyers to double-spend their ether without a re-entrancy attack? Can you generate random numbers securely despite the blockchain being fully deterministic and transparent?

Blockchain is full of unknown unknowns despite using a programming language that is “easy” to learn. This is why hacks are so common.

Solidity can be grasped in a weekend. Here is our free tutorial to learn solidity quickly if you already know another programming language.

But mastering the ecosystem does not happen in a matter of days.

Do you want to master the ecosystem? Apply now to our fully remote solidity bootcamp.

Learn Solidity: Easy to Learn, Hard to Master? (2024)

FAQs

Learn Solidity: Easy to Learn, Hard to Master? ›

Some argue that Solidity is relatively easy to learn, while others contend that it is difficult to master. According to BestColleges, Solidity is “user-friendly for those with prior programming experience,” but it can take longer to learn for those without programming experience.

How difficult is it to learn Solidity? ›

Solidity isn't a walk in the park by any means. In fact, it's probably one of the most challenging programming languages to implement and master out there. Yes, learning it is easy and many programmers can learn it in days, if not weeks.

How many hours to master Solidity? ›

Solidity is user-friendly for anyone with basic familiarity with other coding languages like Python, C++, and Java. Professionals with experience in programming concepts and coding languages can usually learn Solidity in 1-6 months. If you have no programming experience, it may take longer.

Is Solidity harder than Python? ›

Is Solidity harder than Python? Solidity may be considered harder than Python for beginners due to its unique features and the need to understand blockchain technology. However, experienced programmers might find it easier to pick up.

Is Solidity worth learning in 2024? ›

The Blockchain landscape is evolving rapidly, and Ethereum remains at its forefront with its robust ecosystem for decentralized applications (DApps). Solidity, the programming language used for creating smart contracts on Ethereum, is crucial for anyone looking to dive into the world of Blockchain development.

Is Solidity harder than Java? ›

Java isn't as hard to learn as Solidity, but it is an object-orientated programming language so is not as simple as Python, for example. Personally, I am not a big fan of Java, I find it slow and not as intuitive, but a lot of people like it.

What is the average salary for Solidity? ›

The estimated salary for a Solidity Developer is ₹5,00,000 per year. This number represents the median, which is the midpoint of the ranges from our proprietary Total Pay Estimate model and based on salaries collected from our users.

Is Solidity still in demand? ›

The demand for specialists versed in Solidity is steadily growing as blockchain technology is becoming in demand in more and more different areas of life. The career of a Solidity developer requires dedication and many skills, but it offers numerous benefits as well.

Can I get a job if I learn Solidity? ›

The technology is constantly being updated and skilled practitioners can become beginners overnight. Use this as motivation if you're new to the solidity development scene. Even if you don't have that much experience you can still land a huge role at a company if you have the skills.

Is it still worth it to learn Solidity? ›

YES. The main programming language for building smart contracts on the Ethereum blockchain is Solidity. Crypto, NFT, and Defi enthusiasts should learn this programming language. One of the key elements of the Solidity Ethereum connection is the contract-oriented nature of the this programming language.

Is Solidity beginner friendly? ›

Is Solidity good for Beginners? Learning Solidity can indeed be a good starting point for beginners interested in blockchain and Ethereum development, especially if they have prior experience with JavaScript, as the syntax is quite similar.

Does Solidity require math? ›

However, before you dive headfirst into the world of Solidity, it's crucial to have a solid understanding of the mathematics that underpin this powerful programming language.

Is Solidity easier than JavaScript? ›

For instance, both JS and Solidity are object-oriented and event-driven. So, you'll already be familiar with concepts like classes, inheritance, and events. However, Solidity is a bit stricter in its syntax, and you'll need to learn about blockchain-specific concepts, such as transactions, gas, and contracts.

How much do Solidity engineers make? ›

$105,000 is the 25th percentile. Salaries below this are outliers. $135,500 is the 75th percentile.

Is there a shortage of Solidity developers? ›

Supply and Demand Dynamics: There is currently a shortage of skilled Solidity developers in the market. This imbalance between supply and demand has led to higher salaries and greater job opportunities for Solidity developers.

How long did it take you to learn Solidity? ›

Learning Solidity from scratch can take anywhere from a few weeks to several months, depending on your learning pace and background. Since you're already studying JavaScript (JS), you will have some advantages as there are similarities between the two languages.

Top Articles
Closing Costs: What They Are and How Much They Cost
Kids Online Safety Act | U.S. Senator Richard Blumenthal of Connecticut
Chs.mywork
Tlc Africa Deaths 2021
Phcs Medishare Provider Portal
Mate Me If You May Sapir Englard Pdf
Blanchard St Denis Funeral Home Obituaries
Southside Grill Schuylkill Haven Pa
Top 10: Die besten italienischen Restaurants in Wien - Falstaff
Parks in Wien gesperrt
LA Times Studios Partners With ABC News on Randall Emmett Doc Amid #Scandoval Controversy
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Jack Daniels Pop Tarts
Directions To O'reilly's Near Me
Dit is hoe de 130 nieuwe dubbele -deckers -treinen voor het land eruit zien
Conscious Cloud Dispensary Photos
Youravon Comcom
Bitlife Tyrone's
Napa Autocare Locator
Roof Top Snipers Unblocked
The EyeDoctors Optometrists, 1835 NW Topeka Blvd, Topeka, KS 66608, US - MapQuest
Sec Baseball Tournament Score
A Man Called Otto Showtimes Near Cinemark University Mall
Mini Handy 2024: Die besten Mini Smartphones | Purdroid.de
Pain Out Maxx Kratom
Ice Dodo Unblocked 76
WOODSTOCK CELEBRATES 50 YEARS WITH COMPREHENSIVE 38-CD DELUXE BOXED SET | Rhino
Mobile Maher Terminal
Mbi Auto Discount Code
Craigslist Dallastx
Human Unitec International Inc (HMNU) Stock Price History Chart & Technical Analysis Graph - TipRanks.com
Luciipurrrr_
Kelsey Mcewen Photos
Today's Final Jeopardy Clue
Chuze Fitness La Verne Reviews
Compare Plans and Pricing - MEGA
Jason Brewer Leaving Fox 25
Taylor University Baseball Roster
Lacy Soto Mechanic
Directions To Cvs Pharmacy
Kent And Pelczar Obituaries
Air Sculpt Houston
The Many Faces of the Craigslist Killer
Minterns German Shepherds
Verizon Forum Gac Family
Hughie Francis Foley – Marinermath
Muni Metro Schedule
Fredatmcd.read.inkling.com
Minecraft Enchantment Calculator - calculattor.com
The Ultimate Guide To 5 Movierulz. Com: Exploring The World Of Online Movies
Unity Webgl Extreme Race
Latest Posts
Article information

Author: Maia Crooks Jr

Last Updated:

Views: 6716

Rating: 4.2 / 5 (43 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Maia Crooks Jr

Birthday: 1997-09-21

Address: 93119 Joseph Street, Peggyfurt, NC 11582

Phone: +2983088926881

Job: Principal Design Liaison

Hobby: Web surfing, Skiing, role-playing games, Sketching, Polo, Sewing, Genealogy

Introduction: My name is Maia Crooks Jr, I am a homely, joyous, shiny, successful, hilarious, thoughtful, joyous person who loves writing and wants to share my knowledge and understanding with you.