0%

Web3 introduction: from seed phrases to Solana dApps

A small, friendly tour of the whole stack, with one tiny wallet you can build

Wallets, seed phrases, smart contracts, RPCs, multisigs, dApps. At first they feel like unrelated buzzwords. They are not. They are layers of one stack, and once you see how they connect, everything gets easier to reason about.

I will walk through the stack from the bottom up, keep it short, and finish with a tiny wallet you can run yourself. By the end you should be able to answer:

  • What is a seed phrase, and how does it become an address?
  • Why can one phrase control many accounts on many chains?
  • What is a smart contract, and why did Ethereum matter?
  • Can I trust a wallet extension, and what does an RPC server do?

Seed phrases, seeds and keys

Think of a seed phrase as a recipe book. The words are the book, a derivation path is the page number, and each address is a dish you cook from that page. Lose the book and the dishes are gone. Share the book and anyone can cook all of them.

A wallet starts with randomness, and a raw random number is a terrible thing to write on paper. So BIP-39 turns it into words from a fixed list of 2048 words, where each word carries 11 bits:

  • 12 words hold 128 bits of entropy plus a 4 bit checksum.
  • 24 words hold 256 bits of entropy plus an 8 bit checksum.
  • The checksum catches most typos, and the first four letters of every word are unique.
import { generateMnemonic, mnemonicToSeedSync } from "bip39";
 
const mnemonic = generateMnemonic(); // 12 words, pass 256 for 24
const seed = mnemonicToSeedSync(mnemonic); // 64 bytes
 
console.log(mnemonic);
console.log(seed.toString("hex"));

The seed is what the wallet really uses. BIP-39 makes it by running the words through PBKDF2 with HMAC-SHA512 for 2048 rounds. The salt is the text mnemonic plus an optional passphrase, often called the 25th word. A different passphrase gives a completely different set of wallets, and if you forget it, the funds are gone.

The flow is deterministic and one directional. The same words always give the same keys, but you can never walk backwards from an address to the phrase.

From mnemonic to address in five steps

One phrase, many accounts, many chains

Early Bitcoin wallets made every key independently, so every new address made your backup out of date. BIP-32 (2012, by Pieter Wuille) fixed that with a tree: one master seed deterministically grows as many keys as you like. Back up once, recover everything.

To build the tree, the seed goes through HMAC-SHA512. The left half becomes the master private key and the right half becomes the chain code, extra entropy used to derive children. Bitcoin and Ethereum use the key text Bitcoin seed, while ed25519 chains like Solana use ed25519 seed through SLIP-0010, which only allows hardened children. That is why every part of a Solana path ends with an apostrophe.

A derivation path is the address of a key inside the tree:

m / purpose' / coin_type' / account' / change / address_index
Part Meaning
m The root of the tree
purpose' 44' means the BIP-44 standard
coin_type' 0' Bitcoin, 60' Ethereum, 501' Solana
account' Account number, starting at 0'
change 0 for receiving, 1 for change (mostly Bitcoin)
address_index Which address under that account

Ethereum wallets usually use m/44'/60'/0'/0/i, and Solana wallets like Phantom and Backpack use m/44'/501'/i'/0'.

Here is the fun part: one phrase, two chains.

import { mnemonicToSeedSync } from "bip39";
import { derivePath } from "ed25519-hd-key";
import { Keypair } from "@solana/web3.js";
import { HDNodeWallet } from "ethers";
 
const phrase =
  "test test test test test test test test test test test junk"; // demo phrase, never use it for real funds
const seed = mnemonicToSeedSync(phrase);
 
// Solana: three accounts from one phrase
for (let i = 0; i < 3; i++) {
  const { key } = derivePath(`m/44'/501'/${i}'/0'`, seed.toString("hex"));
  console.log(`SOL ${i}:`, Keypair.fromSeed(key).publicKey.toBase58());
}
 
// Ethereum: the first account from the same phrase
const eth = HDNodeWallet.fromPhrase(phrase, undefined, "m/44'/60'/0'/0/0");
console.log("ETH 0:", eth.address);

Run it twice and you get the same addresses both times. That determinism is the whole point.

Ethereum in five minutes

Bitcoin is brilliant at one job: being scarce digital money. Its scripting is deliberately limited, so things like stablecoins, lending or token swaps do not fit natively. Between 2011 and 2014, people kept launching one new chain per use case, each with its own network, security and community.

Ethereum changed the question. Vitalik Buterin's whitepaper (late 2013), the crowdsale (2014) and the launch (July 2015) gave us one general purpose chain that anyone can program.

A smart contract is a program stored on the chain and run by every node. Once deployed, its code is public, it runs exactly as written, and nobody can quietly switch it off. Contracts are usually written in Solidity, compiled to bytecode, and executed by the Ethereum Virtual Machine. Users pay gas to run them, which pays for computation and stops infinite loops and spam.

There are two kinds of accounts:

  • Externally owned accounts (EOAs): controlled by a private key. Your normal wallet.
  • Contract accounts: controlled by code. They hold balance and storage, and act only when called.

Because contracts can call each other, DeFi apps snap together like money legos. Uniswap is the classic example: no company matches orders, just contracts holding token pools and a pricing formula. Anyone can swap, and anyone can add liquidity to earn fees.

One update: since the Merge in September 2022, Ethereum uses proof of stake, so validators replace miners. The EVM stayed the same.

What is a dApp?

A dApp keeps its core logic on a blockchain instead of on one company's servers. Compared to a normal app:

  • The backend is a smart contract (a program on Solana).
  • The database is the chain state.
  • The identity is a wallet address, not an email and password.
  • The frontend is still a normal web or mobile app.

Solana is built for speed and low cost. It mixes proof of stake with Proof of History, a verifiable clock that helps validators agree on order. Its design also separates code from data: programs are mostly stateless, the data lives in separate accounts, and every transaction lists the accounts it will touch. Because the runtime knows that up front, transactions that do not overlap can run in parallel. The base fee is 5,000 lamports per signature, which is 0.000005 SOL.

Category Example
DEX and AMM Raydium
Swap aggregator Jupiter
NFT marketplace Magic Eden
Perpetuals Drift
Liquid staking Sanctum

To build one, you need three pieces: a program (Rust, often with the Anchor framework), a client library in TypeScript that builds and sends transactions, and a frontend in React or Next.js. Two more things sit between your frontend and the chain, a wallet and an RPC server:

How a dApp talks to a wallet, an RPC server and Solana

Wallets: extensions, hardware and trust

A wallet extension (MetaMask, Phantom, Backpack) keeps your keys on your device and signs for you. A dApp never sees your private key. It sends a signing request, you read it, the extension signs locally, and only the signed result goes back. Extensions expose a standard interface so any dApp can offer "Connect Wallet": window.ethereum on Ethereum (EIP-1193 and EIP-6963) and the Wallet Standard on Solana.

Can you fully trust it? No, and that is worth knowing. In August 2022, the Slope wallet sent sensitive data, including seed phrases, to a logging service in plain text, and thousands of wallets were drained. Here is the write-up from Sentry. Open source code, audits, updates and official download links all lower the risk.

A hardware wallet (Ledger, Trezor) keeps keys inside a tamper resistant chip. The extension becomes only an interface: it sends the transaction to the device, you check it on the device screen, press a button, and only the signature comes back. It moves trust rather than removing it, since you now trust the vendor's firmware and supply chain. Also watch out for blind signing, where the device cannot decode a transaction and shows only a hash.

Multisigs: no single point of failure

A multisig needs M of N approvals before anything happens, for example 2 of 3. One stolen key, one lost device or one dishonest person is not enough to move funds. DAOs, protocol teams and foundations hold treasuries this way.

A good habit is to spread signers across different devices, brands and people, so a flaw in any one of them cannot sink the group. On Solana, tools like Squads and Realms work through on chain programs: the funds sit in an account the program controls, proposals collect signatures, and once the threshold is reached the program executes. On Ethereum the common tool is Safe. Teams also use multisigs to guard program upgrade authority, so no single developer can silently change a live contract.

A related idea is MPC wallets, which split one key into shares so nobody ever holds the whole thing. The goal is similar, but the work happens off chain and the result looks like a normal single signature.

RPC servers: the API of the chain

RPC means Remote Procedure Call: one program asks another to run a function and return the result. In web3 your app says, "Hey Solana node, fetch this data or send this transaction." Running a full validator is heavy, so apps talk to an RPC server, a node that already has the data and exposes it over HTTP and WebSocket. Your wallet, frontend and backend all use one constantly.

Method What it does
getBalance SOL balance of an address
getAccountInfo Data and metadata stored in an account
getProgramAccounts All accounts owned by a program
getLatestBlockhash Recent blockhash needed to build a transaction
simulateTransaction Dry run without committing
sendTransaction Submit a signed transaction

You can try it with plain curl on devnet:

curl https://api.devnet.solana.com \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getLatestBlockhash"}'

A few things to remember:

  • Public endpoints are rate limited. Real apps use providers like Helius, QuickNode, Triton or Alchemy, or run their own nodes.
  • Solana has mainnet-beta (real funds), devnet (free test SOL) and testnet (mostly for validators). Build on devnet first.
  • Commitment levels are processed (fastest), confirmed (supermajority voted) and finalized (cannot roll back). The wrong level causes confusing bugs.
  • Your RPC provider sees which addresses you query, so simulate transactions before signing anything important.

Mini project: a tiny devnet wallet

Let me put it all together in about 30 lines. This derives two accounts from one phrase, asks devnet for free SOL, and sends a little between them. It uses devnet only, so nothing here is real money.

import {
  Connection,
  Keypair,
  LAMPORTS_PER_SOL,
  SystemProgram,
  Transaction,
  sendAndConfirmTransaction,
} from "@solana/web3.js";
import { generateMnemonic, mnemonicToSeedSync } from "bip39";
import { derivePath } from "ed25519-hd-key";
 
const connection = new Connection("https://api.devnet.solana.com", "confirmed");
const seed = mnemonicToSeedSync(generateMnemonic());
 
function account(i: number) {
  const { key } = derivePath(`m/44'/501'/${i}'/0'`, seed.toString("hex"));
  return Keypair.fromSeed(key);
}
 
const [alice, bob] = [account(0), account(1)];
 
// 1. Ask devnet for 1 SOL and wait for it
const sig = await connection.requestAirdrop(alice.publicKey, LAMPORTS_PER_SOL);
const latest = await connection.getLatestBlockhash();
await connection.confirmTransaction({ signature: sig, ...latest });
 
// 2. Alice sends 0.1 SOL to Bob, signing locally
const tx = new Transaction().add(
  SystemProgram.transfer({
    fromPubkey: alice.publicKey,
    toPubkey: bob.publicKey,
    lamports: LAMPORTS_PER_SOL / 10,
  }),
);
await sendAndConfirmTransaction(connection, tx, [alice]);
 
// 3. Read both balances back through the RPC server
for (const [name, kp] of [["alice", alice], ["bob", bob]] as const) {
  const lamports = await connection.getBalance(kp.publicKey);
  console.log(name, lamports / LAMPORTS_PER_SOL, "SOL");
}

Run it with npx tsx wallet.ts. If the airdrop fails, the devnet faucet is rate limited, so wait a minute and try again. Every idea from this post shows up: a mnemonic, a seed, derivation paths, local signing, an RPC server and a transaction on a real network.

Putting it together

Here is one swap on a Solana DEX, start to finish:

  1. Your wallet made a mnemonic, a seed and keys along a path like m/44'/501'/0'/0'.
  2. You open a dApp and press Connect Wallet. It only receives your public key.
  3. You press Swap. The client library asks an RPC server for the latest blockhash and account data, then builds the transaction.
  4. Your wallet shows it. You approve, and it signs locally.
  5. The signed transaction travels through the RPC server to validators, who run the program.
  6. The RPC server reports the result and the dApp updates your balance.
  7. If the team upgrades the protocol later, a multisig makes sure nobody does it alone.

Security checklist, short and sweet:

  • Never share your mnemonic or type it into a website.
  • Write it on paper or metal, and keep it offline in more than one safe place.
  • Use a hardware wallet for meaningful amounts and a multisig for shared funds.
  • Keep a small hot wallet for daily use and a separate cold wallet for savings.
  • Read what you sign. If a request looks unexpected, reject it.
  • Install wallets only from official links.

Further reading

This post is for learning, not financial or security advice. Test with small amounts first.


Last updated: October 2, 2026

Enjoyed this? Let's talk

I write about backend, engineering and web3 as I learn them. Always happy to compare notes.

Keep reading