Cover photo

EIF Diary — Week 1+2

There could have been no possible way that I knew that I’d be writing on a February Sunday morning about something I didn’t even know of till last month but still made my way in. Eth India Fellow 3.0. pretty wild already, isn’t it?

For anyone who still doesn’t have any context or has some curiosity over what actually I’m talking about or what goes on inside the fellowship — well, it’s a big playground for 25 people who’ve gathered together for 8 weeks to solve multiple technical challenges each week and also craft something from their own mind, but why? simply because it’s fun and all of these people love what they do and are madly curious.

A timeline of my last two weeks in this big playground :)

(oh before I get started, flexy flex time, here’s our SBT, thanks devfolio <3)

https://opensea.io/assets/0xfE8321Df99317C365797c4f95C2dbd9BeEC8C694/0

Week 1 started off with a Simple NFT challenge, which was nothing much but just an introduction to the workflow — scaffold.eth and ERC-721. The challenge was to build a contract that lets users mint NFTs + also get familiar with hardhat.

The second challenge was a Decentralized Staking App where people can coordinate a group funding effort. If the users cooperate, the money is collected in a second smart contract. If they defect, the worst that can happen is everyone gets their money back. The users only have to trust the code.

  • This one did get a bit tricky for me personally but started making more sense as I played hit-and-trial on these contract approaches.

here’s the final contract that worked out for me :D

https://gist.github.com/0xahzam/aa78891a026890e729d84ebcff07a6e4

Apart from these challenges I also did some messing around uniswap, went over their v1, and v2 whitepapers, and got so curious somehow that I started writing my own clone (I named it xeroswap god knows why)

https://uniswap.org/whitepaper.pdf

https://uniswapv3book.com/

https://github.com/0xahzam/xeroswap

Moving to week 2, it started off with Token Vendor challenge, which was basically to build vending machines, a place to buy and sell an ERC20 token. I didn’t find this one, in particular, to be tricky or hard for me simply because I’ve actually tried writing similar contracts when I was first learning solidity, so this went well :D

here’s the contract for this one :D

https://goerli.etherscan.io/address/0x3ce09d4daecd8550a7280b84b747a3550e283526

https://github.com/0xahzam/speedrunethereum-contracts/tree/main/token%20vendor

(p.s it feels pretty good to see all tests being passed hehe)

Lastly, the week ended with Dice Game challenge, I personally ended up getting quite fascinated by this one. This challenge involved attacking an existing contract over some logic vulnerability and making a profit off that exploitation.

  • Expanding on that, the dice game contract allows users to roll the dice to try and win the prize. If players roll either a 0, 1, or 2 they will win the current prize amount. The initial prize is 10% of the contract's balance, which starts out at .05 Eth. Every time a player rolls the dice, they are required to send .002 Eth. 40 percent of this value is added to the current prize amount while the other 60 percent stays in the contract to fund future prizes. Once a prize is won, the new prize amount is set to 10% of the total balance of the DiceGame contract.

  • The job was to attack this existing contract, predict the randomness and only roll when guaranteed to be a winner.

  • I know this one’s quite simple, but it fascinated me over smart contract exploitation and security.

here’s the contract for this one as well :D

https://github.com/0xahzam/speedrunethereum-contracts/tree/main/dice%20game

Reflecting back on these last two weeks really makes me feel overwhelmed, how something which I couldn’t have foreseen is happening, and at the same time, it is satisfying a lot of my intellectual cravings. Quite grateful to be a part of this.

Been two great weeks, see y’all next week :) (p.s really hyped for next week because it’s defi week)