One of the questions I'm asked the most is "how do I get started becoming a solidity dev?". While there's no right answer, my response is always similar. So here it is in a thread:
How to take yourself from 0-1 as a solidity dev
1/🧵
2/ This thread will assume you have dev experience already - if you don't solidity might not be the best place to start.
Solidity doesn't necessarily have a steeper learning curve than other languages, but it has steeper penalties for getting it wrong.
3/ A good intro to the basics is available at . It's outdated - most of the program uses solc 0.5, and we're now at 0.8+ - a lot has changed, but it's quick, and enjoyable enough that it can ease the fear of "getting started", which is the hardest part.cryptozombies.io
4/ Study, study, study. The EVM is a dangerous place, full of simple mistakes with devastating consequences. Thankfully, most of those mistakes have already happened and are still publicly viewable.
Study the past to prevent making the same mistakes in the future.
Examples 👇
5/ Some large exploits that can help you get started:
- The DAO (and reentrancy in general)
- Popsicle Finance
- Nomad Bridge
- Wintermute
There are dozens of smaller exploits that happen pretty much weekly. If you see something, read about it.
6/ Don't just study the negative - study those that did things right, too. In fact, study everything.
If you deployed a smart contract in 2021, there's a good chance I read it.
7/ Now pick a protocol, and pick it apart.
- How do the pieces fit together?
- Why did they design it the way they did?
- What precautions are in place that you wouldn't have thought of?
- What puzzles you?
Something like Maker, Uniswap, or Seaport are good subjects.
8/ Write some code that follows basic guidelines, for example:
- Write a memecoin contract
- Write an ERC721/ERC1155 NFT contract
- Write an ERC4626 compliant vault
Play with them on testnets. Does everything work?
9/ Now write some wacky code that doesn't follow any guidelines at all, for example:
- An NFT that changes metadata when transferred
- A memecoin that transfers random amounts
- A vault that can only be used between sunset and sunrise
Play with them, do they behave as expected?
10/ Use to debug. Remix can be insanely helpful for gaining deeper understanding of what's going on between the text you write and what actually executes.
12/ And how could I write a thread about solidity education without @q00ts? My own NFT project, a curated community of knowledge hungry devs with opportunities to test dev skills in risk free environments.
13/ The number one thing you need to have to see success as a solidity dev is passion. If you don't pay close attention to the space, you'll be punished accordingly. Good luck!
Exited all my validators, and I think it's worth discussing: Ethereum has an incentive problem.
1/🧵
2/ Proof of stake is a simple concept on the surface: those with money at stake are rewarded in exchange for honest validation of new blocks.
If you're dishonest, your stake is vulnerable to slashing (aka, there is a high cost to dishonesty).
3/ Similar to difficulty adjustments with bitcoin, incentive to validate should naturally reach equilibrium as stakers reach consensus on what APY justifies the opportunity cost of locking up ETH.
Flash loans are zero risk loans where the full loan amount must be paid back in the same transaction is was originated. They are useful for arbs or opportunities for profit where you simply don't have the ETH up front.
But this one actually sacrificed a punk...
1/🧵
2/ Today's loan was not a profit opportunity - at least, not directly (we'll get to that later).
To execute, two contracts were used (we'll call them Contract A and Contract B).
Contract A is in charge of listing the punk, and Contract B handles buying it.
3/ The progression:
Contract A holds Punk #1563, Contract B holds nothing.
Contract A lists for 24,000 ETH.
Contract B borrows 24,000 ETH from Balancer.
Contract B buys #1563. Contract B now has #1563, contract A has 24,000 ETH.
Punk 2386, with a current high bid of 600 eth, sold for 10 ETH today.
A combination of clever sleuthing, followed by an unfortunate miscalculation leads to a 7 figure payday for 0x282.
🧵
2/ This ape punk was fractionalized into 10,000 ERC20 tokens on 9/26/2020, and spread out among what is now 257 holders.
This was done on a now decommissioned platform called niftex (the contracts continue to live forever).
3/ The setup is such that any shareholder can propose a "shotgun", whereby any shareholder can propose a buyout price, and if nobody counters, they can purchase the asset after 14 days.
ERC404 has taken X by storm. Many have called it out for misusing the ERC label, and rightfully so, but let's take a moment to discuss another aspect of it: composability.
Is it safe?
1/🧵
2/ If you haven't read a technical breakdown of ERC404, check out my thread here:
I'll be referring back to the topics covered there throughout this thread.
3/ Imagine a basic shared vault application: users can deposit and withdraw NFTs or tokens. This can be a lending protocol, a custodial marketplace, or anything else (and in fact, this design exists in many places already).
This one is basic, you can only deposit and withdraw:
When designing CryptoPunks721, we went through great lengths to ensure that the contract was:
a) ownerless
b) as gas efficient as possible
This led to the creation of a weird function!
The story behind `rescuePunk()`
1/🧵
2/ NFT contracts typically maintain a count of their total supply. Maintaining that count is pretty simple: increment the count when a mint occurs, and decrement when a burn occurs.
Simple, but it adds an additional SSTORE to each mint and burn - that's 5000 gas!
3/ And wrapper contracts are unique - the total number of wrapped tokens can be inferred by the current number of the underlying NFT being held by the contract.
So we can bypass that gas cost by just returning the number of CryptoPunks held:
I'm super proud of the launch of CryptoPunks721 and Your Stash, and I'm hopeful for everything that it means both in the immediate term and in the future.
You may have heard we had to roll it back to fix some issues, and just re-launched today - here's what happened 1/🧵
2/ Two essential convictions underpin Your Stash:
- It introduces SO much potential, most of which we haven't yet dreamed up. So, it's upgradeable.
- Upgradeability introduces centralization risk not present in immutable contracts, so only YOU hold the power to upgrade.
👇
3/ This is done by modifying Solady's ERC1967 Factory in a way that limits any given address to deploying just one contract, of which they become the de facto admin.
Yuga can launch new versions of stash contracts, but Your Stash remains unaffected until you choose to upgrade.