<?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: Anshuman Ojha</title>
    <description>The latest articles on DEV Community by Anshuman Ojha (@anshuman_ojha_).</description>
    <link>https://dev.to/anshuman_ojha_</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%2F3118385%2F6253c977-00fa-429d-834d-44b861d71b0d.jpg</url>
      <title>DEV Community: Anshuman Ojha</title>
      <link>https://dev.to/anshuman_ojha_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anshuman_ojha_"/>
    <language>en</language>
    <item>
      <title>The Evolution of Large Language Models: From Rule-Based Systems to Modern AI</title>
      <dc:creator>Anshuman Ojha</dc:creator>
      <pubDate>Tue, 29 Jul 2025 12:11:51 +0000</pubDate>
      <link>https://dev.to/anshuman_ojha_/the-evolution-of-large-language-models-from-rule-based-systems-to-modern-ai-2bnn</link>
      <guid>https://dev.to/anshuman_ojha_/the-evolution-of-large-language-models-from-rule-based-systems-to-modern-ai-2bnn</guid>
      <description>&lt;p&gt;The journey of Large Language Models (LLMs) is a fascinating narrative of continuous innovation in Machine Learning (ML) and Deep Learning (DL). It's a story of moving from rigid rules to nuanced understanding, powered by breakthroughs at every level, from fundamental algorithms to grand architectures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 1: The Foundations – Rule-Based Systems &amp;amp; Early Statistical Methods
&lt;/h2&gt;

&lt;p&gt;Before the deep learning revolution, language processing was a meticulous craft, often requiring manual engineering.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rule-Based Systems (1950s-1980s):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; These systems used hand-coded rules to interpret and generate language. Think of them as elaborate flowcharts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; ELIZA, a famous early chatbot, would respond to keywords with pre-programmed phrases. If you typed "I am sad," it might reply, "Why are you sad?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Demonstrated the potential for human-computer interaction, but lacked flexibility and scalability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; Imagine a flowchart with decision diamonds and action boxes for every possible linguistic pattern.&lt;/p&gt;

&lt;h3&gt;
  
  
  Statistical Models (1980s-Early 2000s):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; Instead of rules, these models learned probabilities from data. N-grams were dominant, predicting the next word based on the N previous words (e.g., a trigram predicts the next word based on the two preceding words).&lt;/p&gt;

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

&lt;p&gt;N-gram Probability Calculation: Counting word sequences in a large corpus to estimate likelihoods (e.g., P(word3 | word1, word2)).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; More robust to variations in language than rule-based systems, enabling early machine translation and speech recognition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Limitations:&lt;/strong&gt; Suffered from the "curse of dimensionality" (too many unique sequences) and couldn't capture long-range dependencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; A chain of words, with arrows indicating probabilities of transitions between them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 2: The Neural Network Dawn – Understanding Sequence and Context
&lt;/h2&gt;

&lt;p&gt;The emergence of neural networks brought the ability to learn complex patterns and representations from data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Early Neural Networks (Perceptrons, MLPs - 1980s-1990s):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; Simple interconnected nodes that learn mappings from input to output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Laid the groundwork for more complex neural architectures, but insufficient for sequential language data on their own.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recurrent Neural Networks (RNNs - 1990s onwards):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; Designed for sequential data, RNNs have a "memory" that allows information to persist from one step to the next. They process words one by one, updating a hidden state that encapsulates previous information.&lt;/p&gt;

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

&lt;p&gt;Backpropagation Through Time (BPTT): The method for training RNNs by unfolding the network over time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; First true sequential models for language, enabling some understanding of context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Limitations:&lt;/strong&gt; Prone to vanishing/exploding gradients, making it hard to learn very long-range dependencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; A chain of connected boxes, each representing a time step (word), with a loop indicating information feeding back into itself.&lt;/p&gt;

&lt;h3&gt;
  
  
  Long Short-Term Memory (LSTMs) &amp;amp; Gated Recurrent Units (GRUs - 1997, 2014):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; Enhancements to RNNs that introduce "gates" (forget, input, output) to control the flow of information, mitigating the vanishing gradient problem. GRUs are a simpler variant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Revolutionized sequence modeling, making tasks like machine translation and speech recognition practical for longer sequences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; An RNN cell, but with internal "gates" that control information flow through a "cell state" (a long-term memory component).&lt;/p&gt;

&lt;h3&gt;
  
  
  Word Embeddings (Word2Vec, GloVe - 2013-2014):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; Instead of representing words as discrete IDs, word embeddings map words to dense, continuous vectors in a high-dimensional space. Words with similar meanings are located closer together in this space.&lt;/p&gt;

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

&lt;p&gt;Skip-gram/CBOW (Word2Vec): Learning word embeddings by predicting context words from a target word or vice-versa.&lt;/p&gt;

&lt;p&gt;Cosine Similarity: A common metric to measure the semantic similarity between two word vectors. The cosine of the angle between two vectors (ranging from -1 to 1, where 1 means identical direction) determines their similarity.&lt;/p&gt;

&lt;p&gt;Euclidean Distance: Another metric to measure the "distance" between two word vectors in space. Shorter distances imply greater similarity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Captured semantic relationships between words, providing a much richer input representation for neural networks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; A 2D or 3D scatter plot where each point is a word, and semantically similar words (like "king" and "queen") are clustered together. Arrows showing vector arithmetic (e.g., "king" - "man" + "woman" = "queen").&lt;/p&gt;

&lt;h3&gt;
  
  
  Sequence-to-Sequence (Seq2Seq) with Attention (2014):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; An encoder-decoder architecture where an encoder processes an input sequence into a context vector, and a decoder generates an output sequence from that vector. The attention mechanism allows the decoder to "look back" at relevant parts of the input sequence at each step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Significantly improved performance in tasks like machine translation by allowing models to focus on important parts of the input, rather than compressing everything into a single context vector.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; Two connected RNNs (encoder and decoder). The encoder reads the input. At each step, the decoder draws attention lines to relevant parts of the encoder's output, with varying strengths (thicker lines mean more attention).&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 3: The Transformer Revolution – Parallelism and Scalability
&lt;/h2&gt;

&lt;p&gt;The Transformer architecture marked a fundamental shift, moving away from recurrence and embracing parallelism.&lt;/p&gt;

&lt;h3&gt;
  
  
  "Attention Is All You Need" (The Transformer - 2017):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; The Transformer completely replaced recurrence with multiple layers of self-attention and feed-forward networks. Each word can directly attend to every other word in the sequence, no matter how far apart, computing "attention scores" that determine their relevance.&lt;/p&gt;

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

&lt;p&gt;Multi-Head Self-Attention: Computes attention multiple times in parallel, allowing the model to focus on different aspects of relationships within the sequence.&lt;/p&gt;

&lt;p&gt;Positional Encoding: Added to word embeddings to retain information about word order since self-attention is permutation-invariant.&lt;/p&gt;

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

&lt;p&gt;Parallelization: Enabled much faster training on GPUs by processing all words simultaneously.&lt;/p&gt;

&lt;p&gt;Long-Range Dependencies: Excellently captured complex relationships over long distances.&lt;/p&gt;

&lt;p&gt;Scalability: Paved the way for models with billions of parameters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; An encoder-decoder block. Inside the encoder: multi-head self-attention and a feed-forward layer. Inside the decoder: masked multi-head self-attention, encoder-decoder attention, and a feed-forward layer. Lines crisscross between words, showing attention weights.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 4: The Era of Large Pre-trained Models – Emergent Abilities
&lt;/h2&gt;

&lt;p&gt;With Transformers, the paradigm shifted to pre-training massive models on vast amounts of unlabelled text, followed by fine-tuning for specific tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  BERT (Bidirectional Encoder Representations from Transformers - 2018):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; A bidirectional Transformer encoder pre-trained on two tasks: Masked Language Modeling (MLM) (predicting masked words in context) and Next Sentence Prediction (NSP).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Set new benchmarks across diverse NLP tasks by understanding context from both left and right simultaneously. Introduced the power of pre-training on general language understanding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; A single Transformer encoder block. Text with some words [MASKED]. Lines showing attention flowing both left and right.&lt;/p&gt;

&lt;h3&gt;
  
  
  GPT Series (Generative Pre-trained Transformers - 2018 onwards):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; Unidirectional (causal) Transformer decoders pre-trained on causal language modeling (predicting the next word in a sequence).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Demonstrated remarkable generative abilities, producing coherent and contextually relevant text. Scaling up these models (GPT-3, GPT-4) revealed emergent abilities like in-context learning, where the model can perform new tasks given only a few examples in the prompt, without explicit fine-tuning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; A single Transformer decoder block. Text flowing from left to right. Attention lines only point to previous words, never future words.&lt;/p&gt;

&lt;h3&gt;
  
  
  T5 (Text-to-Text Transfer Transformer - 2019):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; Framed all NLP tasks as text-to-text problems (e.g., "translate English to German: hello" -&amp;gt; "hallo"). Uses a Transformer encoder-decoder architecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Unified diverse NLP tasks under a single framework, simplifying model development and achieving strong performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 5: The Refinement and Expansion – Safety, Alignment, and Multimodality
&lt;/h2&gt;

&lt;p&gt;As LLMs became more powerful and ubiquitous, focus shifted to making them safe, useful, and capable of handling more than just text.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reinforcement Learning from Human Feedback (RLHF - 2022 onwards):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; A critical step for aligning LLMs with human preferences and values. It involves:&lt;/p&gt;

&lt;p&gt;Supervised Fine-Tuning (SFT): Initially fine-tuning a pre-trained LLM on a dataset of high-quality human-written prompt-response pairs. This makes the model follow instructions better.&lt;/p&gt;

&lt;p&gt;Reward Model Training: Training a separate "reward model" to predict human preference scores for different model outputs, based on human rankings.&lt;/p&gt;

&lt;p&gt;Reinforcement Learning (PPO): Using the reward model to guide the LLM's learning (often with Proximal Policy Optimization - PPO) to maximize the reward, thereby generating outputs that humans prefer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Greatly improved the helpfulness, harmlessness, and honesty of LLMs, reducing undesirable outputs and aligning them with user intent. This is why models like ChatGPT feel so "conversational" and "helpful."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; A loop: LLM generates responses -&amp;gt; Humans rate responses -&amp;gt; Reward model learns from ratings -&amp;gt; LLM is updated using RL to maximize reward.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multimodal LLMs (2023 onwards - e.g., Gemini, GPT-4o):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; LLMs that can process and generate information across multiple modalities – text, images, audio, video.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Opens up new applications like image captioning, visual question answering, and speech-to-text/text-to-speech interaction, bringing AI closer to human-like perception.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; A single core LLM, with input modules for different data types (image encoder, audio encoder) feeding into it, and output modules for generating different data types.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advanced Reasoning and Agency (Current Research):
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concept:&lt;/strong&gt; Developing LLMs that can perform complex multi-step reasoning, break down problems, and even plan and execute actions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Algorithms/Techniques:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Chain-of-Thought (CoT) Prompting: Guiding the model to show its step-by-step reasoning.&lt;/p&gt;

&lt;p&gt;Tree-of-Thought: Exploring multiple reasoning paths.&lt;/p&gt;

&lt;p&gt;Tool Use: Enabling LLMs to call external tools (like search engines, calculators, code interpreters) to augment their capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribution:&lt;/strong&gt; Moving LLMs beyond just language generation to become more capable problem-solvers and intelligent agents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diagram Concept:&lt;/strong&gt; An LLM engaging in a multi-step process, potentially interacting with external APIs or knowledge bases at various stages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The evolution of LLMs is a vibrant testament to continuous research and engineering. Each stage built upon the last, leveraging fundamental mathematical concepts like vector spaces for embeddings, probability for statistical models, and advanced optimization for neural networks. The journey continues, with ongoing efforts to make LLMs even more intelligent, reliable, and universally accessible.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>ai</category>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>My Summer of Bitcoin 2025 Journey: Building, Simulating, and Securing Bitcoin Protocols</title>
      <dc:creator>Anshuman Ojha</dc:creator>
      <pubDate>Sat, 10 May 2025 19:54:23 +0000</pubDate>
      <link>https://dev.to/anshuman_ojha_/my-summer-of-bitcoin-2025-journey-building-simulating-and-securing-bitcoin-protocols-1i6</link>
      <guid>https://dev.to/anshuman_ojha_/my-summer-of-bitcoin-2025-journey-building-simulating-and-securing-bitcoin-protocols-1i6</guid>
      <description>&lt;p&gt;&lt;strong&gt;Author&lt;/strong&gt;: Anshuman Ojha&lt;br&gt;
&lt;strong&gt;Email&lt;/strong&gt;: &lt;a href="//mailto:anshumanojha91@gmail.com"&gt;anshumanojha91@gmail.com&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/H-ario-m" rel="noopener noreferrer"&gt;H-ario-m&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;LinkedIn&lt;/strong&gt;: &lt;a href="https://www.linkedin.com/in/anshuman-ojha-05ux/" rel="noopener noreferrer"&gt;Anshuman Ojha&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I participated in the Summer of Bitcoin 2025 program, where I explored Bitcoin deeply at the protocol level. The experience was hands-on, rigorous, and focused on both Bitcoin Core and Lightning Network internals. I contributed to two distinct projects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Improving the &lt;strong&gt;fee estimation model&lt;/strong&gt; in LND’s Sweeper subsystem.&lt;/li&gt;
&lt;li&gt;Fixing a critical &lt;strong&gt;key handover exploit&lt;/strong&gt; in the Coinswap protocol.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Through the bootcamp and these contributions, I developed technical skills in Bitcoin scripting, descriptor parsing, multisig construction, mempool validation, fee dynamics, and protocol security.&lt;/p&gt;


&lt;h2&gt;
  
  
  Bootcamp Learnings
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Week 1 – RPC Interaction and OP_RETURN Transaction
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Goal&lt;/strong&gt;: Interact with Bitcoin Core RPC, send a transaction with a payment and &lt;code&gt;OP_RETURN&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical Approach&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launched a Bitcoin node in &lt;code&gt;regtest&lt;/code&gt; mode using Docker.&lt;/li&gt;
&lt;li&gt;Created a wallet using &lt;code&gt;createwallet&lt;/code&gt; and generated addresses.&lt;/li&gt;
&lt;li&gt;Used &lt;code&gt;generatetoaddress&lt;/code&gt; to mine blocks and earn testnet BTC.&lt;/li&gt;
&lt;li&gt;Built a raw transaction using &lt;code&gt;createrawtransaction&lt;/code&gt; and &lt;code&gt;fundrawtransaction&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Added a secondary output with an &lt;code&gt;OP_RETURN&lt;/code&gt; opcode, embedding the string: &lt;code&gt;We are all Satoshi!!&lt;/code&gt; as binary.&lt;/li&gt;
&lt;li&gt;Signed and broadcasted the transaction using &lt;code&gt;signrawtransactionwithwallet&lt;/code&gt; and &lt;code&gt;sendrawtransaction&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Bitcoin Core's RPC system is highly programmable and allows complete control over node behavior.&lt;/li&gt;
&lt;li&gt;Embedding metadata in transactions using &lt;code&gt;OP_RETURN&lt;/code&gt; provides provably unspendable outputs.&lt;/li&gt;
&lt;li&gt;Understanding UTXO funding and fee mechanics is essential for crafting valid transactions manually.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  Week 2 – P2SH-P2WSH 2-of-2 Multisig Transaction
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Goal&lt;/strong&gt;: Manually construct a transaction spending from a P2SH-wrapped P2WSH address.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical Approach&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Used two private keys and a given redeem script.&lt;/li&gt;
&lt;li&gt;Constructed the &lt;code&gt;scriptPubKey&lt;/code&gt; by hashing the redeem script and wrapping it in a P2SH.&lt;/li&gt;
&lt;li&gt;Built an unsigned transaction and computed the BIP143-style sighash.&lt;/li&gt;
&lt;li&gt;Signed using both private keys to produce ECDSA signatures.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Constructed the &lt;code&gt;scriptSig&lt;/code&gt; and &lt;code&gt;witness&lt;/code&gt; fields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;scriptSig&lt;/code&gt;: contained the serialized redeem script.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;witness&lt;/code&gt;: included both signatures and the serialized redeem script.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Serialized the transaction into hex and verified structure manually.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Differentiated between &lt;code&gt;scriptSig&lt;/code&gt; (legacy) and &lt;code&gt;witness&lt;/code&gt; (SegWit).&lt;/li&gt;
&lt;li&gt;Understood how P2SH acts as a compatibility wrapper for newer SegWit scripts.&lt;/li&gt;
&lt;li&gt;Practiced signature validation at the byte level and verified redeem script correctness.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  Week 3 – Simulated Block Mining
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Goal&lt;/strong&gt;: Mine a valid block from a mempool of transactions, respecting dependencies and fee rates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical Approach&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parsed JSON-encoded transactions with dependencies.&lt;/li&gt;
&lt;li&gt;Topologically sorted them to preserve input-output ordering.&lt;/li&gt;
&lt;li&gt;Calculated fee-to-weight ratios and selected optimal transactions under the block size limit.&lt;/li&gt;
&lt;li&gt;Created a Merkle root from the selected transactions.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Built a block header including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Previous block hash&lt;/li&gt;
&lt;li&gt;Merkle root&lt;/li&gt;
&lt;li&gt;Timestamp, difficulty bits&lt;/li&gt;
&lt;li&gt;Nonce satisfying the PoW target: &lt;code&gt;0000ffff...&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Created a valid coinbase transaction with a dummy miner address.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Built a minimal Bitcoin miner simulator.&lt;/li&gt;
&lt;li&gt;Explored real transaction dependency resolution and mempool structure.&lt;/li&gt;
&lt;li&gt;Learned how PoW constraints interact with block content.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  Week 4 – Descriptor Parsing and Balance Aggregation with Esplora
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Goal&lt;/strong&gt;: Parse a descriptor, derive addresses, and aggregate balance by querying Esplora.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical Approach&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parsed the descriptor:
&lt;code&gt;wpkh(tpub.../*)&lt;/code&gt;
using the &lt;code&gt;bitcoinlib&lt;/code&gt; and BIP32 parsing.&lt;/li&gt;
&lt;li&gt;Derived child public keys and corresponding Bech32 addresses.&lt;/li&gt;
&lt;li&gt;Queried each address’s transactions using the local Esplora API (on port &lt;code&gt;8094&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Continued deriving until 10 unused addresses were found (gap limit).&lt;/li&gt;
&lt;li&gt;Summed all confirmed UTXOs and output balance in BTC.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Gained familiarity with hierarchical deterministic wallets.&lt;/li&gt;
&lt;li&gt;Understood the descriptor format and gap limit behavior.&lt;/li&gt;
&lt;li&gt;Practiced using REST APIs to interact with Bitcoin indexers like Esplora.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Project 1 – Dynamic Fee Function Optimization in LND Sweeper
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Problem
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;Sweeper&lt;/strong&gt; in LND handles time-sensitive transactions such as HTLC timeouts. It currently uses a linear fee increase over time, which:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performs poorly during fee spikes.&lt;/li&gt;
&lt;li&gt;Wastes satoshis in low-fee periods.&lt;/li&gt;
&lt;li&gt;Is unconfigurable per use-case urgency.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  My Contribution
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Researched and modeled multiple fee functions&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Characteristics&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Linear&lt;/td&gt;
&lt;td&gt;Default; simple but inflexible&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exponential&lt;/td&gt;
&lt;td&gt;Slow start, steep climb&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stepped&lt;/td&gt;
&lt;td&gt;Discrete jumps; easier to predict&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sigmoid&lt;/td&gt;
&lt;td&gt;Smooth S-shaped urgency growth&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dynamic&lt;/td&gt;
&lt;td&gt;Based on mempool fee estimate feedback&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;2. Simulation and Evaluation&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Built a test framework in Go that simulated mempool congestion scenarios. Metrics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Average fee paid&lt;/li&gt;
&lt;li&gt;Confirmation reliability&lt;/li&gt;
&lt;li&gt;Average time to confirm&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Function&lt;/th&gt;
&lt;th&gt;Avg Fee&lt;/th&gt;
&lt;th&gt;Conf. Rate&lt;/th&gt;
&lt;th&gt;Time to Confirm&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Linear&lt;/td&gt;
&lt;td&gt;62.7&lt;/td&gt;
&lt;td&gt;91.5%&lt;/td&gt;
&lt;td&gt;10.6 blocks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dynamic&lt;/td&gt;
&lt;td&gt;53.9&lt;/td&gt;
&lt;td&gt;97.4%&lt;/td&gt;
&lt;td&gt;8.2 blocks&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;3. Implementation Design&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Made fee functions modular and injectable.&lt;/li&gt;
&lt;li&gt;Exposed configuration via RPC.&lt;/li&gt;
&lt;li&gt;Built test cases simulating fast confirmation and cost sensitivity scenarios.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Learnings
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Learned about fee estimation challenges in Lightning’s context.&lt;/li&gt;
&lt;li&gt;Practiced writing performance-aware Go code.&lt;/li&gt;
&lt;li&gt;Designed empirical evaluation frameworks for fee dynamics.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Project 2 – Coinswap Protocol: Fixing the Private Key Handover Exploit
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Vulnerability
&lt;/h3&gt;

&lt;p&gt;In the original Coinswap settlement flow, the &lt;strong&gt;maker sends their private key before the taker sends theirs&lt;/strong&gt;, based only on receiving the hash preimage. This enabled the taker to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Obtain maker’s key.&lt;/li&gt;
&lt;li&gt;Withhold their own.&lt;/li&gt;
&lt;li&gt;Complete swap with the final party while skipping fees to intermediates.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Exploit Example
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Taker -&amp;gt; Maker: sends preimage  
Maker -&amp;gt; Taker: sends private key (vulnerable)  
Taker disconnects (never sends key back)  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;New Message Flow&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Taker -&amp;gt; Maker: RespHashPreimage  
Maker -&amp;gt; Taker: HashPreimageAcknowledged  
Taker -&amp;gt; Maker: RespPrivKeyHandover  
Maker: Verifies key  
Maker -&amp;gt; Taker: RespPrivKeyHandover  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Added &lt;code&gt;HashPreimageAcknowledged&lt;/code&gt; enum in protocol message types.&lt;/li&gt;
&lt;li&gt;Updated &lt;code&gt;maker/handlers.rs&lt;/code&gt; to store intermediate state and delay key sharing.&lt;/li&gt;
&lt;li&gt;Implemented key verification before final handover.&lt;/li&gt;
&lt;li&gt;Modified &lt;code&gt;taker/api.rs&lt;/code&gt; to wait for acknowledgment and send keys before receiving any.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Wrote full unit and integration tests:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Malicious taker detection&lt;/li&gt;
&lt;li&gt;Cross-maker chain simulation&lt;/li&gt;
&lt;li&gt;Failure injection&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Learnings
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Identified and fixed a multi-hop atomic swap vulnerability.&lt;/li&gt;
&lt;li&gt;Gained experience in secure multi-party message sequencing.&lt;/li&gt;
&lt;li&gt;Implemented state machines in Rust with resilience to adversarial behavior.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Reflections
&lt;/h2&gt;

&lt;p&gt;Summer of Bitcoin was more than just building code—it was about engaging with Bitcoin’s foundations, identifying real-world challenges, and proposing secure, scalable, and efficient solutions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technically, I learned to&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write and interpret low-level Bitcoin transactions.&lt;/li&gt;
&lt;li&gt;Simulate and optimize mempool-based fee strategies.&lt;/li&gt;
&lt;li&gt;Secure privacy protocols from adversarial takers.&lt;/li&gt;
&lt;li&gt;Use Bitcoin Core, Esplora, Rust, Go, and Docker at a production level.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Personally, I learned to&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think adversarially about security.&lt;/li&gt;
&lt;li&gt;Move from abstract specs to secure implementations.&lt;/li&gt;
&lt;li&gt;Collaborate with maintainers and propose upstream fixes.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Connect With Me
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/H-ario-m" rel="noopener noreferrer"&gt;H-ario-m&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Email: &lt;a href="//mailto:anshumanojha91@gmail.com"&gt;anshumanojha91@gmail.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;LinkedIn: &lt;a href="https://www.linkedin.com/in/anshuman-ojha-05ux/" rel="noopener noreferrer"&gt;Anshuman Ojha&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




</description>
    </item>
  </channel>
</rss>
