Network
Launch Date
Consensus
Note
Sepolia
Oct 2021
PoW
Like-for-like representation of Ethereum
Görli
Jan 2019
PoA
Proof-of-Authority
Kiln
Mar 2022
PoS
Post-Merge (for ETH2), shadow fork of the mainnet
Kintsugi
Dec 2021
PoS
DEPRECATED, use Kiln; post-Merge (for ETH2)
Ropsten
Nov 2016
PoW
DEPRECATED, use Sepolia; the Merge to happen on Jun 8, 2022
Rinkeby
Apr 2017
PoA
DEPRECATED, use Görli and Görli Faucet
Kovan
Mar 2017
PoA
DEPRECATED, use Sepolia or Görli
List of active and deprecated Ethereum testnets, including Kintsugi.
Features
Optimistic rollup 
ZK-rollup 
Proof
Uses fraud proofs to prove transaction validity. 
Uses validity (zero-knowledge) proofs to prove transaction validity. 
Capital efficiency
Requires waiting through a 1-week delay (dispute period) before withdrawing funds. 
Users can withdraw funds immediately because validity proofs provide incontrovertible evidence of the authenticity of off-chain transactions. 
Data compression
Publishes full transaction data as calldata to Ethereum Mainnet, which increases rollup costs. 
Doesn't need to publish transaction data on Ethereum because ZK-SNARKs and ZK-STARKs already guarantee the accuracy of the rollup state. 
EVM compatibility
Uses a simulation of the Ethereum Virtual Machine (EVM), which allows it to run arbitrary logic and support smart contracts. 
Doesn't widely support EVM computation, although a few EVM-compatible ZK-rollups have appeared. 
Rollup costs
Reduces costs since it publishes minimal data on Ethereum and doesn't have to post proofs for transactions, except in special circumstances. 
Faces higher overhead from costs involved in generating and verifying proofs for every transaction block. ZK proofs require specialized, expensive hardware to create and have high on-chain verification costs. 
Trust assumptions
Doesn't require a trusted setup. 
Requires a trusted setup to work. 
Liveness requirements
Verifiers are needed to keep tabs on the actual rollup state and the one referenced in the state root to detect fraud. 
Users don't need someone to watch the L2 chain to detect fraud. 
Security properties 
Relies on cryptoeconomic incentives to assure users of rollup security. 
Relies on cryptographic guarantees for security. 
Start building
on Alchemy.
Sign up for free
Start building on Optimism.
Sign up for free
Start building on Arbitrum.
Sign up for free
Start building on Ethereum.
Sign up for free
Start building on Polygon.
Sign up for free
Start building on Starknet.
Sign up for free
Start building on Flow.
Sign up for free
kiln faucet
Get free Kiln ETH.
Start building today
Goerli faucet
Get free Goerli ETH.
Start building today
SEPOLIA FAUCET
Get free Sepolia ETH.
Start Building Today
mumbai faucet
Get free Mumbai Matic.
Start building today
rinkeby faucet
Get free Rinkeby
ETH.
Start building today
Start building on Ethereum.
Get started for free
Start building on Ethereum.
Get started for free
Start building on Flow.
Get started for free
Start building on Polygon.
Get started for free
Start building on Starknet.
Get started for free
Start building on Optimism.
Get started for free
Start building on Solana.
Get started for free
Start building on Solana.
Sign up for beta access
Start building on Solana.
Join the waitlist
Arbitrum logo
Start building on Arbitrum.
Get started for free
Build with Alchemy's
Gas Manager & Bundler APIs
Learn
Solidity at
Alchemy
University
Get started today
Build with Alchemy's
Gas Manager & Bundler APIs
curl 
https://release.solana.com/v1.10.32/solana-install-init-x86_64-pc-windows-msvc.exe 
--output 
C:\solana-install-tmp\solana-install-init.exe 
--create-dirs
Solana
ANCHOR FRAMEWORK OVERVIEW

What is Anchor and the Anchor Program Registry?

Learn how to use Anchor and the Anchor Program Registry for Building Applications on Solana
Last Updated:
January 26, 2023
Table of Contents
Table of Contents
Table of Contents

{{get-started-solana}}

Anchor is leading Solana development frameworks for writing safe, secure, and efficient high-level programs on Solana. A program in Anchor is a smart contract on the Solana blockchain that enables users to anchor data to the Solana blockchain. Due to Solana’s massive developer community, verified programs on Solana are hosted on the Anchor Program Registry for easy access.

This article will help you understand how to use one of the most important Solana developer tools, Anchor, and the Anchor Program Registry for building on Solana. We will also comparison Anchor and Seahorse, Python-based development framework for interacting with Solana.

What is the Solana account model?

Everything developers build on the Solana blockchain involves programs and accounts, which execute and store data on the blockchain. There are different account categories in Solana including:

  • Data accounts - store data
  • Program accounts - store executable programs
  • Native accounts - indicate native programs on Solana

And every account stores a set of information:

  • lamports - number of lamports owned by the account
  • owner - program owner of the account
  • executable - checks whether the account can process instructions or not
  • data - raw data byte array stored by the account
  • rent_epoch - next epoch that the account will owe rent fees

What is Anchor?

Anchor is a framework used to write safe, secure, and high-level programs on Solana, which abstracts the low-level construction of accounts and modification of the interfaces to your Solana programs.

A framework acts as a foundation so that the users don't have to create unnecessary logic from scratch, helps users avoid redundant code, and help them write clean and secure programs. Specifically, Anchor provides a deserialized accounts and instruction data through boilerplates, a command line interface (CLI), and a workspace for developing Solana dapps.

How does Anchor work?

Anchor uses macros and traits to generate boilerplate Rust code for developer. Every Anchor program consists of three components:

  1. declare_id -a macro used for declaring the program’s on-chain address
  2. #[program] - attribute macro used to denote the module containing the program’s instruction logic
  3. #[account] - attribute macro used to define custom account types for the program

Here is the basic structure of an Anchor program:

Basic structure of an Anchor program

1. Create a Default Keypair

When we build an Anchor program for the first time, it generates a new key pair which serves as a default keypair to deploy the program.

declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS")

The public key should be used as the programID specified in the declare_id! Marco.

2. Instruct the Program

Then, we can separately instruct the program using the #[program] attribute. Each instruction function requires a parameter of type Context and can optionally include additional function parameters representing instruction data. Anchor will automatically handle instruction data deserialization so that the user can work with instruction data as Rust types.
‍

#[program]
mod hello_anchor {
    use super::*;
    pub fn initialize(_ctx: Context<Initialize>) -> Result<()> {
        Ok(())
    }
}

3. Implement an Account Deserializer

#[derive(Accounts)] implements an Account deserializer on the given struct and removes the need to deserialize each account manually. This is responsible for performing all requisite constraint checks and ensuring the accounts meet the conditions required for the program to run securely.

#[derive(Accounts)]
pub struct Initialize {}

4. Invoke the Initialize Function

When the Initialize function is invoked, the program:

  • Checks that the accounts passed into the instruction match the account types specified in the Initialize struct
  • Checks the accounts against any additional constraints specified

This is how an Anchor program works and allows you to get started with building Anchor programs. To know more about Anchor programs, it is highly recommended to check out their documentation.

What is the Anchor Program Registry (APR)?

The Anchor Program Registry (APR) is a directory of Anchor programs that have been registered on the Solana blockchain, allowing users to easily locate and access them. APR ensures that Anchor programs are registered and authenticated on the blockchain.

There are a number of programs in the Anchor Program Registry to make your job easier. Let us consider a few examples of them:

  • token_signer - provides a suite of programs for Solana key management and security.
  • spl_governance - a collection of on-chain programs targeting the Sealevel parallel runtime.
  • crate_token - allows anyone to create, manage, and trade a tokenized basket of assets.

How do Solana developers use the Anchor Program Registry?

Solana developers use the Anchor Program Registry to access verified programs on the Solana blockchain. The Anchor Program Registry catalogs source code for verified programs, allowing developers to access a repository of working code.

You can follow the flow provided below in order to use Anchor Program Registry:

  1. Visit the address of an Anchor Program
  2. Connect your wallet
  3. Access the UI
  4. Sign and send a transaction to execute an instruction

The APR interface provides a list of instructions that Anchor program supports and form fields you can use to configure the inputs for a given instruction.

What is Seahorse?

Seahorse is a Solana development framework like Anchor, but it is built for Python developers. Seahorse provides a set of tools for building, deploying, and interacting with programs and accounts on the Solana blockchain. It supports different programming languages like JavaScript, Rust, and Python, complete with resources and documentation for new developers.

Anchor vs. Seahorse

Feature Seahorse Anchor
Programming languages supported JavaScript, Rust, Python JavaScript, TypeScript
Focus Flexibility and scalability User experience and ease of use
Tools and feature Smart contract development Decentralized Application Development
Local development environment Yes Yes
Testnet for running simulations Yes Yes
Documentation and resources Yes Yes

Resources to Learn Anchor

There are several resources available to help you learn about the Anchor framework:

  1. Anchor Docs - find the most relevant and up-to-date information
  2. Soldev - start developing smart contracts with Anchor with example code
  3. Sol Playground - start developing programs with Anchor using an online IDE

There are plenty of resources available to help you learn about the Anchor framework and start building your own decentralized applications.

Start Developing with Anchor and Alchemy

The Anchor framework is a valuable tool for building reliable and secure Solana programs (smart contracts). Further, the Anchor Program Registry is a directory for verified programs on the Solana blockchain, and is a critical resource for enabling better composability.

Anchor framework’s versatility and scalability make it an attractive choice for Solana developers. If you’re ready to start with your Solana development journey, sign up for a free Solana RPC account today!

ALCHEMY SUPERNODE - ETHEREUM NODE API

Scale to any size, without any errors

Alchemy Supernode finally makes it possible to scale blockchain applications without all the headaches. Plus, our legendary support will guide you every step of the way.

Get started for free
Supernode footer
Solana
ANCHOR FRAMEWORK OVERVIEW

What is Anchor and the Anchor Program Registry?

Learn how to use Anchor and the Anchor Program Registry for Building Applications on Solana
Last Updated:
January 26, 2023
Last Updated:
March 14, 2023
Don't miss an update
Sign up for our newsletter to get alpha, key insights, and killer resources.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Table of Contents

Talk to an Expert

Learn how Alchemy's blockchain developer tools can help your business succeed in web3!
Valid number
Thank you! An Alchemy expert will be in touch with you shortly!
Oops! Something went wrong while submitting the form.

{{get-started-solana}}

Table of Contents

Anchor is leading Solana development frameworks for writing safe, secure, and efficient high-level programs on Solana. A program in Anchor is a smart contract on the Solana blockchain that enables users to anchor data to the Solana blockchain. Due to Solana’s massive developer community, verified programs on Solana are hosted on the Anchor Program Registry for easy access.

This article will help you understand how to use one of the most important Solana developer tools, Anchor, and the Anchor Program Registry for building on Solana. We will also comparison Anchor and Seahorse, Python-based development framework for interacting with Solana.

What is the Solana account model?

Everything developers build on the Solana blockchain involves programs and accounts, which execute and store data on the blockchain. There are different account categories in Solana including:

  • Data accounts - store data
  • Program accounts - store executable programs
  • Native accounts - indicate native programs on Solana

And every account stores a set of information:

  • lamports - number of lamports owned by the account
  • owner - program owner of the account
  • executable - checks whether the account can process instructions or not
  • data - raw data byte array stored by the account
  • rent_epoch - next epoch that the account will owe rent fees

What is Anchor?

Anchor is a framework used to write safe, secure, and high-level programs on Solana, which abstracts the low-level construction of accounts and modification of the interfaces to your Solana programs.

A framework acts as a foundation so that the users don't have to create unnecessary logic from scratch, helps users avoid redundant code, and help them write clean and secure programs. Specifically, Anchor provides a deserialized accounts and instruction data through boilerplates, a command line interface (CLI), and a workspace for developing Solana dapps.

How does Anchor work?

Anchor uses macros and traits to generate boilerplate Rust code for developer. Every Anchor program consists of three components:

  1. declare_id -a macro used for declaring the program’s on-chain address
  2. #[program] - attribute macro used to denote the module containing the program’s instruction logic
  3. #[account] - attribute macro used to define custom account types for the program

Here is the basic structure of an Anchor program:

Basic structure of an Anchor program

1. Create a Default Keypair

When we build an Anchor program for the first time, it generates a new key pair which serves as a default keypair to deploy the program.

declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS")

The public key should be used as the programID specified in the declare_id! Marco.

2. Instruct the Program

Then, we can separately instruct the program using the #[program] attribute. Each instruction function requires a parameter of type Context and can optionally include additional function parameters representing instruction data. Anchor will automatically handle instruction data deserialization so that the user can work with instruction data as Rust types.
‍

#[program]
mod hello_anchor {
    use super::*;
    pub fn initialize(_ctx: Context<Initialize>) -> Result<()> {
        Ok(())
    }
}

3. Implement an Account Deserializer

#[derive(Accounts)] implements an Account deserializer on the given struct and removes the need to deserialize each account manually. This is responsible for performing all requisite constraint checks and ensuring the accounts meet the conditions required for the program to run securely.

#[derive(Accounts)]
pub struct Initialize {}

4. Invoke the Initialize Function

When the Initialize function is invoked, the program:

  • Checks that the accounts passed into the instruction match the account types specified in the Initialize struct
  • Checks the accounts against any additional constraints specified

This is how an Anchor program works and allows you to get started with building Anchor programs. To know more about Anchor programs, it is highly recommended to check out their documentation.

What is the Anchor Program Registry (APR)?

The Anchor Program Registry (APR) is a directory of Anchor programs that have been registered on the Solana blockchain, allowing users to easily locate and access them. APR ensures that Anchor programs are registered and authenticated on the blockchain.

There are a number of programs in the Anchor Program Registry to make your job easier. Let us consider a few examples of them:

  • token_signer - provides a suite of programs for Solana key management and security.
  • spl_governance - a collection of on-chain programs targeting the Sealevel parallel runtime.
  • crate_token - allows anyone to create, manage, and trade a tokenized basket of assets.

How do Solana developers use the Anchor Program Registry?

Solana developers use the Anchor Program Registry to access verified programs on the Solana blockchain. The Anchor Program Registry catalogs source code for verified programs, allowing developers to access a repository of working code.

You can follow the flow provided below in order to use Anchor Program Registry:

  1. Visit the address of an Anchor Program
  2. Connect your wallet
  3. Access the UI
  4. Sign and send a transaction to execute an instruction

The APR interface provides a list of instructions that Anchor program supports and form fields you can use to configure the inputs for a given instruction.

What is Seahorse?

Seahorse is a Solana development framework like Anchor, but it is built for Python developers. Seahorse provides a set of tools for building, deploying, and interacting with programs and accounts on the Solana blockchain. It supports different programming languages like JavaScript, Rust, and Python, complete with resources and documentation for new developers.

Anchor vs. Seahorse

Feature Seahorse Anchor
Programming languages supported JavaScript, Rust, Python JavaScript, TypeScript
Focus Flexibility and scalability User experience and ease of use
Tools and feature Smart contract development Decentralized Application Development
Local development environment Yes Yes
Testnet for running simulations Yes Yes
Documentation and resources Yes Yes

Resources to Learn Anchor

There are several resources available to help you learn about the Anchor framework:

  1. Anchor Docs - find the most relevant and up-to-date information
  2. Soldev - start developing smart contracts with Anchor with example code
  3. Sol Playground - start developing programs with Anchor using an online IDE

There are plenty of resources available to help you learn about the Anchor framework and start building your own decentralized applications.

Start Developing with Anchor and Alchemy

The Anchor framework is a valuable tool for building reliable and secure Solana programs (smart contracts). Further, the Anchor Program Registry is a directory for verified programs on the Solana blockchain, and is a critical resource for enabling better composability.

Anchor framework’s versatility and scalability make it an attractive choice for Solana developers. If you’re ready to start with your Solana development journey, sign up for a free Solana RPC account today!

Anchor is leading Solana development frameworks for writing safe, secure, and efficient high-level programs on Solana. A program in Anchor is a smart contract on the Solana blockchain that enables users to anchor data to the Solana blockchain. Due to Solana’s massive developer community, verified programs on Solana are hosted on the Anchor Program Registry for easy access.

This article will help you understand how to use one of the most important Solana developer tools, Anchor, and the Anchor Program Registry for building on Solana. We will also comparison Anchor and Seahorse, Python-based development framework for interacting with Solana.

What is the Solana account model?

Everything developers build on the Solana blockchain involves programs and accounts, which execute and store data on the blockchain. There are different account categories in Solana including:

  • Data accounts - store data
  • Program accounts - store executable programs
  • Native accounts - indicate native programs on Solana

And every account stores a set of information:

  • lamports - number of lamports owned by the account
  • owner - program owner of the account
  • executable - checks whether the account can process instructions or not
  • data - raw data byte array stored by the account
  • rent_epoch - next epoch that the account will owe rent fees

What is Anchor?

Anchor is a framework used to write safe, secure, and high-level programs on Solana, which abstracts the low-level construction of accounts and modification of the interfaces to your Solana programs.

A framework acts as a foundation so that the users don't have to create unnecessary logic from scratch, helps users avoid redundant code, and help them write clean and secure programs. Specifically, Anchor provides a deserialized accounts and instruction data through boilerplates, a command line interface (CLI), and a workspace for developing Solana dapps.

How does Anchor work?

Anchor uses macros and traits to generate boilerplate Rust code for developer. Every Anchor program consists of three components:

  1. declare_id -a macro used for declaring the program’s on-chain address
  2. #[program] - attribute macro used to denote the module containing the program’s instruction logic
  3. #[account] - attribute macro used to define custom account types for the program

Here is the basic structure of an Anchor program:

Basic structure of an Anchor program

1. Create a Default Keypair

When we build an Anchor program for the first time, it generates a new key pair which serves as a default keypair to deploy the program.

declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS")

The public key should be used as the programID specified in the declare_id! Marco.

2. Instruct the Program

Then, we can separately instruct the program using the #[program] attribute. Each instruction function requires a parameter of type Context and can optionally include additional function parameters representing instruction data. Anchor will automatically handle instruction data deserialization so that the user can work with instruction data as Rust types.
‍

#[program]
mod hello_anchor {
    use super::*;
    pub fn initialize(_ctx: Context<Initialize>) -> Result<()> {
        Ok(())
    }
}

3. Implement an Account Deserializer

#[derive(Accounts)] implements an Account deserializer on the given struct and removes the need to deserialize each account manually. This is responsible for performing all requisite constraint checks and ensuring the accounts meet the conditions required for the program to run securely.

#[derive(Accounts)]
pub struct Initialize {}

4. Invoke the Initialize Function

When the Initialize function is invoked, the program:

  • Checks that the accounts passed into the instruction match the account types specified in the Initialize struct
  • Checks the accounts against any additional constraints specified

This is how an Anchor program works and allows you to get started with building Anchor programs. To know more about Anchor programs, it is highly recommended to check out their documentation.

What is the Anchor Program Registry (APR)?

The Anchor Program Registry (APR) is a directory of Anchor programs that have been registered on the Solana blockchain, allowing users to easily locate and access them. APR ensures that Anchor programs are registered and authenticated on the blockchain.

There are a number of programs in the Anchor Program Registry to make your job easier. Let us consider a few examples of them:

  • token_signer - provides a suite of programs for Solana key management and security.
  • spl_governance - a collection of on-chain programs targeting the Sealevel parallel runtime.
  • crate_token - allows anyone to create, manage, and trade a tokenized basket of assets.

How do Solana developers use the Anchor Program Registry?

Solana developers use the Anchor Program Registry to access verified programs on the Solana blockchain. The Anchor Program Registry catalogs source code for verified programs, allowing developers to access a repository of working code.

You can follow the flow provided below in order to use Anchor Program Registry:

  1. Visit the address of an Anchor Program
  2. Connect your wallet
  3. Access the UI
  4. Sign and send a transaction to execute an instruction

The APR interface provides a list of instructions that Anchor program supports and form fields you can use to configure the inputs for a given instruction.

What is Seahorse?

Seahorse is a Solana development framework like Anchor, but it is built for Python developers. Seahorse provides a set of tools for building, deploying, and interacting with programs and accounts on the Solana blockchain. It supports different programming languages like JavaScript, Rust, and Python, complete with resources and documentation for new developers.

Anchor vs. Seahorse

Feature Seahorse Anchor
Programming languages supported JavaScript, Rust, Python JavaScript, TypeScript
Focus Flexibility and scalability User experience and ease of use
Tools and feature Smart contract development Decentralized Application Development
Local development environment Yes Yes
Testnet for running simulations Yes Yes
Documentation and resources Yes Yes

Resources to Learn Anchor

There are several resources available to help you learn about the Anchor framework:

  1. Anchor Docs - find the most relevant and up-to-date information
  2. Soldev - start developing smart contracts with Anchor with example code
  3. Sol Playground - start developing programs with Anchor using an online IDE

There are plenty of resources available to help you learn about the Anchor framework and start building your own decentralized applications.

Start Developing with Anchor and Alchemy

The Anchor framework is a valuable tool for building reliable and secure Solana programs (smart contracts). Further, the Anchor Program Registry is a directory for verified programs on the Solana blockchain, and is a critical resource for enabling better composability.

Anchor framework’s versatility and scalability make it an attractive choice for Solana developers. If you’re ready to start with your Solana development journey, sign up for a free Solana RPC account today!

{{get-started-solana}}

Contact Us

Talk to an expert at Alchemy to answer all of your product questions.
Valid number
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Build blockchain magic with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

Get started for free