RareSkills Blog

Arithmetic Circuits for ZK
Arithmetic Circuits for ZK In the context of zero-knowledge proofs, an arithmetic circuit is a system of equations that models a problem in NP. A key point from our article…

Uniswap V2: Calculating the Settlement Price of an AMM Swap
Uniswap V2: Calculating the Settlement Price of an AMM Swap This article explains how to determine the price settlement of a trading pair in an Automated Market Maker (AMM). It…

P vs NP and its application to zero knowledge proofs
P vs NP and its application to zero knowledge proofs The P = NP problem asks: “If we can quickly verify a solution to a problem is correct, can we…

#[derive(Accounts)] in Anchor: different kinds of accounts
[derive(Accounts)] in Anchor: different kinds of accounts #[derive(Accounts)] in Solana Anchor is an attribute-like macro for structs that holds references to all the accounts the function will access during its…

Three ways to detect if an address is a smart contract
Three ways to detect if an address is a smart contract This article describes three methods in Solidity for determining if an address is a smart contract: Check if msg.sender…

ERC-1363 Standard Explained
ERC-1363 Standard Explained ERC-1363 enables a smart contract to detect and respond to an incoming transfer of tokens. What problem does ERC-1363 Solve? Suppose a user transfers an ERC-20 token…

Creating Raw Ethereum Interactions in Go: Blob Transactions, Tracing Transactions, and Others.
Creating Raw Ethereum Interactions in Go: Blob Transactions, Tracing Transactions, and Others. The ethclient package from Go-Ethereum (Geth) provides an API wrapper for JSON-RPC requests to the Ethereum network, similar…

Understanding the Function Selector in Solidity
Understanding the Function Selector in Solidity The function selector is a 4 byte id that Solidity uses to identify functions under the hood. The function selector is how a Solidity…

How ERC721 Enumerable Works
How ERC721 Enumerable Works An Enumerable ERC721 is an ERC721 with added functionality that enables a smart contract to list all the NFTs an address owns. This article describes how…

Checklist for Technical Writing
Checklist for Technical Writing Fluff Are fluff transitions removed? (” It is important to note,” Why did they do this?”, “Here’s how we can solve this problem.”) Sometimes, they are…

Hacking Underconstrained Circom Circuits With Fake Proofs
Hacking Underconstrained Circom Circuits With Fake Proofs The <– operator in Circom can be dangerous because it assigns values to signals but does not constrain them. But how do you…

Modifying accounts using different signers
Modifying accounts using different signers In our Solana tutorials thus far, we’ve only had one account initialize and write to the account. In practice, this is very restrictive. For example,…

Deleting and Closing Accounts and Programs in Solana
Deleting and Closing Accounts and Programs in Solana In the Anchor framework for Solana, close is the opposite of init (initializing an account in Anchor) — it reduces the lamport…

PDA (Program Derived Address) vs Keypair Account in Solana
PDA (Program Derived Address) vs Keypair Account in Solana A program derived address (PDA) is an account whose address is derived from the address of the program that created it…

Owner vs Authority in Solana
Owner vs Authority in Solana Newcomers to Solana are frequently confused by the distinction between an “owner” and an “authority.” This article attempts to clear up the confusion as succinctly…

Multicall in Solana: Batching Transactions and Transaction Size Limit
Multicall in Solana: Batching Transactions and Transaction Size Limit Solana has multicall built in In Ethereum, we use the multicall pattern if we want to batch multiple transactions together atomically.…

Init_if_needed in Anchor and the Reinitialization Attack
Init_if_needed in Anchor and the Reinitialization Attack In previous tutorials, we’ve had to initialize an account in a separate transaction before we can write data to it. We may wish…

Understanding Account Ownership in Solana: Transferring SOL out of a PDA
Understanding Account Ownership in Solana: Transferring SOL out of a PDA The owner of an account in Solana is able to reduce the SOL balance, write data to the account,…

Transferring SOL and building a payment splitter: “msg.value” in Solana
Transferring SOL and building a payment splitter: “msg.value” in Solana This tutorial will introduce the mechanism by which Solana Anchor programs can transfer SOL as part of the transaction. Unlike…

Function modifiers (view, pure, payable) and fallback functions in Solana: why they don’t exist
Function modifiers (view, pure, payable) and fallback functions in Solana: why they don’t exist Solana does not have fallback or receive functions A Solana transaction must specify in advance the…

Reading an account balance in Anchor: address(account).balance in Solana
Reading an account balance in Anchor: address(account).balance in Solana Reading an account balance in Anchor Rust To read the Solana balance of an address inside a Solana program, use the…

Cost of storage, maximum storage size, and account resizing in Solana
Cost of storage, maximum storage size, and account resizing in Solana When allocating storage space, the payer must pay a certain number of SOL per byte allocated. Solana calls this…

Creating “mappings” and “nested mapping” in Solana
Creating “mappings” and “nested mapping” in Solana In the previous tutorials, the seeds=[] parameter was always empty. If we put data into it, it behaves like a key or keys…

Read account data with Solana web3 js and Anchor
Read account data with Solana web3 js and Anchor This tutorial shows how to read account data directly from the Solana web3 Javascript client so that a web app could…

Solana counter tutorial: reading and writing data to accounts
Solana counter tutorial: reading and writing data to accounts In our previous tutorial, we discussed how to initialize an account so that we could persist data in storage. This tutorial…

Initializing Accounts in Solana and Anchor
Initializing Accounts in Solana and Anchor Up until this point, none of our tutorials have used “storage variables” or stored anything permanent. In Solidity and Ethereum, a more exotic design…

Introduction to Solana Compute Units and Transaction Fees
Introduction to Solana Compute Units and Transaction Fees In Ethereum, the price of a transaction is computed as $\text{gasUsed} \times \text{gasPrice}$. This tells us how much Ether will be spent…