Solana Core

by Buildspace & Solana Bootcamp

I'm J.D. Nicholls 👋

- Open Source Contributor 👨‍💻

- Game developer (Hobby) 🎮

- Developer who loves UX 💫

- Chocolate lover 🍫

- Founding Full-Stack Engineer 👷

AT

BAXUS

Why Solana?

Solana has low gas-fees, it's really fast...

Accounts

Smart contracts on Solana, referred to as "programs", are stateless - meaning they don't store anything except code. Everything happens in accounts, so they're central to Solana, they're used for storage, contracts, and for native blockchain programs.

A close-up illustration of a Solana account, with a smart contract displayed on a computer screen in the background, sleek, modern, high-tech, intricate, digital painting, artstation, concept art, smooth, sharp focus, illustration, art by artgerm and greg rutkowski and alphonse mucha

The program itself doesn't hold a user's data. The program just talks to "accounts" that hold the user's data.

⬇️

Types of accounts

Data

These accounts store data:

  • System owned accounts.
  • PDA (Program derived address) accounts.

Program

These accounts store executable programs (AKA smart contracts).

Native

These accounts are for core blockchain functions like Stake, Vote, etc.

⬇️

Account Fields

FIELD DESCRIPTION
lamports The # of lamports owned by this account
owner The program owner of this account
executable Whether this account can process instructions (is executable)
data The raw data byte array stored by this account
rent_epoch The next epoch that this account will owe rent

Iamports are the smallest unit of Solana:

1 Iamport = 0.000000001 SOL

Iamports defines how much SOL the account has 💰

⬇️

Account Address

Smart contracts on Solana, referred to as "programs", are stateless - meaning they don't store anything except code. Everything happens in accounts, so they're central to Solana, they're used for storage, contracts, and for native blockchain programs.

Accounts

  • Unique 256-bit address
  • Hold some balance of SOL
  • Can store arbitrary data
  • Data storage is paid with Rent
  • Anyone can credit SOL or read data
  • Only the account’s owner can debit SOL or modify data

{
  key: number,            // The address of the account
  lamports: number,       // Lamports currently held
  data: Uint8Array,       // Data stored in the account
  is_executable: boolean, // Is this data a program?
  owner: PublicKey,       // The program with write access
}

Programs

Smart contracts on Solana are called "programs";

A Solana program is just a piece of code that lives on the blockchain. The blockchain is a place where anyone can run code for a fee. The blockchain is being run by "miners", in the world of Solana we actually call them "validators".

 

Programs are:

- Special kind of account

- Data is eBPF bytecode

- Written in Rust, C/C++, Python

Deep in Programs

  • Programs are stateless, they read & write data to other accounts. This allows programs to be executed in parallel.
  • Must be the owner of an account to modify
  • Programs process instructions
  • Programs can send instructions to other programs

 

 

 

 

Program instructions

{
  program_id: number,           // The program this instruction is for
  keys: Array<{
    key: PublicKey,
    is_mutable: boolean,
    is_signer: boolean,
  }>,
  data: Uint8Array,      // Data stored in the account
}

Transactions

Transactions allows to send an instruction to a Solana program. Transactions send a package of "instructions" to an RPC client, which then forwards it to the network

  • Programs are invoked by instructions.
  • Instructions are sent via transactions.
  • Transactions are atomic.
  • Transactions must be signed.
{
  message: {
    instructions: Array<Instruction>,
    recent_blockhash: number,
    fee_payer: PublicKey,
    ...
  },
  signers: Array<Uint8Array>,
}

NFTs

The Metadata Standard on Solana introduces countless ways to customize NFTs and the user’s experience.

  • Are SPL Tokens
  • Have 0 decimal places
  • Have a total supply of 1
  • Can have highly-customizable metadata
  • A Collection is a NFT as well

Solana

By Juan David Nicholls

Solana

A brief presentation about Solana

  • 134