Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
setup
Browse files Browse the repository at this point in the history
  • Loading branch information
URANI committed Mar 28, 2024
1 parent c62df81 commit 25350c4
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 21 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@
Compared to older platforms like Bitcoin and EVM-based protocols, Solana is:

- **Massively cheaper**, as transaction fees are a small fraction of a penny.

- **Massively faster**, as most transactions are completed in a couple of seconds.

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

- **Fun AF**, with an uncomparable UI/UX and developer experience.

<br>

#### Shall we begin?

Expand Down Expand Up @@ -70,5 +66,6 @@ Compared to older platforms like Bitcoin and EVM-based protocols, Solana is:
* **[Demo 2: Writing Non-Native Programs](demos/frontend/02_non_native_programs)**
* **[Demo 3: Interacting with Wallets](demos/frontend/03_wallets_ping)**
* **[Demo 4: Sending Transactions with Wallets](demos/frontend/04_wallets_tx)**
* **[Demo 5: Serializing Custom Data with PDA](demos/frontend/05_serialize_custom_data)**


2 changes: 1 addition & 1 deletion chapters/03_anchor.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ anchor init <workspace-name>

<br>

* Learn how cross-program instructions work on Anchor through [demo 2](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/backend/02_anchor_cpi).
* Learn how cross-program instructions work on Anchor through [backend's demo 2](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/backend/02_anchor_cpi).

<br>

Expand Down
7 changes: 3 additions & 4 deletions chapters/04_pda.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,11 @@ pub struct UserStats {

<br>

* Learn how PDA works on Anchor through [demo 3](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/backend/03_anchor_pda).

<br>
* Learn how PDA works on Anchor through [backend's demo 3](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/backend/03_anchor_pda).

* Learn how PDA and CPI work on Anchor through [backend's demo 4](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/backend/04_pda_and_cpi).

* Learn how PDA and CPI work on Anchor through [demo 4](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/backend/04_pda_and_cpi).
* Build a frontend dApp that leverages PDA through [frontend's demo 5](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/frontend/05_serialize_custom_data).

<br>

Expand Down
59 changes: 47 additions & 12 deletions chapters/06_frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,30 @@

<br>

### tl; dr

## 🛹 Introduction to [@solana/web3.js](https://solana-labs.github.io/solana-web3.js/)


### Demos

<br>


* [Demo 1: Interacting with the Blockchain](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/frontend/01_connecting_to_the_blockchain)

* [Demo 2: Non-native Programs](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/frontend/02_non_native_programs)

<br>

----

---


### Interacting with Wallets
## 🛹 Interacting with Wallets

<br>

* A wallet refers to software or hardware that stores a secret key in order to keep it secure and handle secure transaction signing.
* A wallet is a software or hardware that stores a secret key to keep it secure and handle secure transaction signing.

* Solana's [@solana/wallet-adapter-base and @solana/wallet-adapter-react.-Adapter](https://github.com/anza-xyz/wallet-adapter) are libraries used to simplify the process of supporting wallet browser extensions.

Expand All @@ -28,7 +37,7 @@

* Any use of `useWallet` and `useConnection` should be wrapped in `WalletProvider` and `ConnectionProvider`.

* `@solana/wallet-adapter-react-ui` allow the creation of custom components for, such as:
* `@solana/wallet-adapter-react-ui` allows the creation of custom components for, such as:
- `WalletModalProvider`
- `WalletMultiButton`
- `WalletConnectButton`
Expand All @@ -41,29 +50,55 @@

<br>

----
---

### Demos

<br>


#### Introduction to [@solana/web3.js](https://solana-labs.github.io/solana-web3.js/)

* [Demo 3: Interacting with Wallets](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/frontend/03_wallets_ping)

* [Demo 1: Interacting with the Blockchain](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/frontend/01_connecting_to_the_blockchain)
* [Demo 4: Sending Transactions with Wallets](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/frontend/04_wallets_tx)

* [Demo 2: Non-native Programs](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/frontend/02_non_native_programs)

<br>

---

## 🛹 Serializing Data

<br>

#### Introduction to [@solana/wallet-adapter](https://github.com/anza-xyz/wallet-adapter)
* Instruction data must be serialized into a byte buffer to send to clients.

* Every transaction contains:
- an array with every account it intends to read or write
- one or more instructions
- a recent blockhash
- one or more signatures

* [Demo 3: Interacting with Wallets](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/frontend/03_wallets_ping)
* Every instruction contains:
- the program ID (public key) of the intended program
- an array listing every account that will be read from or written to during execution
- a byte buffer of instruction data

* [Demo 4: Sending Transactions with Wallets](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/frontend/04_wallets_tx)
* [@solana/web3.js](https://solana-labs.github.io/solana-web3.js/) simplifies this process, so developers can focus on adding instructions and signatures.
- The library builds the array of accounts based on that information and handles the logic for including a recent blockhash.


* To facilitate this process of serialization, we can use [Binary Object Representation Serializer for Hashin (Borsh)]() and the library [@coral-xyz/borsh](https://github.com/coral-xyz).
- Borsh can be used in security-critical projects as it prioritizes consistency, safety, speed; and comes with a strict specification.


<br>


---

### Demos

<br>

* [Demo 5: Serializing Custom Data with PDA](https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/frontend/05_serialize_custom_data)
9 changes: 9 additions & 0 deletions demos/frontend/05_serialize_custom_data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

.anchor
.DS_Store
target
**/*.rs.bk
node_modules
test-ledger
.yarn
.next
26 changes: 26 additions & 0 deletions demos/frontend/05_serialize_custom_data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 🛹 Demo 5: Serializing Custom Data with PDA


<br>

### tl; dr

<br>


* In this demo we build a Movie Review dApp that lets users submit a movie review and have it stored on Solana’s network.

<br>

---

### Setup

<br>

* Run `npm install` from the root of the project.
* Install [Phantom Wallet](https://phantom.app/).



<br>

0 comments on commit 25350c4

Please sign in to comment.