Solana Playground

Solana Playground is browser based application that will let you write, build, and deploy on chain Solana programs, all from your browser. This is very useful if we don't want to deal with a million dependancies and quickly want to bootsrap our Seahorse programs. It even has an inbuilt burner wallet so you won't have to worry about connecting external wallets or approving transactions.

For our first Seahorse program, we'll use Solana Playground to quickly get up and running without worrying about installing CLI tools or dependancies. Let's get started!

Getting Started with SolPG

SolPg

  • This will create a Seahorse project for you and you won't have to worry about any dependancies. SolPg creates the Seahorse project with the following structure:
Poll
|\_ src
    |\_ fizzbuzz.py
|\_ client
    |\_ client.ts
|\_ tests
    |\_ seahorse.test.py

SolPg2

  • src/fizzbuzz.py currently contains a boilerplate starter program written in Seahorse Lang. We can already see the structure that a Seahorse program follows, but we'll come to that later.

  • client/client.ts can host Javascript code that can be used to simulate actual frontend user experience of your app. In this file, we can add code to simulate the interaction of our frontend with our program.

  • tests/seahorse.test.ts will contain our Anchor Unit Tests written in Javascript. This goes a level deeper than client.ts and is essential to check if our Program is functional and working as expected or not.

  • There are three more tabs: Build & Deploy, Test and Tutorials. We'll come back to them while testing and deploying our program

  • For now, rename fizzbuzz.py to poll.py

  • In the terminal at the bottom of the screen, airdrop 4-5 SOL to the burner wallet on devnet:

solana airdrop 2

SolPg4

Don't airdrop more than 2 SOL at once due to RPC limits on devnet airdrops

  • We will airdrop more SOL to our wallet when we are deploying our program. But for now, the balance will be visible at the bottom of the screen. SolPg5

We are now ready to edit poll.py and write our first Seahorse program!