Skip to content

Commit

Permalink
Migrate remaining Unboxed repo modules into courses (solana-foundatio…
Browse files Browse the repository at this point in the history
…n#250)

* Migrate Unboxed repo modules into courses

- Moved course-structure from Unboxed-Software/solana-course#384 to this repo using metadata.yml files
  - The "extending-solana-functionality" section was split into "connecting to offchain data" course and a separate "solana pay" single-lesson course.
  - 'versioned-transaction' was renamed to 'lookup-tables'
  - 'env-variables' was renamed to 'program configuration'
  - Tweak the Anchor CPI text to avoid assuming people have read the native CPI lesson.
  - Re-add burning and delegation exercises in a new lesson and lab
- Fix internal relative links to the other lessons
- Added images and fixed image links
- Changed any link text that includes '//' to work around an apparent bug in https://github.com/remarkjs/remark-gfm
- Add descriptions for all lessons
- Use <Callout> for tips
- Remove a few remaining instances of old airtable form
- Remove some Phantom favoritism (replace with Ecosystem wallets page)
- Add prerequisites lessons where necessary

* Workaround a Callout bug. TODO: investigate and fix.

* Fix bad description

* Add image for unboxed

* Minor fixes

* Add course priority, so popular courses are shown first

* More native-specific frontend parts into Native Development course

* grammarly

* Update ContentLayer to fix errors

See contentlayerdev/contentlayer#495

* Lint

* Get callouts working

* Remove weird comment inside copy

* Move this back to unboxed now we have 'with updates from...'

* Avoid specific oracle recommendation and use ecosystem page for oracles

* Fix: ensure course descriptions for within UI area

* Tighten more descriptions to fit in UI size limit.

* Fix a markdown table that was choking the parser

* fix: use contentlayer2

* fix: broken pages

* Change relative links to absolute links

* Fix typo

* Update content/courses/connecting-to-offchain-data/verifiable-randomness-functions.md

Co-authored-by: Nick Frostbutter <[email protected]>

* Update content/courses/connecting-to-offchain-data/verifiable-randomness-functions.md

Co-authored-by: Nick Frostbutter <[email protected]>

* Update content/courses/connecting-to-offchain-data/verifiable-randomness-functions.md

Co-authored-by: Nick Frostbutter <[email protected]>

* Update content/courses/connecting-to-offchain-data/verifiable-randomness-functions.md

Co-authored-by: Nick Frostbutter <[email protected]>

* Update content/courses/mint-extensions/metadata.yml

Co-authored-by: Nick Frostbutter <[email protected]>

* Rename mint-extensions -> token-extensions-for-mints

* Rename native-development -> native-onchain-development

* Mention Anchor in metadata for onchain-development

* Fix missing headings on program-security, add link to repo, use 'course' instead of module

* Wrap 'completed the lab' in a callout

---------

Co-authored-by: nickfrosty <[email protected]>
  • Loading branch information
mikemaccana and nickfrosty authored Jul 17, 2024
1 parent 97e334f commit 783e6ba
Show file tree
Hide file tree
Showing 99 changed files with 40,475 additions and 1,222 deletions.
14 changes: 14 additions & 0 deletions content/authors/mikemaccana.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# (optional) organization association
organization: solana-foundation
# display name or actual name
title: Mike MacCana
# avatar image for this user (inside the `/public/assets/authors` folder)
image: mikemaccana.jpg
# github username
github: mikemaccana
# twitter / x username
twitter: mikemaccana
# website
website: https://mikemaccana.com
# brief description of this author (normally < 50 characters)
description: Developer Education at the Solana Foundation
4 changes: 3 additions & 1 deletion content/authors/unboxed.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# display name
title: Unboxed Software
title: Unboxed Software with updates from the Solana Foundation
# github username / organization
github: Unboxed-Software
# twitter / x username
twitter: unboxedsoftware
# website
website: https://www.beunboxed.com/
# avatar image for this user (inside the `/public/assets/authors` folder)
image: unboxed.png
7 changes: 7 additions & 0 deletions content/courses/connecting-to-offchain-data/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
author: unboxed
title: Connecting to offchain data
description: Connect to offchain data from inside your Anchor programs.
lessons:
- oracles
- verifiable-randomness-functions
priority: 20
1,402 changes: 1,402 additions & 0 deletions content/courses/connecting-to-offchain-data/oracles.md

Large diffs are not rendered by default.

1,642 changes: 1,642 additions & 0 deletions content/courses/connecting-to-offchain-data/verifiable-randomness-functions.md

Large diffs are not rendered by default.

127 changes: 127 additions & 0 deletions content/courses/intro-to-solana/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
title: Course Guide
objectives:
- understand what web3 is
- understand what Solana is
- learn how this course is structured
- know how to get the most from this course
description: "Understand what web3, blockchains, and Solana are."
---

## Welcome!

Welcome to the best starting point for developers looking to learn web3 and
blockchain!

## What is web 3?

Typically, in older systems, people interact with each other through third-party
platforms:

- User accounts are stored on large platforms like Google, X (formerly known as
Twitter), and Meta (Facebook, Instagram). These accounts can be removed at
will by the companies, and items 'owned' by these accounts may be lost
forever.

- Accounts that store and transfer value - like payment cards, bank accounts,
and stock trading accounts - are handled by large platforms like credit card
companies, money transfer organizations, and stock exchanges. In many cases,
these companies take a piece (around 1% - 3%) of every transaction that occurs
on their platforms. They may often slow transaction settlement down, to
benefit the organization. In some cases the item being transferred may not
belong to the recipient at all but is rather held on the recipient's behalf.

Web3 is an evolution of the internet that allows people to **transact directly
with each other**:

- Users own their accounts, represented by their wallet.

- Transfers of value can occur directly between users.

- Tokens - representing currencies, digital art, event tickets, real estate, or
whatever else - are fully under the custody of the user.

Common uses of web3 include:

- Selling goods and services online with near-zero fees and instant settlement.

- Selling digital or physical items, ensuring that each item is genuine and that
copies are distinguishable from original items.

- Instant global payments, without the time and expense of traditional money
transfer companies.

## What is Solana?

Solana allows people to **transact directly with each other instantly at almost
no cost**.

Compared to older platforms like Bitcoin and Ethereum, Solana is:

- Significantly faster - most transactions complete in a second or two.

- Massively cheaper - transaction fees (referred to as 'gas fees' in older
networks) are typically $0.00025 (much less than one penny) regardless of the
value of what's being transferred.

- Highly decentralized, having one of the highest Nakamoto coefficients
(decentralization score) of any proof-of-stake network.

Many of the common use cases on Solana are only possible on Solana, due to the
high costs and slow translation times of older blockchains.

## What do I need before I start?

You **don't** need previous blockchain experience, or Rust knowledge, to follow
this course! You do need:

- A Linux, Mac or Windows computer.
- Windows machines should have [Windows Terminal](https://aka.ms/terminal) and
[WSL](https://learn.microsoft.com/en-us/windows/wsl/) installed.
- Have [node.js](https://nodejs.org/en/download) 20 installed. Windows
machines should install node.js inside WSL2.
- Basic TypeScript programming experience.
- Basic use of the command line
- Basic use of git (either via the command line or your favorite GUI)

## How do I use the course effectively?

This course is broken down into individual lessons. Each lesson has three
sections:

- **Overview** - the overview contains explanatory text, examples, and code
snippets. You are _not_ expected to code along with any of the examples shown
here. The goal is to simply read through and get initial exposure to the
lesson topics.

- **Lab** - a practical project you _absolutely should_ code along with. This is
your second exposure to the content as well as your first opportunity to dive
in and _do the thing_.

- **Challenge** - another project, with just a few simple prompts that you
should take and implement independently.

The lessons here are very effective, but everyone comes from different
backgrounds and aptitudes that can't be taken into account by static content.
With that in mind, here are three recommendations for how to get the most out of
the course:

1. **Be brutally honest with yourself** - this may sound a little vague, but
being honest with yourself about how well you understand a certain topic is
essential to mastering it. It's really easy to read a thing and think "yeah,
yeah I get it," only to realize later that you actually didn't. Be honest
with yourself while going through each lesson. Please don't hesitate to
repeat sections if you need to or do outside research when the lesson
phrasing doesn't quite work for you.

2. **Do every lab and challenge** - this supports the first point. It's pretty
tough to lie to yourself about how well you know something when you make
yourself try to do it. Do every lab and every challenge to test where you're
at and repeat them as needed. We provide solution code for every lab, but be
sure to use it as a helpful resource rather than a crutch.

3. **Go above and beyond** - this sounds cliche, but don't just stop at what the
lab and challenges ask you to do. Get creative! Take the projects and make
them your own. Build past them. The more you practice the better you get.

Alright, that's it for the pep talk. Get after it!
13 changes: 7 additions & 6 deletions content/courses/intro-to-solana/interact-with-wallets.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ objectives:
- Install a Solana wallet app and set your wallet app to
[Devnet](https://api.devnet.solana.com/)
- Create a React app that uses Wallet Adapter to have users sign transactions
description:
"Solana wallets store your secret key and allow you to sign transactions. You
can make websites communicate with wallet apps using the Solana Wallet
Adapter."
description: "Connect with installed browser wallets from your React apps."
---

## Summary
Expand Down Expand Up @@ -92,10 +89,12 @@ npm install @solana/wallet-adapter-base \
@solana/wallet-adapter-react-ui
```

<Callout type="note">We're learning doing this manually to learn about Wallet
<Callout type="note">
We're learning doing this manually to learn about Wallet
Adapter, but you can also use
[create-solana-dapp](https://github.com/solana-developers/create-solana-dapp) to
create a brand new React or NextJS app that supports Solana wallets! </Callout>
create a brand new React or NextJS app that supports Solana wallets.
</Callout>

### Connect To Wallets

Expand Down Expand Up @@ -626,7 +625,9 @@ lets a user connect their wallet and send SOL to another account.
If you get really stumped, feel free to
[check out the solution code](https://github.com/Unboxed-Software/solana-send-sol-frontend/tree/main).

<Callout type="success">
### Completed the lab?

Push your code to GitHub and
[tell us what you thought of this lesson](https://form.typeform.com/to/IPH0UGz7#answers-lesson=69c5aac6-8a9f-4e23-a7f5-28ae2845dfe1)!
</Callout>
18 changes: 8 additions & 10 deletions content/courses/intro-to-solana/intro-to-cryptography.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ objectives:
- Explain keypairs
- Generate a new keypair
- Load a keypair from an env file
description:
"Solana is an example of asymmetric cryptography. Everyone has a keypair,
consisting of a secret key and a public key. They use the secret key sign
transactions, which mathematically proves the keyholder authorised the
transaction."
description: "Understand asymmetric cryptography and how Solana uses it."
---

## Summary
Expand All @@ -26,8 +22,8 @@ description:

### Symmetric and Asymmetric Cryptography

'Cryptography' is literally the study of hiding information. There are two main
types of cryptography you'll encounter day to day:
'Cryptography' the study of hiding information. There are two main types of
cryptography you'll encounter day to day:

**Symmetric Cryptography** is where the same key is used to encrypt and decrypt.
It's hundreds of years old and has been used by everyone from the ancient
Expand Down Expand Up @@ -107,9 +103,9 @@ npm i @solana/web3.js
```

We’ll cover a lot of
[web3.js](https://docs.solana.com/developing/clients/javascript-reference)
gradually throughout this course, but you can also check out the
[official web3.js documentation](https://docs.solana.com/developing/clients/javascript-reference).
[web3.js](https://solana.com/docs/clients/javascript-reference) gradually
throughout this course, but you can also check out the
[official web3.js documentation](https://solana.com/docs/clients/javascript-reference).

To send tokens, send NFTS, or read and write data Solana, you'll need your own
keypair. To make a new keypair, use the `Keypair.generate()` function from
Expand Down Expand Up @@ -241,7 +237,9 @@ Run `npx esrun generate-keypair.ts`. You should see the following result:
We've now learned about keypairs, and how to store secret keys securely on
Solana. In the next chapter, we'll use them!

<Callout type="success">
## Completed the lab?

Push your code to GitHub and
[tell us what you thought of this lesson](https://form.typeform.com/to/IPH0UGz7#answers-lesson=ee06a213-5d74-4954-846e-cba883bc6db1)!
</Callout>
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ title: Using custom onchain programs
objectives:
- Create transactions for custom onchain programs
description:
"As well as popular programs like the 'system' and 'memo' programs, there are
many other Solana programs. We can make instructions for arbitrary programs
using web3.js 'TransactionInstruction' constructor."
"Make instructions for arbitrary programs using the 'TransactionInstruction'
constructor."
---

## Summary
Expand Down Expand Up @@ -111,7 +110,7 @@ its data in a specific account at the address
### Basic scaffolding

We'll start by using the same packages and `.env` file we made earlier in
[Intro to Writing Data](/content/courses/intro-to-solana/intro-to-writing-data.md).
[Intro to Writing Data](/content/courses/intro-to-solana/intro-to-writing-data).

Name the file `send-ping-transaction.ts`:

Expand Down Expand Up @@ -223,14 +222,13 @@ console, like the following:
✅ Transaction completed! Signature is 55S47uwMJprFMLhRSewkoUuzUs5V6BpNfRx21MpngRUQG3AswCzCSxvQmS3WEPWDJM7bhHm3bYBrqRshj672cUSG
```

Copy the transaction signature. Open a browser and go to
[https://explorer.solana.com/?cluster=devnet](https://explorer.solana.com/?cluster=devnet)
(the query parameter at the end of the URL will ensure that you’ll explore
transactions on Devnet instead of Mainnet). Paste the signature into the search
bar at the top of Solana Explorer (make sure you're connected to Devnet) and hit
enter. You should see all the details about the transaction. If you scroll all
the way to the bottom, then you will see `Program Logs`, which show how many
times the program has been pinged including your ping.
Copy the transaction signature. Then visit
[Solana explorer on devnet](https://explorer.solana.com/?cluster=devnet). Paste
the signature into the search bar at the top of Solana Explorer (make sure
you're connected to Devnet) and hit enter. You should see all the details about
the transaction. If you scroll all the way to the bottom, then you will see
`Program Logs`, which show how many times the program has been pinged including
your ping.

![Solana Explorer with logs from calling the Ping program](/public/assets/courses/unboxed/solana-explorer-ping-result.png)

Expand Down Expand Up @@ -271,7 +269,9 @@ signature so you can look at it on Solana Explorer.
If you get stuck feel free to glance at the
[solution code](https://github.com/Unboxed-Software/solana-ping-client).

<Callout type="success">
### Completed the lab?

Push your code to GitHub and
[tell us what you thought of this lesson](https://form.typeform.com/to/IPH0UGz7#answers-lesson=e969d07e-ae85-48c3-976f-261a22f02e52)!
</Callout>
12 changes: 6 additions & 6 deletions content/courses/intro-to-solana/intro-to-reading-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ objectives:
- Understand SOL and lamports
- Use web3.js to connect to Solana and read an account balance
description:
"In Solana we use public keys as a form of address. We can interact with other
users by sending tokens to their public key, which we also refer to as their
wallet address. "
"Connect to Solana DevNet from TypeScript and read data from the blockchain!"
---

## Summary
Expand All @@ -23,7 +21,7 @@ description:

### Accounts

All data stored on Solana is stored in accounts. Accounts can store:
All data on Solana is stored in accounts. Accounts can store:

- SOL
- Other tokens, like USDC
Expand Down Expand Up @@ -141,7 +139,7 @@ Make a new file called `check-balance.ts`, substituting your public key for

The script loads the public key, connects to DevNet, and checks the balance:

```tsx
```typescript
import { Connection, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";

const publicKey = new PublicKey("<your public key>");
Expand Down Expand Up @@ -186,7 +184,7 @@ Re-run the script. You should see your balance updated:

You can modify the script to check balances on any wallet.

```tsx
```typescript
import { Connection, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";

const suppliedPublicKey = process.argv[2];
Expand Down Expand Up @@ -226,7 +224,9 @@ Modify the script as follows:

We'll transfer SOL in the next lesson!

<Callout type="success">
### Completed the lab?

Push your code to GitHub and
[tell us what you thought of this lesson](https://form.typeform.com/to/IPH0UGz7#answers-lesson=8bbbfd93-1cdc-4ce3-9c83-637e7aa57454)!
</Callout>
9 changes: 4 additions & 5 deletions content/courses/intro-to-solana/intro-to-writing-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ objectives:
- Use `@solana/web3.js` to sign transactions
- Use Solana Explorer to view transactions
description:
"Solana has onchain programs. Each instruction in a Solana transaction is sent
to a function in the onchain program. The function runs, and if all the
instructions in a transaction complete successfully, the new state is written
to the Blockchain."
"Make your first transactions on DevNet, using the System and memo programs!"
---

## Summary
Expand Down Expand Up @@ -166,7 +163,7 @@ We’re going to create a script to send SOL to other students.
### Basic scaffolding

We'll start by using the same packages and `.env` file we made earlier in
[Intro to Cryptography](/content/courses/intro-to-solana/intro-to-cryptography.md).
[Intro to Cryptography](/content/courses/intro-to-solana/intro-to-cryptography).

Create a file called `transfer.ts`:

Expand Down Expand Up @@ -259,7 +256,9 @@ Answer the following questions:

- What do you think "confirmed" means?

<Callout type="success">
### Completed the lab?

Push your code to GitHub and
[tell us what you thought of this lesson](https://form.typeform.com/to/IPH0UGz7#answers-lesson=dda6b8de-9ed8-4ed2-b1a5-29d7a8a8b415)!
</Callout>
10 changes: 4 additions & 6 deletions content/courses/intro-to-solana/metadata.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
author: unboxed
title: Introduction to cryptography and Solana clients
description:
Learn the basics of how to interact with the Solana blockchain, including the
basics of cryptography.
description: Learn the basics of how to interact with the Solana blockchain.
lessons:
- getting-started
- intro-to-cryptography
- intro-to-reading-data
- intro-to-writing-data
- token-program
- nfts-with-metaplex
- intro-to-custom-on-chain-programs
- intro-to-custom-onchain-programs
- interact-with-wallets
priority: 5
Loading

0 comments on commit 783e6ba

Please sign in to comment.