<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Allan Githaiga</title>
    <description>The latest articles on DEV Community by Allan Githaiga (@githaiga22).</description>
    <link>https://dev.to/githaiga22</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1522828%2Feaf789a6-0571-478a-bf0a-d1047d0b1ccd.png</url>
      <title>DEV Community: Allan Githaiga</title>
      <link>https://dev.to/githaiga22</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/githaiga22"/>
    <language>en</language>
    <item>
      <title>How I connected a React frontend to an ink! smart contract using Polkadot-API (PAPI)</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Sat, 27 Sep 2025 04:29:56 +0000</pubDate>
      <link>https://dev.to/githaiga22/how-i-connected-a-react-frontend-to-an-ink-smart-contract-using-polkadot-api-papi-4lgl</link>
      <guid>https://dev.to/githaiga22/how-i-connected-a-react-frontend-to-an-ink-smart-contract-using-polkadot-api-papi-4lgl</guid>
      <description>&lt;p&gt;&lt;strong&gt;👋 Hey builders,&lt;/strong&gt;&lt;br&gt;
Have you ever tried connecting a frontend to a blockchain contract and felt like you were solving a Rubik’s cube in the dark? Yeah… me too. 😅&lt;/p&gt;

&lt;p&gt;That’s why I wrote this guide, to walk you step-by-step through how I managed to connect a React + Vite frontend to an ink! smart contract using PAPI (Polkadot-API). &lt;br&gt;
&lt;strong&gt;Spoiler alert:&lt;/strong&gt; once I figured out the workflow, it felt less like rocket science and more like following a recipe. 🚀✨&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why this guide?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of drowning in docs and scattered tutorials, I wanted a single walkthrough that shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;How to build &amp;amp; deploy an ink! contract.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to generate type-safe bindings with PAPI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to make a frontend talk to the contract through a wallet.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’ve been curious about ink! + PAPI but don’t know where to start, this article is for you. 🙌&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxjsfd6qsa0edk61b6ysd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxjsfd6qsa0edk61b6ysd.png" alt="lock in" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Why PAPI?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Polkadot-API&lt;/strong&gt; (PAPI) is the modern, modular JavaScript/TypeScript SDK for building dApps in the Polkadot ecosystem. It provides strong TypeScript support, a light-client-first approach, and SDKs (including an Ink! SDK) that generate typed bindings from contract metadata — making contract interactions safer and easier to write.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I built&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A small dApp that::&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Connects to a browser wallet (Polkadot.js / Talisman).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reads the current counter value (read-only query).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Increments or decrements the counter (signed transaction).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The contract metadata is included in the repo and PAPI generated TypeScript descriptors were used to produce strongly typed calls.&lt;/p&gt;
&lt;h2&gt;
  
  
  Steps I followed (practical)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Build the ink! contract&lt;/strong&gt;&lt;br&gt;
Install &lt;code&gt;cargo-contract&lt;/code&gt; and build:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cargo install cargo-contract --force
cargo contract build --release

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This produces the &lt;code&gt;.contract&lt;/code&gt; artifact and metadata required by PAPI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Generate PAPI descriptors from the &lt;code&gt;.contract&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I used the PAPI CLI to add my chain and the contract metadata:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pnpm papi ink add -k counter ./contracts/counter.contract
pnpm papi generate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generates typed descriptors in frontend/.papi/ which are importable in the frontend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Frontend: create client &amp;amp; Ink SDK&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;src/papiClient.ts&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createClient } from "polkadot-api";
import { withPolkadotSdkCompat } from "polkadot-api/polkadot-sdk-compat";
import { getWsProvider } from "polkadot-api/ws-provider/web";
import { createInkSdk } from "@polkadot-api/sdk-ink";
import { contracts } from "@polkadot-api/descriptors";

const client = createClient(
  withPolkadotSdkCompat(getWsProvider("wss://westend-rpc.polkadot.io"))
);

const inkSdk = createInkSdk(client.getTypedApi("westend"), contracts.counter);

export { inkSdk };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives typed, chain-aware contract helpers. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Wallet connection &amp;amp; signer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I used PAPI’s &lt;code&gt;pjs-signer&lt;/code&gt; helpers to connect the Polkadot.js/Talisman extension and obtain a &lt;code&gt;polkadotSigner&lt;/code&gt; to sign transactions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { getInjectedExtensions, connectInjectedExtension } from "polkadot-api/pjs-signer";
const exts = getInjectedExtensions();
const selected = await connectInjectedExtension(exts[0]); // choose extension
const accounts = selected.getAccounts();
const signer = accounts[0].polkadotSigner;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The signer implements the &lt;code&gt;PolkadotSigner&lt;/code&gt; interface that PAPI methods accept.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Query and send&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using the Ink SDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const instance = inkSdk.getContract(CONTRACT_ADDRESS);

// Query counter
const current = await instance.query("get", { origin: accounts[0].address });
console.log("Counter value:", current.output);

// Increment
await instance.send("increment", { origin: accounts[0].address })
  .signAndSubmit(signer);

// Decrement
await instance.send("decrement", { origin: accounts[0].address })
  .signAndSubmit(signer);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The SDK exposes &lt;code&gt;.query(...)&lt;/code&gt; and &lt;code&gt;.send(...).signAndSubmit(...)&lt;/code&gt;, very helpful for dry-runs and signed transactions. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final notes &amp;amp; tips&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use the generated descriptors, they save time and reduce errors. &lt;br&gt;
papi.how&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Always use dry-runs &lt;code&gt;(.query()&lt;/code&gt; or &lt;code&gt;.dryRun())&lt;/code&gt; before sending signed txs to check gas/storage cost. &lt;br&gt;
papi.how&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Do not commit &lt;strong&gt;private keys&lt;/strong&gt; to the repo; use browser wallets for signing. &lt;br&gt;
papi.how&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Links &amp;amp; resources&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;PAPI docs &amp;amp; guide (Polkadot Developer Docs). &lt;br&gt;
&lt;a href="https://docs.polkadot.com/develop/toolkit/api-libraries/papi/" rel="noopener noreferrer"&gt;docs.polkadot.com&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PAPI ink! guide (codegen &amp;amp; usage). &lt;br&gt;
&lt;a href="https://papi.how/ink/" rel="noopener noreferrer"&gt;papi.how&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ink! SDK docs (createInkSdk, getDeployer, getContract). &lt;br&gt;
&lt;a href="https://papi.how/sdks/ink-sdk/" rel="noopener noreferrer"&gt;papi.how&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Signers / pjs-signer usage. &lt;br&gt;
&lt;a href="https://papi.how/signers/" rel="noopener noreferrer"&gt;papi.how&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cargo contract build (ink! docs). &lt;br&gt;
&lt;a href="https://use.ink/docs/v5/getting-started/building-your-contract" rel="noopener noreferrer"&gt;ink!&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Vercel &amp;amp; Netlify deploy docs. &lt;br&gt;
&lt;a href="https://vercel.com/docs/deployments" rel="noopener noreferrer"&gt;Vercel&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr1lnavrk2mc7ud6ox1ab.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr1lnavrk2mc7ud6ox1ab.png" alt="Am done" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>web3</category>
      <category>tutorial</category>
      <category>react</category>
    </item>
    <item>
      <title>🧠 Understanding Ethereum: EVM, Blocks, Gas, Accounts &amp; Transactions Explained</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Thu, 17 Jul 2025 14:27:09 +0000</pubDate>
      <link>https://dev.to/githaiga22/understanding-ethereum-evm-blocks-gas-accounts-transactions-explained-54i9</link>
      <guid>https://dev.to/githaiga22/understanding-ethereum-evm-blocks-gas-accounts-transactions-explained-54i9</guid>
      <description>&lt;p&gt;Ethereum is more than just transfers of ETH — it’s a decentralized global computer powered by nodes and fueled by gas. Let’s break down its core components to help you grasp why it works the way it does.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔍 1. The Ethereum Virtual Machine (EVM)
&lt;/h2&gt;

&lt;p&gt;What it is: The EVM is the runtime engine powering Ethereum, a virtual CPU that runs smart contracts and processes transactions.&lt;/p&gt;

&lt;p&gt;Why it matters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It ensures every node executes code deterministically, so all states stay in sync.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It supports a defined set of opcodes (like ADD, JUMP, SLOAD), with each costing gas based on the amount of computation required .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;br&gt;
Think of Ethereum as a massive online code playground, and the EVM as the consistent engine that runs your code—even on someone else’s computer. Every time you press "execute," it runs exactly the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⛓️ 2. Blocks: Ethereum’s Time Capsules
&lt;/h2&gt;

&lt;p&gt;What it is: Ethereum groups transactions into blocks, each containing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Block number, timestamp&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Gas limit (cap for total gas used) &amp;amp; gas used&lt;/p&gt;

&lt;p&gt;Transaction list, Merkle roots, parent hash, and proposer’s signature.&lt;br&gt;
&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Blocks batch transactions to maintain consensus across nodes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each block advances the state, forming a permanent ledger of changes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Blocks are like train cars, each carrying multiple passenger transactions and connected to the previous one to form a train—a never-ending ride.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⛽ 3. Gas: Ethereum’s Fuel Meter
&lt;/h2&gt;

&lt;p&gt;What it is: Gas measures how much computation you're using. Every EVM opcode requires a specific gas amount .&lt;br&gt;
Why we pay gas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It prevents spam and infinite loops.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It pays validators for computation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It ensures execution stays deterministic and bounded.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Gas Units vs. Gwei:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Gas units = computational steps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Gwei = 10⁻⁹ ETH, used to price each gas unit.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🧠 Example with Analogy:&lt;/strong&gt;&lt;br&gt;
Imagine riding a motorbike:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Distance = gas units&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fuel price per km = base fee + priority tip&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You load your bike with just enough fuel (gas limit) and tip for priority service (priority fee).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧮 4. Accounts: EOAs vs. Contract Accounts
&lt;/h2&gt;

&lt;p&gt;Ethereum has two account types&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. EOA (Externally Owned Account)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Controlled by a private key&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can initiate transactions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No code, just ETH balance&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Contract Account&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Live code at an address&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can store data, and run logic when triggered&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cannot initiate transactions—EOAs must call them&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;br&gt;
EOAs are like people with wallets, while contract accounts are like vending machines: they respond to your actions, they can hold funds, but they don’t make moves on their own.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 5. Transactions: State-Changing Actions
&lt;/h2&gt;

&lt;p&gt;What they are: The only way to change Ethereum’s state (send ETH, create contracts, interact with smart contracts).&lt;/p&gt;

&lt;p&gt;Transaction content includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;from, to, value, nonce&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;gasLimit, maxFeePerGas, maxPriorityFeePerGas&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;data (optional), signature components&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Stages of a transaction:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Signed by your private key&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Broadcast to mempool&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Picked by a validator&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Executed, state updated, included in a block&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Block finalized—permanent record&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;br&gt;
Think of it like ordering at a busy coffee shop:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You put in your order (transaction)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It goes on the queue (mempool)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A barista (validator) makes it (executes)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You wait until they confirm your order is done (block inclusion)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You finally drink it when it’s served (finalization)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔄 Recap Table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;What It Does&lt;/th&gt;
&lt;th&gt;Why It Matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;EVM&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Runs smart contract bytecode&lt;/td&gt;
&lt;td&gt;Ensures consistent behavior across all nodes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Blocks&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Batch transactions into permanent records&lt;/td&gt;
&lt;td&gt;Maintain global state and ledger&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Gas&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Measures computation, controls use&lt;/td&gt;
&lt;td&gt;Prevents abuse, rewards validators&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;EOA&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;User-controlled account with balance&lt;/td&gt;
&lt;td&gt;Initiate transactions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Contract&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Code and state living on-chain&lt;/td&gt;
&lt;td&gt;Enables programmable logic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Transaction&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Signed messages changing state&lt;/td&gt;
&lt;td&gt;The only way to interact with Ethereum&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  🎯 Why This Matters
&lt;/h2&gt;

&lt;p&gt;By understanding these pillars:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You’ll optimize gas usage&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid common errors like low gas limits&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build or interact with contracts more confidently&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Understand transaction lifecycles and how fees work&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>What the Heck Are EIPs and ERCs? A Beginner’s Guide to 4 Ethereum Upgrades You’ve Never Heard Of</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Wed, 16 Jul 2025 13:05:40 +0000</pubDate>
      <link>https://dev.to/githaiga22/what-the-heck-are-eips-and-ercs-a-beginners-guide-to-4-ethereum-upgrades-youve-never-heard-of-c75</link>
      <guid>https://dev.to/githaiga22/what-the-heck-are-eips-and-ercs-a-beginners-guide-to-4-ethereum-upgrades-youve-never-heard-of-c75</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;They might not trend on Crypto Twitter—but without them, Ethereum wouldn't run this smooth. - Allan Robinson&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  🧭 What Are EIPs and ERCs?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;EIPs (Ethereum Improvement Proposals)&lt;/strong&gt; are Ethereum’s official feature requests or improvements, typically targeting protocol-level changes (e.g., transaction formats, gas fees).&lt;br&gt;
&lt;strong&gt;ERCs (Ethereum Request for Comments)&lt;/strong&gt; are a subset of EIPs focused on smart contract standards, used to ensure compatible interfaces across dApps.&lt;/p&gt;

&lt;p&gt;They emerged as community-driven blueprints to evolve Ethereum in a consistent, transparent, and coordinate-driven way.&lt;/p&gt;

&lt;h2&gt;
  
  
  📜 History &amp;amp; Impact
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The EIP process began with EIP-1 in 2015 to formalize how Ethereum should evolve.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Early successful proposals like EIP-20 (ERC-20) established core patterns for the ecosystem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Over time, new needs arose: better transaction gas efficiency, clearer contract interoperability, and fairer developer incentives.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Thanks to EIPs and ERCs, Ethereum continues to grow backward-compatible while integrating new features without breaking older systems.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🛠️ Deep Dive into 4 Selected Standards
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. EIP‑2930: Access Lists (Core / Transaction Format)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;🔍 Overview&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Introduced in Berlin (2020) as part of a suite addressing storage cost spikes (alongside EIP-2929)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lets you pre-declare which contract addresses/storage slots your tx will access.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Those slots are “pre-warmed” at lower cost, avoiding high “cold” access charges.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ✅ Benefits
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Saves ~200 gas per storage access&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reduces volatility and DoS attack risk from expensive cold storage.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ❌ Drawbacks
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Requires users/devs to predict exactly which slots will be used—mistakes can cost more gas than savings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adoption has been low: just ~1.5% of txs use it despite 42% potential benefit&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ⚙️ Analogy
&lt;/h4&gt;

&lt;p&gt;Think of it like a grocery preorder: tell the store what you’ll need in advance and skip checkout lines—but if you order the wrong things, you wasted time and money.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. EIP‑7547: Inclusion Lists (Core / Block Assembly)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  🔍 Overview
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new proposal letting block proposers force inclusion of specific transactions in a block, reducing censorship&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Especially useful for front-running, MEV-resistant applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ✅ Benefits
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Enhances fairness and censorship resistance in the mempool.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Empowers transaction originators to battle MEV-based exclusion.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ⚠️ Considerations
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Still under development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Needs client &amp;amp; tooling support to become practical.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ⚙️ Analogy
&lt;/h4&gt;

&lt;p&gt;It’s like a VIP pass for users who want to ensure their ticket gets scanned even during rush hour.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. ERC‑165: Interface Detection (Contract Interface Standard)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  🔍 Overview
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Standardizes how contracts announce which interfaces they implement—used widely since 2018&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Contracts implement supportsInterface(bytes4 interfaceID) so others can detect capabilities.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ✅ Benefits
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Enables dynamic compatibility checks for wallets/dApps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoids hard-coded assumptions, reducing risk of breakage.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ❌ Drawbacks
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Needs explicit implementation—some contracts skip it to save gas.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Only covers declared interfaces; doesn’t guarantee full compliance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ⚙️ Analogy
&lt;/h4&gt;

&lt;p&gt;Like a software installer that checks if your system supports .NET 6 before installation—no surprises later.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. EIP‑6969: Revenue-Sharing Contracts (ERC – Token &amp;amp; Wallet Standard)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  🔍 Overview
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A new proposal for sharing transaction fees (beyond ETH’s built-in burn/tip) with contract creators&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Users opt-in to send a developer fee to the dApp creator on each use.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  ✅ Benefits
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Creates an incentive model for public dApps to be sustainable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Offers an optional “tip” model for open-source contract authors.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ⚠️ Controversies
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;May discourage usage if tips are high.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Needs to balance opt-in vs auto-fee structures.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  ⚙️ Analogy
&lt;/h4&gt;

&lt;p&gt;Like paying 10% tip for offline delivery services you trust—optional but appreciated.&lt;/p&gt;

&lt;h2&gt;
  
  
  📊 Comparison Table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;EIP/ERC&lt;/th&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;th&gt;Adoption Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;EIP‑2930&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Core / Tx&lt;/td&gt;
&lt;td&gt;Improve gas for predefined access&lt;/td&gt;
&lt;td&gt;Low adoption (~1.5%)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;EIP‑7547&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Core / Blocks&lt;/td&gt;
&lt;td&gt;Censorship resistance via inclusion lists&lt;/td&gt;
&lt;td&gt;Early draft&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ERC‑165&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Interface&lt;/td&gt;
&lt;td&gt;Standard method to declare support&lt;/td&gt;
&lt;td&gt;Widely adopted (NFTs, tokens)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;EIP‑6969&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;ERC / Payments&lt;/td&gt;
&lt;td&gt;Revenue-sharing tips to contract authors&lt;/td&gt;
&lt;td&gt;Emerging interest&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  🔍 Final Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Access Lists (EIP‑2930) streamline gas costs—but you must think ahead.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inclusion Lists (EIP‑7547) will help fairness in transaction ordering, ideal for censor-resistant apps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ERC‑165 remains vital for automatic interface compatibility, powering wallet and dApp integrations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Revenue-sharing (EIP‑6969) introduces an open tipping model, potentially sustaining free-to-use contracts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🎯 Why These Matter for Beginners
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Understanding why these standards were invented helps future developers reason about protocol design and usability, not just code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Seeing each EIP as a solution to a real problem—gas costs, censorship, interface detection, developer sustainability—makes you think like a protocol designer.&lt;/li&gt;
&lt;li&gt;Analogies keep concepts memorable and relatable.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Standards aren’t just code—they shape how Ethereum grows. - Allan Robinson&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>🚀 Unlocking Ethereum: From Magic Money to Math-Powered Machines</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Sat, 12 Jul 2025 18:46:39 +0000</pubDate>
      <link>https://dev.to/githaiga22/unlocking-ethereum-from-magic-money-to-math-powered-machines-2fg</link>
      <guid>https://dev.to/githaiga22/unlocking-ethereum-from-magic-money-to-math-powered-machines-2fg</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Not all computers live in your house. Some live everywhere."&lt;/strong&gt; — &lt;em&gt;Allan Robinson&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  🙋 Hey there, curious builder!
&lt;/h2&gt;

&lt;p&gt;If you’ve been following along on this journey from Chapter 1 to Chapter 4 of the Ethereum Book, congratulations! You’ve taken your first real steps into understanding what makes Ethereum the beating heart of the Web3 revolution. But now, let’s tie it all together.&lt;/p&gt;

&lt;p&gt;This article will serve as your grand recap. We’ll walk back through the major milestones you’ve hit — from installing MetaMask to unraveling the mathematical magic behind Ethereum addresses. But we’re going deeper this time, with clear explanations, descriptive breakdowns, and some jokes and analogies to make it fun.&lt;/p&gt;

&lt;h3&gt;
  
  
  🌍 Chapter 1: Ethereum — The Decentralized World Computer
&lt;/h3&gt;

&lt;p&gt;Ethereum is not just a cryptocurrency.&lt;br&gt;
It’s a decentralized world computer, where code is law and contracts live forever.&lt;/p&gt;

&lt;p&gt;Imagine the internet, but with programmable money and no central administrator.&lt;br&gt;
That’s Ethereum.&lt;/p&gt;

&lt;p&gt;In this chapter, we:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Installed MetaMask, your Web3 portal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Created a wallet (a safe for your digital coins).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Funded it using a testnet faucet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sent and received Ether — the fuel of Ethereum.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Think of Ether as gas in a car. Ethereum is the engine. Smart contracts are the destination."&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ethereum allows anyone to deploy smart contracts — bits of code that live and operate independently on the blockchain. These contracts can't be tampered with once deployed. That’s a game-changer for trust, accountability, and decentralization.&lt;/p&gt;

&lt;h3&gt;
  
  
  💰 Chapter 2: Wallets, Contracts, and the Machine Brain
&lt;/h3&gt;

&lt;p&gt;Once your MetaMask wallet was ready, you discovered two types of accounts:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🪖 Externally Owned Accounts (EOAs):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Controlled by private keys.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can initiate transactions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;These are your regular wallet accounts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🧰 Contract Accounts:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Controlled by code, not keys.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can hold Ether and respond to transactions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cannot initiate transactions but can react to them.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We even wrote our first smart contract: Faucet.sol.&lt;/p&gt;

&lt;p&gt;It allowed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Users to withdraw up to 0.1 ETH.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Anyone to send ETH to it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You deployed it on a testnet using Remix IDE.&lt;/p&gt;

&lt;p&gt;This was your first encounter with the Ethereum Virtual Machine (EVM) — the brain that runs all smart contracts in the Ethereum world. Think of it as a global computer made up of thousands of nodes all syncing together.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔐 Chapter 3 &amp;amp; 4: Cryptography — Ethereum’s Security Backbone
&lt;/h3&gt;

&lt;p&gt;Ethereum is secure by math, not by secrecy.&lt;/p&gt;

&lt;p&gt;This is where things got spicy.&lt;br&gt;
We talked cryptography — the silent engine that makes Ethereum work.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Cryptography doesn’t hide data, it proves truths.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We explored:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Public key cryptography (asymmetric cryptography).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Digital signatures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Trapdoor functions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Elliptic curve cryptography.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🔑 Private Keys:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A private key is just a really big random number.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It gives you control over your Ethereum wallet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It must NEVER be shared. Sharing your private key = giving away your money.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Your private key is your soul. Lose it, and your crypto reincarnates into someone else's wallet."&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;👁‍🗨️ Public Keys:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Derived from the private key using elliptic curve multiplication.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can be shared. They help the world recognize your account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Used to verify digital signatures.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🔹 Ethereum Addresses:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Shortened versions of the public key (via hashing).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Every wallet has one (e.g., 0xabc123...).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Acts like a username for the blockchain.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Together, these elements enable secure, verifiable ownership of funds without any central authority.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔹 The Discrete Logarithm Problem &amp;amp; Elliptic Curve Math
&lt;/h3&gt;

&lt;p&gt;Ethereum uses a form of math called Elliptic Curve Cryptography (ECC) over a curve known as secp256k1.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Private Key k is a number.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multiply it with a point G on the curve: k * G = K, the Public Key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can go from private to public, but NOT the reverse. Why?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because that would involve solving the Discrete Logarithm Problem.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"It’s like trying to unblend a smoothie. Good luck getting that one blueberry back."&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This one-way math gives us digital signatures and the ability to prove ownership without revealing secrets.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✨ The Magic of Digital Signatures
&lt;/h3&gt;

&lt;p&gt;Every Ethereum transaction is a message signed with your private key.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The network can verify:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Who sent it (via public key).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;That the message wasn’t altered (hash matching).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That it came from a valid source.&lt;/p&gt;

&lt;p&gt;But it can do all this without knowing the private key itself. Pure cryptographic sorcery.&lt;/p&gt;

&lt;h2&gt;
  
  
  💜 Why This All Matters
&lt;/h2&gt;

&lt;p&gt;This system allows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Peer-to-peer payments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Smart contract execution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fully decentralized apps (dApps).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A global trustless economy.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All without:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Banks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Passwords.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Centralized control.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You now understand how your Ethereum wallet works, how transactions are signed, and why no one can just "guess" your key.&lt;/p&gt;

&lt;p&gt;And that, my friend, is the magic behind the Ethereum World Computer.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎉 What’s Next?
&lt;/h2&gt;

&lt;p&gt;You’ve just finished the foundation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Ethereum basics&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wallets and contracts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cryptography, private keys, and addresses&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Up next? We dive deeper:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Solidity smart contracts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Gas optimization&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attacks &amp;amp; defenses&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The move to Proof of Stake&lt;/p&gt;

&lt;p&gt;So stay curious. Keep coding. And never share your private key.&lt;/p&gt;

&lt;p&gt;See you on-chain.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🔐 Cryptography in Ethereum</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Sat, 12 Jul 2025 16:12:36 +0000</pubDate>
      <link>https://dev.to/githaiga22/cryptography-in-ethereum-g21</link>
      <guid>https://dev.to/githaiga22/cryptography-in-ethereum-g21</guid>
      <description>&lt;p&gt;Cryptography is one of the most important technologies behind Ethereum and other blockchains. Even though it sounds complicated, at its heart, it’s all about keeping things secure, proving ownership, and ensuring data can’t be faked or tampered with.&lt;/p&gt;

&lt;p&gt;Let’s break down what cryptography means in the Ethereum world — in the simplest terms possible.&lt;/p&gt;

&lt;h2&gt;
  
  
  📘 What Is Cryptography?
&lt;/h2&gt;

&lt;p&gt;Cryptography comes from a Greek word meaning “secret writing”. It’s the study of how to secure information using math. But it’s not just about hiding things — it also helps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prove something is true without showing it (like proving you know a password without telling it).&lt;/li&gt;
&lt;li&gt;Prove data is authentic (like checking a digital fingerprint).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ethereum does not use encryption to hide messages — everything is open and visible so the network can agree on the correct state. But it does use cryptography to verify and secure who owns what.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔑 Keys and Addresses
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;🧍‍♂️ Accounts in Ethereum&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are two main types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;EOAs (Externally Owned Accounts) — controlled by private keys (what users use).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Smart Contracts — code-based accounts that live on Ethereum.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every EOA has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A private key — a secret number that proves control.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An Ethereum address — a public identity others can see.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of it like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Your address is your bank account number (public).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your private key is your ATM PIN (secret).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can’t get someone’s private key by looking at their address. But if you have the private key, you control the account and the funds in it.&lt;/p&gt;

&lt;h3&gt;
  
  
  🖋️ Digital Signatures: Proving Ownership
&lt;/h3&gt;

&lt;p&gt;Every transaction on Ethereum must be signed using the private key. This creates a digital signature, which proves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The transaction is authentic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It could only have come from the person who owns the private key.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This signature is then verified by others using your public key (or Ethereum address). The private key is never shared — it stays hidden.&lt;br&gt;
So, when you send ETH:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You sign the transaction with your private key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The network checks the signature against your address.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If it matches —  the transaction is valid!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  🧠 How Do Private and Public Keys Work?
&lt;/h3&gt;

&lt;p&gt;Ethereum uses a form of cryptography called Public Key Cryptography, also known as Asymmetric Cryptography.&lt;/p&gt;

&lt;p&gt;This system uses two keys:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A private key (kept secret).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A public key (shared openly).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The cool part is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You can generate the public key from the private key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;But you can’t go backwards — it’s mathematically impossible to figure out the private key from the public key.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This one-way math is what makes Ethereum secure.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔢 What Is a Private Key?
&lt;/h2&gt;

&lt;p&gt;A private key is just a very large random number — but a very important one!&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;f8f8a2f43c8376ccb0871305060d7b27b0554d2cc72bccf41b2705608452f315
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It controls your funds. If someone else gets it, they can steal your ETH. If you lose it, your ETH is gone forever — no password resets in crypto!&lt;/p&gt;

&lt;p&gt;That’s why wallet apps and hardware wallets help store and protect private keys safely.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎲 How Are Private Keys Generated?
&lt;/h2&gt;

&lt;p&gt;Generating a private key means picking a truly random number between &lt;strong&gt;1&lt;/strong&gt; and a huge number called &lt;strong&gt;2^256&lt;/strong&gt;. That’s a number with 77 digits — more than the number of atoms in the universe!&lt;/p&gt;

&lt;p&gt;Wallets usually use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Your mouse movements, or&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your keystrokes, or&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Other random inputs to generate a secure number.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s important that the random number is not predictable, or someone might guess it. Ethereum wallets use strong built-in random number generators to do this safely.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧮 What Is a Public Key?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;public key&lt;/strong&gt; is generated from the private key using elliptic curve multiplication. This is a kind of special math done on a curve called secp256k1.&lt;/p&gt;

&lt;p&gt;Let’s simplify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You start with your private key (a number).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You multiply it with a special constant point (called G).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The result is your public key — two coordinates (x, y) on a curve.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s the math (don’t worry if it looks scary):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Public Key = Private Key × Generator Point (G)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a one-way function — easy to do, impossible to reverse.&lt;/p&gt;

&lt;h2&gt;
  
  
  📮 Ethereum Addresses
&lt;/h2&gt;

&lt;p&gt;An Ethereum address is a shortened version of the public key. It's 40 characters long (20 bytes), usually written in hexadecimal.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;0x742d35Cc6634C0532925a3b844Bc454e4438f44e

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is what you share to receive ETH or tokens. It’s like your bank account number, but public.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✍️ Digital Signatures in Detail
&lt;/h3&gt;

&lt;p&gt;Let’s say Alice wants to send ETH:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;She creates a transaction with details like amount, recipient, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;She uses her private key to sign the transaction.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The signature is sent with the transaction to the Ethereum network.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Anyone can verify the signature using Alice’s address.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This proves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The transaction came from Alice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The transaction wasn’t tampered with.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Alice authorized the action.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No passwords, no usernames, just math.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔍 Is Ethereum Encrypted?
&lt;/h3&gt;

&lt;p&gt;No. Ethereum is not encrypted. Everything — including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Transactions,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Contract code,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Balances,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Messages,&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...is visible to everyone. This is necessary for transparency and trust — it allows everyone to verify what’s happening.&lt;/p&gt;

&lt;p&gt;In the future, Ethereum may use advanced cryptography like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Zero-Knowledge Proofs – to prove something without showing it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Homomorphic Encryption – to do computations on encrypted data.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But right now, Ethereum’s focus is on verification, not secrecy.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚨 Keep Your Private Key Safe!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Never share it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Never screenshot it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Always back it up safely (use hardware wallets or seed phrases).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you lose it, you lose access forever.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Cryptography might seem hard, but it powers everything in Ethereum — from &lt;strong&gt;accounts&lt;/strong&gt;, to &lt;strong&gt;transactions&lt;/strong&gt;, to &lt;strong&gt;smart contracts&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The most important things to remember:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Your private key = control over your ETH.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your signature = proof that you own it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your address = your identity on Ethereum.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With public key cryptography and smart math, Ethereum allows you to be your own bank — secure, open, and unstoppable.&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>solidity</category>
      <category>web3</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>⚖️ Proof of Stake Explained: Ethereum’s Guardians of the Blockchain</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Thu, 10 Jul 2025 15:02:45 +0000</pubDate>
      <link>https://dev.to/githaiga22/proof-of-stake-explained-ethereums-guardians-of-the-blockchain-fpn</link>
      <guid>https://dev.to/githaiga22/proof-of-stake-explained-ethereums-guardians-of-the-blockchain-fpn</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;"With great power comes great responsibility... and staking penalties." – Uncle Eth (probably)&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Welcome back Web3 explorers! Today, we dive into the magical realm of &lt;strong&gt;Proof of Stake (PoS)&lt;/strong&gt; — the mechanism that keeps Ethereum running smoothly, securely, and sustainably.&lt;/p&gt;

&lt;p&gt;Whether you're new to blockchain or just heard someone yell &lt;strong&gt;“slashing!”&lt;/strong&gt; on crypto Twitter, this article breaks down the what, why, and whoopsies of PoS — Ethereum's heart after the Merge.&lt;/p&gt;

&lt;h3&gt;
  
  
  🤔 What Is Proof of Stake (PoS)?
&lt;/h3&gt;

&lt;p&gt;Think of PoS like a blockchain boarding school — validators (Ethereum's new class prefects) are selected to propose blocks, check homework (aka validate blocks), and keep the system honest.&lt;/p&gt;

&lt;p&gt;But unlike Proof of Work (PoW), where miners solve complex puzzles, PoS chooses validators based on how much ETH they lock (stake). The more you stake, the higher your chances of being chosen to propose or attest to the next block.&lt;/p&gt;

&lt;p&gt;No pickaxes. Just ETH and good behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  🪙 Staking ETH: The Golden Entry Ticket
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To become a validator, you stake 32 ETH.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your ETH acts like a security deposit at an Airbnb — behave, and you’re good.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mess around? You could lose part (or all 😱) of your stake.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;🦊 Fun fact: You can use MetaMask + staking services to stake without running your own node!&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🏆 Rewards: The Carrot on the Stick
&lt;/h3&gt;

&lt;p&gt;Validators earn rewards by doing three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Proposing blocks&lt;/strong&gt; – Like writing the first draft of history.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Attesting to blocks&lt;/strong&gt; – Confirming someone else’s draft is good.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sync committee participation&lt;/strong&gt; – A random validator group that helps light clients stay in sync.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good behavior = sweet, sweet ETH rewards.&lt;br&gt;
 Rewards depend on how active the network is and how many validators are online.&lt;/p&gt;

&lt;h3&gt;
  
  
  🚨 Penalties: When Validators Go Rogue
&lt;/h3&gt;

&lt;p&gt;It’s not all sunshine and staking. There are penalties too!&lt;/p&gt;

&lt;h4&gt;
  
  
  😴 Inactivity Penalty
&lt;/h4&gt;

&lt;p&gt;Validators who stay offline too long start losing ETH. This prevents the network from stalling due to absentee validators.&lt;/p&gt;

&lt;h4&gt;
  
  
  🔪 Slashing
&lt;/h4&gt;

&lt;p&gt;The big no-no. If a validator tries to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Propose two blocks at the same time (double proposing)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Vote for two conflicting blocks (double voting)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Surround votes maliciously&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...they get slashed — a portion of their staked ETH is destroyed, and they’re kicked out of the validator set.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Slashing is like being expelled and fined at the same time.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Common Attacks by Validators (and How Ethereum Fights Back)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Long-Range Attacks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it is:&lt;/strong&gt; A validator tries to rewrite old blockchain history by proposing an alternative version of events from way back.&lt;/p&gt;

&lt;p&gt;Ethereum’s defense:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Clients ignore chains that don’t include recent checkpoint finality.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Checkpoints are final every ~12 minutes (2 epochs).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🛡️ TL;DR: Once history is “finalized,” it’s set in stone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Nothing-at-Stake Problem&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it is:&lt;/strong&gt; In PoW, miners have to choose one chain because mining costs resources. In PoS, lazy validators could vote on all chains, trying to game rewards.&lt;/p&gt;

&lt;p&gt;Ethereum’s defense:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Slashing validators for voting on multiple forks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attestations are tracked to punish “double dipping.”&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Censorship (Proposer Censorship)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it is:&lt;/strong&gt; Validators might refuse to include certain transactions (e.g. from specific users or smart contracts).&lt;/p&gt;

&lt;p&gt;Ethereum’s defense:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Proposer rotation – Validators are randomly chosen, so no one can control the chain forever.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;MEV-Boost relays – Improve decentralization of block building.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Finality Delay Attacks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What it is: A group of validators tries to delay finalizing blocks by staying offline or acting slowly.&lt;/p&gt;

&lt;p&gt;Ethereum’s defense:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Inactivity leaks gradually drain ETH from offline validators.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Eventually, the honest majority finalizes blocks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  👨‍🏫 What You Should Take Away
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;PoS is Ethereum's way of saying:&lt;/strong&gt; "Behave and you’ll be rewarded. Cheat and you’ll be slashed."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Validators are ETH-holding users who run nodes and maintain the chain’s health.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ethereum uses math, game theory, and crypto magic to reward good validators and punish bad ones.&lt;/p&gt;

&lt;p&gt;The system is built to survive attackers, downtime, and even validators turning evil. (Sorry, Anakin.)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧱 Bonus: Starting Your Validator Journey
&lt;/h2&gt;

&lt;p&gt;Wanna be a validator? Here's a super simplified roadmap:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Stake 32 ETH.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set up a validator client (like Lighthouse, Prysm, or Teku).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connect it to your beacon node.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Start validating and watch your ETH grow! (Slowly... it’s not a get-rich-quick scheme.)&lt;/p&gt;

&lt;p&gt;⚠️ Not ready for the full 32 ETH? Try staking pools like Lido, RocketPool, or Coinbase staking.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Proof of Stake is Ethereum’s superhero upgrade:&lt;/strong&gt; greener, faster, and more secure. But with great power comes strict rules and harsh slashing.&lt;/p&gt;

&lt;p&gt;Validators keep Ethereum running — as long as they don’t sleep on the job or try funny business.&lt;/p&gt;

&lt;p&gt;So stake wisely, stay online, and remember: in Ethereum we trust, but verify.&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>parity</category>
    </item>
    <item>
      <title>🔥 Ethereum Basics: From Wallets to Smart Contracts</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Wed, 09 Jul 2025 13:29:17 +0000</pubDate>
      <link>https://dev.to/githaiga22/ethereum-basics-from-wallets-to-smart-contracts-2kd0</link>
      <guid>https://dev.to/githaiga22/ethereum-basics-from-wallets-to-smart-contracts-2kd0</guid>
      <description>&lt;h3&gt;
  
  
  🚪 Opening the Door: Wallets &amp;amp; Addresses
&lt;/h3&gt;

&lt;p&gt;A wallet isn’t just where you “keep your crypto”—it’s your digital identity on Ethereum.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Public Address&lt;/strong&gt; = like your email (where people send you ETH)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Private Key&lt;/strong&gt; = your super-secret password to approve transactions&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;“With great private keys comes great responsibility.”&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Keep your private key off screenshots, sticky notes, or the back of your hand. Seriously.&lt;/p&gt;

&lt;h3&gt;
  
  
  📨 Sending ETH: How Transactions Work
&lt;/h3&gt;

&lt;p&gt;Think of a transaction like mailing a check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You write the address + amount&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You sign it with your private key&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You pay a gas fee (like postage)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ethereum confirms and records it forever&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once it's in, it’s in. Ethereum doesn’t do &lt;strong&gt;“undo.”&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Diving Into Smart Contracts
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;smart contract&lt;/strong&gt; is like a vending machine that runs on code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You send ETH → The machine checks the rules → It delivers the snack (or doesn’t)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These contracts automate everything from NFTs to DeFi lending to on-chain games—no humans in between.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ The Tools You Need
&lt;/h3&gt;

&lt;p&gt;Your Ethereum toolbox 🧰:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://metamask.io/" rel="noopener noreferrer"&gt;MetaMask&lt;/a&gt; – Your wallet and dApp gateway&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://remix-project.org/?lang=en" rel="noopener noreferrer"&gt;Remix IDE&lt;/a&gt; – Try writing your first contract in the browser&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://archive.trufflesuite.com/" rel="noopener noreferrer"&gt;Truffle&lt;/a&gt; / &lt;a href="https://hardhat.org/" rel="noopener noreferrer"&gt;Hardhat&lt;/a&gt; – Full toolkits for bigger dApps&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These help you write, test, and deploy Solidity code like a pro.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎉 So You Met a Fox… and Accidentally Discovered the World Computer
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffelikgt5koyi9vskgio6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffelikgt5koyi9vskgio6.png" alt="Metamask" width="204" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;“At first, it looked like just another crypto wallet... until I realized I had downloaded a portal to a decentralized world computer.”&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  ♦ Ethereum Is More Than a Coin — It’s a World Computer
&lt;/h3&gt;

&lt;p&gt;Ethereum runs on something called the Ethereum Virtual Machine (EVM) — a fancy way of saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;"Everyone runs the same code, and everyone agrees on the result."&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every Ethereum node is like a tiny brain in a big robot. Together, they make Ethereum a global, unstoppable, tamper-proof machine.&lt;/p&gt;

&lt;p&gt;You’ve heard of the cloud? Ethereum is the thunderstorm. ⚡&lt;/p&gt;

&lt;h3&gt;
  
  
  🧠 EOAs vs. Contracts — Who Runs the Show?
&lt;/h3&gt;

&lt;p&gt;You (and MetaMask) are using an Externally Owned Account (EOA):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Has a private key&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can send transactions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can own and control smart contracts&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But the smart contracts themselves? They’re contract accounts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;No private key&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can receive ETH&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React only when triggered&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can think of EOAs as players and contracts as automated chessboards that move when touched.&lt;/p&gt;

&lt;h3&gt;
  
  
  💧 Your First Contract: The Testnet Faucet
&lt;/h3&gt;

&lt;p&gt;Let’s make it rain (test ETH)!&lt;/p&gt;

&lt;p&gt;Here’s a super simple (but very insecure) smart contract:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function withdraw(uint amount) public {
  require(amount &amp;lt;= 0.1 ether);
  msg.sender.transfer(amount);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This lets anyone request up to 0.1 ether. It’s like asking a magical bank to give you some coins—if the rules allow.&lt;/p&gt;

&lt;p&gt;Step-by-step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Paste this into Remix IDE&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compile it with the Solidity compiler&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deploy it with MetaMask on the Ropsten testnet&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Send some ETH to the contract&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Call withdraw(100000000000000000) and voilà! ETH sent!&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Congratulations—you just made money move with code.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧱 What You Really Did
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt; Created a wallet&lt;/li&gt;
&lt;li&gt; Funded it with test ETH&lt;/li&gt;
&lt;li&gt; Wrote a contract&lt;/li&gt;
&lt;li&gt; Deployed it on the testnet&lt;/li&gt;
&lt;li&gt; Interacted with Ethereum like a dev&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🚀 Final Thoughts
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;“You didn’t just install a wallet. You just shook hands with the future of the internet.”&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ethereum lets you go beyond holding coins—it lets you build logic, automation, and applications around value itself.&lt;/p&gt;

&lt;p&gt;Welcome to Web3. This is just the beginning.&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>solidity</category>
    </item>
    <item>
      <title>🧠 Ethereum : The Rise of the World Computer</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Tue, 08 Jul 2025 13:41:56 +0000</pubDate>
      <link>https://dev.to/githaiga22/ethereum-the-rise-of-the-world-computer-14fl</link>
      <guid>https://dev.to/githaiga22/ethereum-the-rise-of-the-world-computer-14fl</guid>
      <description>&lt;h2&gt;
  
  
  🌍 What Is Ethereum? A Glimpse Into the World Computer
&lt;/h2&gt;

&lt;p&gt;Imagine a world computer that runs code exactly as programmed, without downtime, censorship, or third-party interference. That’s what Ethereum set out to be.&lt;/p&gt;

&lt;p&gt;From a technical view, Ethereum is a big global machine made of many small computers (called nodes) all over the world. They all work together to store data, run programs (smart contracts), and agree on what is true.&lt;/p&gt;

&lt;p&gt;But in simpler terms, Ethereum is like a shared computer that anyone can use to build apps that no single person controls.&lt;/p&gt;

&lt;h2&gt;
  
  
  💥 Where Bitcoin ₿ Stops, Ethereum Begins
&lt;/h2&gt;

&lt;p&gt;Many people come across Ethereum after hearing about Bitcoin. While both use blockchain, Ethereum isn't just for sending digital money.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuqu40w4bobdvov9mu3on.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuqu40w4bobdvov9mu3on.png" alt="Table" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ethereum lets developers build dApps (decentralized apps) that live on the blockchain. Want to build a voting system? A game? A crowdfunding tool? Ethereum gives you the canvas.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the Revolution Started
&lt;/h2&gt;

&lt;p&gt;In 2013, a 19-year-old developer named &lt;strong&gt;Vitalik Buterin&lt;/strong&gt; saw a gap in Bitcoin's design. He wanted a blockchain that could run any app, not just money transfers.&lt;/p&gt;

&lt;p&gt;So he wrote a whitepaper that introduced Ethereum: a platform that could run any code (Turing complete). &lt;strong&gt;Gavin Wood&lt;/strong&gt; joined shortly after and became co-founder, helping build the tech vision.&lt;/p&gt;

&lt;p&gt;On July 30, 2015, Ethereum launched its first block. From that moment, the world computer was born.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 What Makes Ethereum ♦ Work?
&lt;/h2&gt;

&lt;p&gt;Ethereum is made of multiple layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Peer-to-Peer Network:&lt;/strong&gt; Computers that talk to each other&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Transactions:&lt;/strong&gt; Messages that change the system&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Consensus Rules:&lt;/strong&gt; Everyone agrees on what’s valid&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🛠️ Ethereum: The Developer's Playground
&lt;/h2&gt;

&lt;p&gt;Ethereum is a developer-first platform. You can write smart contracts in languages like Solidity and deploy them for anyone to interact with. Think of these as tiny programs that handle logic and money safely.&lt;/p&gt;

&lt;p&gt;What makes it special?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You don’t need a company to host your app&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You don’t need permission to build &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s secure and transparent&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 From Frontier to Serenity: The Journey So Far
&lt;/h2&gt;

&lt;p&gt;Ethereum has evolved through several stages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Frontier:&lt;/strong&gt; The early test version&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Homestead:&lt;/strong&gt; The first stable release&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Metropolis:&lt;/strong&gt; More features and security&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Serenity (Ethereum 2.0):&lt;/strong&gt; Faster, cheaper, greener (moving to Proof of Stake)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each stage brought new tech, bug fixes, and upgrades to make Ethereum better for everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  ♦ Why Ethereum Matters
&lt;/h2&gt;

&lt;p&gt;Ethereum opens the door to a new internet, often called Web3. Unlike today’s Web2 (Facebook, Google), Web3 apps don’t need central servers. They are unstoppable, transparent, and owned by users.&lt;/p&gt;

&lt;p&gt;With Ethereum, you can build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;🗳️ Voting apps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🪙 Your own tokens&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🧠 Prediction markets&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🏦 Decentralized finance (DeFi)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧑‍💻 Why You Should Learn Ethereum
&lt;/h2&gt;

&lt;p&gt;Ethereum is the perfect blend of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Programming&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cryptography&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Economics&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Distributed systems&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Smart Contracts:&lt;/strong&gt; Programs that run on-chain&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gas:&lt;/strong&gt; The fuel that powers everything&lt;/p&gt;

&lt;p&gt;Ethereum has its own currency called Ether (ETH). You pay "gas" with Ether to run code and use the network.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✨ Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Ethereum isn’t just about technology. It’s about giving people control back. Control over their apps, data, and even money. Chapter One of "&lt;a href="https://github.com/ethereumbook/ethereumbook/blob/develop/01what-is.asciidoc" rel="noopener noreferrer"&gt;Mastering Ethereum&lt;/a&gt;" sets the foundation, and as we go deeper, the vision becomes even more exciting.&lt;/p&gt;

&lt;p&gt;Stay tuned for more breakdowns from the Ethereum book!&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>etherjs</category>
    </item>
    <item>
      <title>Getting Your Feet Rust-y: A Beginner’s Guide to Rust for Polkadot Devs”</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Mon, 16 Jun 2025 20:02:03 +0000</pubDate>
      <link>https://dev.to/githaiga22/getting-your-feet-rust-y-a-beginners-guide-to-rust-for-polkadot-devs-3bh</link>
      <guid>https://dev.to/githaiga22/getting-your-feet-rust-y-a-beginners-guide-to-rust-for-polkadot-devs-3bh</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;“Rust is the skill. Polkadot is the playground. And you? You’re the architect.”&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  🚀 From Curiosity to Code: Why Rust + Polkadot?
&lt;/h2&gt;

&lt;p&gt;For the past few months, I’ve been heads-down writing about Go — breaking down structs, interfaces, and everything in between. It was the language that helped me fall in love with code and gave me a strong foundation in backend development.&lt;/p&gt;

&lt;p&gt;But something kept calling me: blockchain.&lt;/p&gt;

&lt;p&gt;As I explored the space, I didn’t want to just write smart contracts or build on top of existing blockchains. I wanted to understand the core — the real infrastructure that powers the decentralized world.&lt;/p&gt;

&lt;p&gt;That’s when I stumbled into the Polkadot ecosystem — a vision of Web3 that goes beyond just blockchains. It’s about connecting them all, and empowering developers to build their own chains using powerful tools.&lt;/p&gt;

&lt;p&gt;And guess what? The whole thing runs on Rust.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“&lt;em&gt;&lt;strong&gt;Learning Rust isn’t just about syntax — it’s about unlocking the power to shape the Web3 future.&lt;/strong&gt;&lt;/em&gt;”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So here I am, making the jump from Go to Rust — not because I dislike Go, but because Rust is where my blockchain journey gets real. It's the language that powers Substrate, Polkadot’s core framework. It’s how you build parachains, runtime logic, smart contracts with ink!, and even validator tooling.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“&lt;em&gt;If Web3 is a city, Polkadot is the highway system… and Rust is the language engineers use to build it&lt;/em&gt;.”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  🧰 Why Polkadot Chose Rust (And Why You Should Too)
&lt;/h2&gt;

&lt;p&gt;Polkadot didn’t randomly pick Rust — it was an engineer’s choice.&lt;/p&gt;

&lt;p&gt;Here’s what makes Rust a no-brainer for blockchain:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✅ Memory Safety without garbage collection

✅ Blazing Speed like C/C++, minus the footguns

✅ Pattern Matching &amp;amp; Strong Typing to catch logic errors before they cost millions

✅ Rich Tooling like cargo, clippy, rustfmt

✅ Top-tier Wasm support — essential for running blockchains inside Polkadot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;In blockchain, bugs aren’t just bugs — they’re million-dollar mistakes. Rust helps catch them before they happen.”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  🧪 How Rust Powers the Polkadot Ecosystem
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. 🏗 Substrate Framework&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Polkadot is built on Substrate, a blockchain-building toolkit 100% powered by Rust. Substrate lets you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Build custom blockchains from scratch&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Plug in prebuilt runtime modules (called pallets)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Launch your own parachains in the Polkadot network&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. ⚙️ SCALE Codec&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rust handles SCALE (Simple Concatenated Aggregate Little-Endian) encoding, which compresses and serializes blockchain data efficiently.&lt;br&gt;
In short: Rust makes your data fly over the wire faster and cheaper.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. 🌐 WebAssembly (Wasm)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Polkadot compiles its runtime logic into WebAssembly, a portable low-level format. Rust is one of the best-supported languages for Wasm. That means your Rust code becomes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Cross-platform&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ultra-performant&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deterministic (great for consensus)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  👨‍💻 Rust + Polkadot Career Paths
&lt;/h2&gt;

&lt;p&gt;You’re not just learning Rust — you’re opening doors to jobs and grants in one of the most developer-friendly ecosystems in Web3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💼 In-demand Roles:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Runtime engineers (building pallets)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Smart contract developers (with ink!)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Substrate CLI &amp;amp; tooling developers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Auditors, validators, and indexer engineers&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;💰 Funded Opportunities:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Web3 Foundation Grants&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Substrate Builders Program&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rust-based tooling is often directly funded by core teams and DAOs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“&lt;em&gt;In Web3, learning Rust isn’t just smart — it’s strategic.&lt;/em&gt;”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  🧭 Your Learning Path: Rust → Polkadot Dev
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcs7s61pwuixk40gfx1xt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcs7s61pwuixk40gfx1xt.png" alt="polkadot-article-table" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Want to feel like a blockchain wizard? Understand lifetimes, and you’ll tame time itself. 🧙‍♂️&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  🔨 Practice Projects to Get Started
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;🐱 Substrate Kitties&lt;/strong&gt;&lt;br&gt;
  Build an NFT marketplace (like CryptoKitties, but Rusty)&lt;br&gt;
 &lt;a href="https://dotcodeschool.com/courses/substrate-kitties" rel="noopener noreferrer"&gt;click here&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgrbkh7495o13yxesw8l5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgrbkh7495o13yxesw8l5.png" alt="substrate-kitties" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.🛠 Substrate Node Template&lt;/strong&gt;&lt;br&gt;
Launch your own chain in minutes&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.✍️ ink! Smart Contracts&lt;/strong&gt;&lt;br&gt;
Write contracts with familiar Rust syntax&lt;br&gt;
&lt;a href="https://use.ink/" rel="noopener noreferrer"&gt;click here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fulx6ogckm0ybsvlxqno3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fulx6ogckm0ybsvlxqno3.png" alt=" " width="500" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;“&lt;strong&gt;The best way to learn Rust is to break stuff—safely. Substrate makes it fun.&lt;/strong&gt;”&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Rust is a Power Move
&lt;/h2&gt;

&lt;p&gt;Rust isn’t trendy. It’s battle-tested. And in the Polkadot ecosystem, it’s the default. Learning Rust today is how you build scalable, secure, future-proof blockchain apps tomorrow.&lt;/p&gt;

&lt;p&gt;So grab your terminal, fire up cargo new, and join a growing tribe of fearless Rustaceans and Polkadot pioneers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;“&lt;strong&gt;Rust is your skill. Polkadot is your playground. And you? You’re the architect of the next decentralized world.&lt;/strong&gt;”&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>rust</category>
      <category>web3</category>
      <category>polkadot</category>
      <category>webdev</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Fri, 20 Dec 2024 17:23:37 +0000</pubDate>
      <link>https://dev.to/githaiga22/checkout-my-latest-cool-article-on-architecture-system-ag1</link>
      <guid>https://dev.to/githaiga22/checkout-my-latest-cool-article-on-architecture-system-ag1</guid>
      <description></description>
      <category>emptystring</category>
    </item>
    <item>
      <title>Go Microservices: A Beginner's Dive Into Modern Architecture</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Fri, 20 Dec 2024 17:22:13 +0000</pubDate>
      <link>https://dev.to/githaiga22/go-microservices-a-beginners-dive-into-modern-architecture-51cl</link>
      <guid>https://dev.to/githaiga22/go-microservices-a-beginners-dive-into-modern-architecture-51cl</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When I first started my journey as a backend developer, I was overwhelmed by the complexity of designing systems that could handle growth and changing requirements. I still remember the night I stayed up debugging a monolithic application that crashed due to a minor change in one of its components. That experience taught me a valuable lesson about the importance of scalable and modular architecture.&lt;/p&gt;

&lt;p&gt;Microservices became the beacon of hope, offering solutions to the limitations of monolithic systems. This article aims to share my journey and knowledge, helping backend developers like you gain a clear vision of how microservices can transform your projects. Together, we’ll explore the basics, understand the architecture, and implement a real-world example in Go.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F312upp5qdo9x4wrixsjb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F312upp5qdo9x4wrixsjb.png" alt="what is microservice?" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Microservices?
&lt;/h2&gt;

&lt;p&gt;Microservices is an architectural approach where a single application is divided into small, independent services. Each service focuses on a specific functionality, communicates with others through APIs, and can be developed, deployed, and scaled independently.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Microservices Work
&lt;/h2&gt;

&lt;p&gt;Microservices operate by splitting an application into distinct services, such as user authentication, payment processing, or order management. These services interact through:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API Communication:&lt;/strong&gt; Services communicate using &lt;code&gt;REST&lt;/code&gt;, &lt;code&gt;gRPC&lt;/code&gt;, or message brokers like &lt;code&gt;RabbitMQ&lt;/code&gt; or &lt;code&gt;Kafka&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Decentralized Data:&lt;/strong&gt; Each service often has its database, allowing autonomy and reducing bottlenecks.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Main Components of a Microservices Architecture
&lt;/h2&gt;

&lt;p&gt;Main components of microservices architecture include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Microservices:&lt;/strong&gt; Small, loosely coupled services that handle specific business functions, each focusing on a distinct capability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Gateway:&lt;/strong&gt; Acts as a central entry point for external clients also they manage requests, authentication and route the requests to the appropriate microservice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service Registry and Discovery:&lt;/strong&gt; Keeps track of the locations and addresses of all microservices, enabling them to locate and communicate with each other dynamically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load Balancer:&lt;/strong&gt; Distributes incoming traffic across multiple service instances and prevent any of the microservice from being overwhelmed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Containerization:&lt;/strong&gt; Docker encapsulate microservices and their dependencies and orchestration tools like Kubernetes manage their deployment and scaling.
6.** Event Bus/Message Broker:** Facilitates communication between microservices, allowing pub/sub asynchronous interaction of events between components/microservices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database per Microservice:&lt;/strong&gt; Each microservice usually has its own database, promoting data autonomy and allowing for independent management and scaling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Caching:&lt;/strong&gt; Cache stores frequently accessed data close to the microservice which improved performance by reducing the repetitive queries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fault Tolerance and Resilience Components:&lt;/strong&gt; Components like circuit breakers and retry mechanisms ensure that the system can handle failures gracefully, maintaining overall functionality.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Microservices vs Monolith
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgkto0zzoq809v84shwk2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgkto0zzoq809v84shwk2.png" alt="diffrence" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Microservices
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1.Scalability:&lt;/strong&gt; Scale specific components as needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.Flexibility:&lt;/strong&gt; Use the right technology for each service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.Resilience:&lt;/strong&gt; Failures in one service don’t impact others.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.Rapid Development:&lt;/strong&gt; Teams can work independently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges
&lt;/h2&gt;

&lt;p&gt;1.&lt;strong&gt;Complexity:&lt;/strong&gt; More components to manage.&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;Data Consistency:&lt;/strong&gt; Requires additional mechanisms.&lt;/p&gt;

&lt;p&gt;3.&lt;strong&gt;Latency:&lt;/strong&gt; Inter-service communication can slow performance.&lt;/p&gt;

&lt;p&gt;4.&lt;strong&gt;Testing:&lt;/strong&gt; Requires integration testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Example: A Hotel Booking System
&lt;/h2&gt;

&lt;p&gt;We’ll create a basic hotel booking system using Go, showcasing microservice architecture.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project structure
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hotel-booking/
├── main.go
├── services/
│   ├── booking/
│   │   ├── booking.go
│   │   ├── handler.go
│   │   └── routes.go
│   ├── customer/
│   │   ├── customer.go
│   │   ├── handler.go
│   │   └── routes.go
│   └── room/
│       ├── room.go
│       ├── handler.go
│       └── routes.go
├── api-gateway/
│   └── gateway.go
└── go.mod
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Main Application
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// main.go&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"log"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"micro/services/booking"&lt;/span&gt;
    &lt;span class="s"&gt;"micro/services/customer"&lt;/span&gt;
    &lt;span class="s"&gt;"micro/services/room"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// Initialize routes for each service&lt;/span&gt;
    &lt;span class="n"&gt;booking&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RegisterRoutes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;customer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RegisterRoutes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c"&gt;// Ensure this is implemented like booking&lt;/span&gt;
    &lt;span class="n"&gt;room&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RegisterRoutes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;      &lt;span class="c"&gt;// Ensure this is implemented like booking&lt;/span&gt;

    &lt;span class="c"&gt;// Add a root handler for the base path&lt;/span&gt;
    &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Welcome to the Hotel Booking API"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Starting hotel booking microservices..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ListenAndServe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;":8080"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fatalf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Failed to start server: %v"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Booking Service
&lt;/h3&gt;

&lt;h4&gt;
  
  
  booking.go
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// services/booking/booking.go&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;booking&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Booking&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ID&lt;/span&gt;       &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;RoomID&lt;/span&gt;    &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;CheckIn&lt;/span&gt;  &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;CheckOut&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  handler.go
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// services/booking/handler.go&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;booking&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"encoding/json"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;HandleBooking&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;booking&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;Booking&lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewDecoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;booking&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Welcome Allan Robinson &lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt; Book hotel services"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusBadRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCreated&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewEncoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;booking&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  routes.go
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// services/booking/routes.go&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;booking&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s"&gt;"net/http"&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;RegisterRoutes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/booking"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;HandleBooking&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Customer service
&lt;/h2&gt;

&lt;h4&gt;
  
  
  customer.go
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// services/customer/customer.go&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Customer&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ID&lt;/span&gt;   &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;Email&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  handler.go
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// services/customer/handler.go&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"encoding/json"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;HandleCustomer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;customer&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;Customer&lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewDecoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Welcome Allan Robinson to our hotel services"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusBadRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCreated&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewEncoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  routes.go
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// services/customer/routes.go&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s"&gt;"net/http"&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;RegisterRoutes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/customer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;HandleCustomer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Room Service
&lt;/h2&gt;

&lt;h4&gt;
  
  
  room.go
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// services/room/room.go&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;room&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Room&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ID&lt;/span&gt;     &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;Type&lt;/span&gt;   &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;Status&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  handler.go
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// services/room/handler.go&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;room&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"encoding/json"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;HandleRoom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;room&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;Room&lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewDecoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;room&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Welcome Allan Robinson &lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt; Book a room"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusBadRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCreated&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewEncoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;room&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  routes.go
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// services/room/routes.go&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;room&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s"&gt;"net/http"&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;RegisterRoutes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/room"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;HandleRoom&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  API Gateway
&lt;/h2&gt;

&lt;h4&gt;
  
  
  gateway.go
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// api-gateway/gateway.go
package main

import (
    "net/http"
)

func main() {
    // Proxy requests to specific services
    http.HandleFunc("/api/booking", func(w http.ResponseWriter, r *http.Request) {
        resp, _ := http.Get("http://localhost:8080/booking")
        w.WriteHeader(resp.StatusCode)
    })

    http.ListenAndServe(":9000", nil)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Github repo for this article
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/Githaiga22/Go-Microservices" rel="noopener noreferrer"&gt;Go-Microservices&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Mastering Algorithms with Go: A Beginner's Guide to Sorting Small Data Sets 🔥</title>
      <dc:creator>Allan Githaiga</dc:creator>
      <pubDate>Thu, 12 Dec 2024 04:19:37 +0000</pubDate>
      <link>https://dev.to/githaiga22/mastering-algorithms-with-go-a-beginners-guide-to-sorting-small-data-sets-1nn9</link>
      <guid>https://dev.to/githaiga22/mastering-algorithms-with-go-a-beginners-guide-to-sorting-small-data-sets-1nn9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fshf8as74qrlsxgooq37x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fshf8as74qrlsxgooq37x.jpg" alt="algorithims" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
Algorithms are the backbone of problem-solving in programming. Whether you're organizing your tasks, finding the fastest route on a map, or simply sorting a list of names, algorithms come into play. In the world of software development, understanding algorithms is crucial for writing efficient, scalable, and maintainable code.&lt;/p&gt;

&lt;p&gt;In this article, we'll focus on one of the most basic &amp;amp; fundamental algorithmic challenges—sorting small data sets. We'll explore how to implement sorting algorithms in Go and understand their relevance in real-life scenarios.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhjvqwjymlv4b41jg7agz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhjvqwjymlv4b41jg7agz.jpg" alt="algorithims1" width="800" height="570"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Why This Topic Matters
&lt;/h3&gt;

&lt;p&gt;Sorting data is one of the most common tasks developers face. From ranking search results to organizing user data, efficient sorting can dramatically impact application performance. For beginners, learning sorting algorithms provides a strong foundation for understanding more complex algorithmic concepts.&lt;/p&gt;

&lt;p&gt;But here's a twist: What if you’re faced with a situation where performance matters even for small data sets? Imagine you're developing a leaderboard for a local hackathon where rankings must update in real-time. You need a sorting solution that's both simple and efficient. That’s where this article comes in.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. QuickSort Algorithm
&lt;/h3&gt;

&lt;p&gt;The following code implements a dynamic leaderboard for a local hackathon. It uses efficient sorting and other utility functions to handle real-time updates.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// QuickSort sorts the participants slice in descending order of scores.&lt;/span&gt;
&lt;span class="c"&gt;// It uses a divide-and-conquer approach for efficient sorting.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;QuickSort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Participant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c"&gt;// Find the pivot position&lt;/span&gt;
        &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;partition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c"&gt;// Recursively sort the left and right subarrays&lt;/span&gt;
        &lt;span class="n"&gt;QuickSort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;QuickSort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Input:&lt;/code&gt; The slice of participants, along with low and high indices for the current sorting range.&lt;br&gt;
&lt;code&gt;Output:&lt;/code&gt; The slice is sorted in descending order.&lt;br&gt;
How it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Calls the partition function to position one element (pivot) in its correct sorted place.&lt;/li&gt;
&lt;li&gt;Recursively sorts the two halves of the array around the pivot.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  2. Partition Function
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// partition rearranges the slice such that elements greater than or equal to the pivot&lt;/span&gt;
&lt;span class="c"&gt;// appear before it, and elements less than the pivot come after it.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;partition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Participant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;pivot&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Score&lt;/span&gt; &lt;span class="c"&gt;// Select the pivot as the last element&lt;/span&gt;
    &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;                      &lt;span class="c"&gt;// Initialize pointer for greater elements&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c"&gt;// If the current element's score is greater than or equal to the pivot&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;pivot&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="c"&gt;// Move the pointer&lt;/span&gt;
            &lt;span class="c"&gt;// Swap the current element with the element at pointer i&lt;/span&gt;
            &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// Finally, place the pivot in its correct position&lt;/span&gt;
    &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="c"&gt;// Return the index of the pivot&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function ensures elements are rearranged:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Larger scores are placed on the left of the pivot.&lt;/li&gt;
&lt;li&gt;Smaller scores are placed on the right.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Returns the pivot index, which divides the array for further sorting.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Update Scores
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// UpdateScore updates a participant's score based on their name.&lt;/span&gt;
&lt;span class="c"&gt;// If the participant isn't found, it displays a message.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;UpdateScore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Participant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newScore&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c"&gt;// Find the participant by name&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c"&gt;// Update their score&lt;/span&gt;
            &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;newScore&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Participant not found!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Quickly updates a participant’s score.&lt;br&gt;
&lt;strong&gt;Flow:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loops through the participants slice.
If a match is found (Name == name), updates their Score.&lt;/li&gt;
&lt;li&gt;If no match is found, prints a helpful message.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Display the Leaderboard
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// DisplayLeaderboard prints the participants in sorted order.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;DisplayLeaderboard&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Participant&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;--- Hackathon Leaderboard ---"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;participant&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c"&gt;// Print each participant's rank, name, and score&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%d. %s - %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;participant&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;participant&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Score&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Outputs the current state of the leaderboard.&lt;br&gt;
&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Iterates through the sorted slice.&lt;/li&gt;
&lt;li&gt;Prints the rank, participant name, and score in a readable format.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Add a New Participant
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// AddParticipant adds a new participant if their name isn't already present.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;AddParticipant&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Participant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Participant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// Check if the participant already exists&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;CheckIfParticipantExists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"participant with name %s already exists"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c"&gt;// Append the new participant&lt;/span&gt;
    &lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Participant&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Score&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Ensures no duplicate names in the leaderboard.&lt;/li&gt;
&lt;li&gt;If the participant doesn’t already exist, appends them to the slice and returns the updated slice.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Check if a Participant Exists
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// CheckIfParticipantExists checks if a participant with a given name exists in the slice.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;CheckIfParticipantExists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Participant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;A helper function to verify if a participant’s name is already in the leaderboard.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. sample workflow in Main
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// Initialize participants&lt;/span&gt;
    &lt;span class="n"&gt;participants&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Participant&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"Alice"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Score&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;85&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"Bob"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Score&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;70&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"Charlie"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Score&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;90&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// Add a new participant&lt;/span&gt;
    &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AddParticipant&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Diana"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;75&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;// Update Bob's score&lt;/span&gt;
    &lt;span class="n"&gt;UpdateScore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Bob"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;95&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;// Sort the leaderboard&lt;/span&gt;
    &lt;span class="n"&gt;QuickSort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;// Display the leaderboard&lt;/span&gt;
    &lt;span class="n"&gt;DisplayLeaderboard&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you'd like to explore the complete code implementation and try it out for yourself, you can find the project on my GitHub repository &lt;a href="https://github.com/Githaiga22/Dynamic-Leaderboard" rel="noopener noreferrer"&gt;Dynamic-Leaderboard&lt;/a&gt;. Feel free to clone it and experiment with the algorithms!&lt;br&gt;
Happy coding 🎉&lt;/p&gt;

</description>
      <category>go</category>
      <category>algorithms</category>
      <category>datascience</category>
    </item>
  </channel>
</rss>
