Skip to content
Garvit Pahal
Building durable systems and AI products

Solana Fellowship

May 2022

I had been learning Rust for two or three months when I came across Solana. I went deeper into web3: I bought some SOL, created a wallet, used Solana apps and read a lot.

Solana spoiled me. I expected every blockchain to be fast and to have wallets as good as Phantom. Ethereum, which I tried next, was much worse: $80 gas fees, slow transactions and an unintuitive MetaMask.

Getting into the fellowship

I wanted to work full-time in web3, and around then I saw the fellowship on SuperteamDAO's Twitter. Superteam helps promising Solana projects in India, South-East Asia, Eastern Europe and Africa launch and grow, and I had been following its podcasts.

The fellowship was an eight-week programme to learn Solana and build apps for it. Each week had a new theme, from NFTs to DeFi to gaming, with quests, exercises and Q&A sessions with experts, and fellows got a $2,500 stipend. I filled out a few application forms, gave an in-person interview and got in a week later.

Week 1: Getting started

In short: Rust and Solana fundamentals: the ecosystem, the language and the programming model.

Solana ecosystem and the fellowship

Chase, from developer relations at Solana, opened with the ecosystem's growth over the last year, especially in India, and where he sees it going. SOL dev_ collects everything you need to develop on Solana. Neil and Gnana Lakshmi then covered the fellowship's structure and goals.

Rust

I had picked Rust as the language to learn last year and used it in a small side project, which is how I found Solana. I spent the week refreshing it with Rustlings and Exercism, which both have short, progressively harder exercises you run locally. For video, try Rust Programming Tutorials and Introduction to Rust for Solana.

Solana

The week before, I had read Explaining Solana with The Simpsons by Jonathan Ferreira, the best introduction to Solana I have come across. Solana's own posts on why it's fast and secure had been too dense for me, and this one made them make sense.

This week covered the programming model, how to deploy to Solana and how to work with interfaces to Solana like the SPL Token CLI. It was fun to finally use what I had read about.

Week 2: Creating mini dApps

In short: My first dApps, with the @solana/web3.js library and an on-chain voting program.

Web2 vs web3 development

Preethi Kasireddy talked about how web3 differs from client-server programming. Web3 makes a global computer with persistent storage simple but iterative development much harder, so auditing and security reviews have to happen before deployment.

That matches my experience on Solana and Ethereum. The basics are the same (you still write Rust, Solidity or JS and keep a source of truth), but a lot changes once you build, deploy and combine components.

Solana web3.js library

Two quests, creating an airdrop program and creating a roulette game, used @solana/web3.js to interact with Solana and on-chain programs. They're easy if you know JavaScript. The library is simple and powerful, since you can move real money in a couple of lines, and better still with TypeScript's autocompletion.

On-chain voting program

The exercise was a voting program with delegation (the Solidity version). I skipped the Anchor framework: it makes programs simpler and safer, but I wanted to see what it abstracts away from the Solana program SDK.

It was harder than I expected. With no good starting point, I went through the Solana program library and found the name-service program the most helpful, since it was simple to follow. I made a template from it at templates/program. With no UI to test the program, I learned to write integration tests for Solana, and seeing them pass was satisfying.

Not using Anchor showed me how useful it is, so I used it from then on.

Week 3: More dApps

In short: Bigger programs, written with the Anchor framework.

Anchor framework

Anchor provides an eDSL for writing Solana programs, an IDL anyone can use to generate a client, and a CLI with workspace management. After last week's sparse documentation and boilerplate, it was a relief. The tutorials and The Anchor Book took me from a new project to a working program quickly, and Solana development felt as simple as Solidity. Its documentation was limited too, as you'd expect from a young project under active development.

On-chain programs

Three quests, building a crowdfunding platform, setting up campaign accounts and sending money and creating an on-chain calculator, were easy after last week. The calculator was a good introduction to Anchor.

The exercise was a bi-directional payment channel (the Solidity version), hard for a different reason. Ethereum's logic can't be copied over, because Solana handles where you store data, where you hold the treasury and how you manage it differently. Each time I thought the logic was done, another error taught me something new about the programming model. It took a day, and writing basic tests first kept the build and test cycle tight.

Anchor is excellent, but its documentation and examples are limited and its error messages sometimes unclear, so expect rabbit holes, test continuously and ask in the Anchor and Solana Discords.

Week 4: NFTs

In short: NFTs on Solana, ending with dynamic NFTs that change over time.

Creator ecosystem

Jenil from Coinvise talked about communities, NFTs, tokens, DAOs and how to evaluate ideas in web3, where early projects and communities start and run very differently from web2 companies. That stayed with me as the project deadline came closer.

NFTs

Two quests covered creating and burning NFTs using @solana/web3.js and creating your own NFT minting machine. I liked the second: I deployed a minting machine quickly, then read its code to see what was happening.

On Ethereum, where I had made NFTs before, you implement an interface (ERC-721 or ERC-1155) however you like. Metaplex, Solana's de facto NFT standard, is much more complex, partly because of Solana's programming model and partly for speed. Its tooling, documentation and UI code are excellent, though, and I leaned on them for the exercise.

Dynamic NFTs

The exercise was an NFT marketplace with dynamic NFTs. I built Pokémon NFTs that start as Charmander and evolve into Charmeleon and then Charizard. I started from Metaplex Storefront and added UI to create and evolve them, so the creator could click a button on the NFT's page to evolve it. The Metaplex APIs and Storefront's UI cache were the hardest part.

Metaplex NFT page showing a Charmander with evolution index 0 while the evolve button reads "Evolving Pokemon…"

The same NFT page after evolving, now showing a Charmeleon with evolution index 1

The creator still has to update the metadata by hand. Ideally an on-chain program would be the NFT's update authority and evolve it automatically, for example after enough time passes, but I ran out of time to build it.

Week 5: DeFi

In short: Tokens, staking and tokenomics, including my own wallet and cryptocurrency.

DAO treasuries and getting into web3

Shreyas, co-founder of Llama, talked about economic infrastructure for DAO treasuries, building a community and why a product's name matters. His path into web3 matched mine: he left his job for a new industry and used hackathons to force himself to build. He found his problem by helping people with their DAOs, saw how hard managing treasuries was, and built a product and a community around it.

Creating my own wallet and cryptocurrency

Three quests, creating a wallet, creating your own crypto using Solana programs and creating your own crypto using JavaScript, covered moving SOL and other SPL tokens. The first two used Solana's JSON RPC API. The last had us write a program that proxies calls to the SPL token program, and that ability to call other programs makes the ecosystem composable.

Staking and tokenomics

The exercise was to add staking to the cryptocurrency from one of the quests. I had to decide where to escrow the funds, how to create escrow accounts for each token and how to tie it together in the UI.

Staking app with buttons to airdrop SOL, mint a token and stake 10 tokens, and the resulting token, staked and escrow balances

It also got me thinking about tokenomics: why projects choose different distribution, inflation and reward mechanics, and how they implement them. Solana's economics documentation is well written and explains why people stake and why spreading stake across validators matters for the network.

Week 6: More complex dApps

In short: Harder dApps, and the problem my fellowship project would solve.

dApps, dApps everywhere

There were four guided quests:

The exercise was a shared wallet that a group of friends could spend any SPL token from. I used the proxying technique from week 5 to create a proxy SPL token. It only transfers SPL tokens for now, but it could support any transaction, like multi-sig wallets such as Goki.

Fellowship project

For my fellowship project, I chose streaming payments on Solana.

The problem

I came into the fellowship with this idea:

Having worked at private remote companies, I have seen people having issues with ESOPs (transparency and illiquidity), global payroll and expense management.

This is something I feel blockchain technology can solve, especially for newer-generation companies which are global, distributed and they want new structures for incentivisation and a seamless employee experience.

Meanwhile, startups in India and overseas were working on earned wage access: letting employees draw their wages as they earn them. Someone on 30k a month could withdraw ~15k on the 15th instead of waiting for the next month. Low-income employees need this when a sudden expense leaves them short at the end of the month, which otherwise drives them to predatory loans.

The solution

These problems reminded me of Superfluid, which I had used on Ethereum, and how easy solutions would be to build on something like it. The idea was a contract that lets a sender stream payments to a recipient, with:

Existing streaming payment projects on Solana lacked some of these features, and some were closed-source, so I couldn't tell whether they would add them.

Week 7: Starting on my project

In short: Designing and building the first version of the project, and naming it Superstream.

I designed the project, finalised its scope and implemented most of the smart contract.

Components

There would be four main components:

Any other project should be able to hook into them to add payment streaming. Insolvency is the most interesting part: how to detect it, decentralise detection and incentivise people to prevent it. I have some ideas but haven't settled on an approach.

Naming the project

Probably the hardest decision of the week. I settled on Superstream, after Superteam.

Future considerations

Transitive streams are one possibility. If Alice streams to Bob and Bob streams to Charles, the contract can let Bob take out only the net balance of both streams, so Charles's stream stays solvent as long as Alice keeps topping hers up. Ideas like this are complex and out of scope for now.

Tech stack

Superstream

The project took another month and is live at superstream.finance. Superstream became a company, which I founded and ran from September 2021 to March 2022. More on my work page.

Closing thoughts

The eight weeks were fun and productive: I learned a lot, built a lot and met a lot of people. I'd recommend the fellowship to anyone who wants to learn to build Solana apps. If you have questions about it, reach me by email or on X.