<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Josue G Navarro</title>
        <link>https://paragraph.com/@GabrielNavarro</link>
        <description>Documenting my path. Code is truth.</description>
        <lastBuildDate>Wed, 15 Jul 2026 17:56:04 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>Josue G Navarro</title>
            <url>https://storage.googleapis.com/papyrus_images/1bc69596e4c786231425c72b499b1b5716f6ae9853532a593cfa104c05155675.jpg</url>
            <link>https://paragraph.com/@GabrielNavarro</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[Building a Hybrid Smart Contract with Rust and Chainlink]]></title>
            <link>https://paragraph.com/@GabrielNavarro/building-a-hybrid-smart-contract-with-rust-and-chainlink</link>
            <guid>ysJ3ga1flMOWEFjbLxCg</guid>
            <pubDate>Sun, 03 May 2026 21:00:29 GMT</pubDate>
            <description><![CDATA[This document outlines the architecture and implementation of a Hybrid Smart Contract built to securely fetch off-chain financial data. The project demonstrates how to bridge the deterministic environment of a blockchain with real-world data using Chainlink Decentralized Oracle Networks (DONs), utilizing Solidity for the on-chain logic and Rust for the off-chain high-performance client.]]></description>
            <content:encoded><![CDATA[<h3 id="h-objective" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Objective</h3><p>This document outlines the architecture and implementation of a Hybrid Smart Contract built to securely fetch off-chain financial data. The project demonstrates how to bridge the determinisitic environment of a blockchain with real-world data using Chainlink <strong>Decentralized Oracle Networks (DONs)</strong> utilizing <strong>Solidity</strong> for the on-chain logic and <strong>Rust</strong> for the off-chain high performance client</p><h3 id="h-context-the-blockchain-oracle-problem" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Context: The Blockchain Oracle Problem</h3><p>Blockchains, by design, are deterministic and isolated networks. A smart contract cannot natively execute an HTTP request to fetch an API endpoint (like weather API or cryptocurrency exchange). If it did, different nodes would getr different data at different times, breaking the network consesus.</p><p>This is known as the <em>Oracle Problem</em>. To build functional DeFi applications, we need an oracle. However, using a single centralized oracle introduces a single <strong>point of failure.</strong> The industry-standard solution is utilizing a Decentralized Oracle Network (DON) like Chainlink, which aggregates and validates data off-chain before securely delivering it on-chain. This creates a <strong>Hybrid Smart Contract</strong>.</p><h3 id="h-system-architecture" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">System Architecture</h3><p>The project is divided into two main components:</p><ol><li><p><strong>On-Chain (Solidity):</strong> A smart contract deployed on the blockchain that acts as a consumer interface to read the validated data from the Chainlink Aggregator.</p></li><li><p><strong>Off-Chain (Rust):</strong> A robust client leveraging the alloy framework to interact asynchronously with the blockchain via an RPC node, retrieving and formatting the data in a memory-safe environment.</p></li></ol><h3 id="h-1-the-on-chain-component-solidity" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">1. The On-Chain Component (Solidity)</h3><p>The PriceConsumer contract is designed to be highly gas-efficient. It reads the ETH/USD price feed from the Sepolia Testnet.  By utilizing the AggregatorV3Interface it safely retrives the latest validated round of data</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {AggregatorV3Interface} from &quot;@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol&quot;;

contract PriceConsumer {
	AggregatorV3Interface internal dataFeed;

	constructor(){
		// ETH/USD price feed address on Sepolia
		dataFeed = AggregatorV3Interface(
			0x694AA1769357215DE4FAC081bf1f309aDC325306
        );
	}

	function getLatestPrice() public view returns(int){
	// Fetching the price, explicitly ignoring unused variables to save gas
		(,int price,,,) = dataFeed.LatestRoundData();
		return price;
    }"><code><span class="hljs-comment">// SPDX-License-Identifier: MIT</span>
<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> ^0.8.0;</span>

<span class="hljs-keyword">import</span> {<span class="hljs-title">AggregatorV3Interface</span>} <span class="hljs-title"><span class="hljs-keyword">from</span></span> <span class="hljs-string">"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol"</span>;

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">PriceConsumer</span> </span>{
	AggregatorV3Interface <span class="hljs-keyword">internal</span> dataFeed;

	<span class="hljs-function"><span class="hljs-keyword">constructor</span>(<span class="hljs-params"></span>)</span>{
		<span class="hljs-comment">// ETH/USD price feed address on Sepolia</span>
		dataFeed <span class="hljs-operator">=</span> AggregatorV3Interface(
			<span class="hljs-number">0x694AA1769357215DE4FAC081bf1f309aDC325306</span>
        );
	}

	<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getLatestPrice</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">public</span></span> <span class="hljs-title"><span class="hljs-keyword">view</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span>(<span class="hljs-params"><span class="hljs-keyword">int</span></span>)</span>{
	<span class="hljs-comment">// Fetching the price, explicitly ignoring unused variables to save gas</span>
		(,<span class="hljs-keyword">int</span> price,,,) <span class="hljs-operator">=</span> dataFeed.LatestRoundData();
		<span class="hljs-keyword">return</span> price;
    }</code></pre><h3 id="h-2-the-off-chain-client-rust" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">2. The Off-Chain Client (Rust)</h3><p>While standard Web3 tutorials rely heavily on JavaScript/TypeScript, I chose <strong>Rust</strong> for the off-chain client. Rust provides unmatched memory safety, strict typing, and high performance, which are critical traits for production-grade financial infrastructure.</p><p>The client utilizes:</p><ul><li><p>Alloy: the modern standart for Ethereum interaction in Rust (replacing ethers-rs), providinf the sol! macro to easily generate Rust bidings from Solidity interfaces.</p></li><li><p>Tokio: For asynchronous runtime.</p></li><li><p>Dotenv: For secure environment variable management (RPC URLs).</p></li></ul><pre data-type="codeBlock" text="use std::{env, str::FromStr};
use alloy::{
    primitives::Address,
    providers::ProviderBuilder,
    sol,
};
use dotenv::dotenv;
use eyre::Result;

// Generating Rust bindings directly from the Solidity interface
sol! {
    #[sol(rpc)]
    interface PriceConsumer {
        function getLatestPrice() external view returns (int256 price);
    }
}

#[tokio::main]
async fn main() -&gt; Result&lt;(), Box&lt;dyn std::error::Error&gt;&gt; {
    dotenv().ok();

    // Securely loading configuration
    let rpc_url = env::var(&quot;RPC_URL&quot;)?.parse()?;
    let contract_address = env::var(&quot;CONTRACT_ADDRESS&quot;)?.parse()?;

    // Initializing the Alloy provider
    let provider = ProviderBuilder::new().on_http(rpc_url);
    let contract = PriceConsumer::new(contract_address, provider);

    // Asynchronously fetching the on-chain data
    let price_raw = contract.getLatestPrice().call().await?;

    // Formatting the price (Chainlink USD feeds have 8 decimals)
    let price_formatted = price_raw.price.to_string().parse::&lt;f64&gt;()? / 100_000_000.0;

    println!(&quot;-----------------------------------------------------------------------&quot;);
    println!(&quot;Connection established&quot;);
    println!(&quot;Current ETH/USD Price validated by Chainlink DON: ${:.2}&quot;, price_formatted);
    println!(&quot;-----------------------------------------------------------------------&quot;);
    
    Ok(())
}"><code>use std::{env, str::FromStr};
use alloy::{
    primitives::Address,
    providers::ProviderBuilder,
    sol,
};
use dotenv::dotenv;
use eyre::Result;

<span class="hljs-comment">// Generating Rust bindings directly from the Solidity interface</span>
sol<span class="hljs-operator">!</span> {
    #[sol(rpc)]
    <span class="hljs-class"><span class="hljs-keyword">interface</span> <span class="hljs-title">PriceConsumer</span> </span>{
        <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getLatestPrice</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">view</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">int256</span> price</span>)</span>;
    }
}

#[tokio::main]
async fn main() <span class="hljs-operator">-</span><span class="hljs-operator">&gt;</span> Result<span class="hljs-operator">&lt;</span>(), Box<span class="hljs-operator">&lt;</span>dyn std::<span class="hljs-function"><span class="hljs-keyword">error</span>::<span class="hljs-title"><span class="hljs-built_in">Error</span></span>&gt;&gt; </span>{
    dotenv().ok();

    <span class="hljs-comment">// Securely loading configuration</span>
    let rpc_url <span class="hljs-operator">=</span> env::<span class="hljs-keyword">var</span>(<span class="hljs-string">"RPC_URL"</span>)?.parse()?;
    let contract_address <span class="hljs-operator">=</span> env::<span class="hljs-keyword">var</span>(<span class="hljs-string">"CONTRACT_ADDRESS"</span>)?.parse()?;

    <span class="hljs-comment">// Initializing the Alloy provider</span>
    let provider <span class="hljs-operator">=</span> ProviderBuilder::<span class="hljs-keyword">new</span>().on_http(rpc_url);
    let <span class="hljs-class"><span class="hljs-keyword">contract</span> = <span class="hljs-title">PriceConsumer</span>::<span class="hljs-title"><span class="hljs-keyword">new</span></span>(<span class="hljs-params">contract_address, provider</span>);

    <span class="hljs-comment">// Asynchronously fetching the on-chain data</span>
    <span class="hljs-title">let</span> <span class="hljs-title">price_raw</span> = <span class="hljs-title"><span class="hljs-keyword">contract</span></span>.<span class="hljs-title">getLatestPrice</span>(<span class="hljs-params"></span>).<span class="hljs-title">call</span>(<span class="hljs-params"></span>).<span class="hljs-title">await</span>?;

    <span class="hljs-comment">// Formatting the price (Chainlink USD feeds have 8 decimals)</span>
    <span class="hljs-title">let</span> <span class="hljs-title">price_formatted</span> = <span class="hljs-title">price_raw</span>.<span class="hljs-title">price</span>.<span class="hljs-title">to_string</span>(<span class="hljs-params"></span>).<span class="hljs-title">parse</span>::&lt;<span class="hljs-title">f64</span>&gt;(<span class="hljs-params"></span>)? / 100<span class="hljs-title">_000_000</span>.0;

    <span class="hljs-title">println</span>!(<span class="hljs-params"><span class="hljs-string">"-----------------------------------------------------------------------"</span></span>);
    <span class="hljs-title">println</span>!(<span class="hljs-params"><span class="hljs-string">"Connection established"</span></span>);
    <span class="hljs-title">println</span>!(<span class="hljs-params"><span class="hljs-string">"Current ETH/USD Price validated by Chainlink DON: ${:.2}"</span>, price_formatted</span>);
    <span class="hljs-title">println</span>!(<span class="hljs-params"><span class="hljs-string">"-----------------------------------------------------------------------"</span></span>);
    
    <span class="hljs-title">Ok</span>(<span class="hljs-params">(<span class="hljs-params"></span>)</span>)
}</span></code></pre><h3 id="h-conclusion" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Conclusion</h3><p>Building this project solidified the fundamental architecture of modern Web3 applications.</p><ol><li><p><strong>Bridging the Gap:</strong> I sucessfully established a secure pipeline between an isolated smart contract and a high-performance extrenal envirement.</p></li><li><p><strong>Rust in Web3:</strong> Leveraging alloy and its sol! macro heavily streamlined the RPC communication process. It demonstrated why systems-level languages are becoming the standard for robust Web3 backend infrastructure.</p></li><li><p><strong>Decentralization in Practice:</strong> Understanding that the integrity of a smart contract is only as strong as the data it consumes. Chainlink's architecture guarantees that the deterministic nature of the blockchain is not compromised by a single point of failure in the real world.</p></li></ol><p>You can also visit my code on GitHub:</p><div data-type="embedly" src="https://github.com/JosueGabrielNavarro/hybrid-oracle-client" data="{&quot;provider_url&quot;:&quot;https://github.com&quot;,&quot;description&quot;:&quot;Contribute to JosueGabrielNavarro/hybrid-oracle-client development by creating an account on GitHub.&quot;,&quot;title&quot;:&quot;GitHub - JosueGabrielNavarro/hybrid-oracle-client&quot;,&quot;author_name&quot;:&quot;JosueGabrielNavarro&quot;,&quot;thumbnail_width&quot;:1200,&quot;url&quot;:&quot;https://github.com/JosueGabrielNavarro/hybrid-oracle-client&quot;,&quot;thumbnail_url&quot;:&quot;https://storage.googleapis.com/papyrus_images/c47a81647565c37adfd918a62bae5243dbee3758183f10bc755ea91e9d932eda.png&quot;,&quot;author_url&quot;:&quot;https://github.com/JosueGabrielNavarro&quot;,&quot;version&quot;:&quot;1.0&quot;,&quot;provider_name&quot;:&quot;GitHub&quot;,&quot;type&quot;:&quot;link&quot;,&quot;thumbnail_height&quot;:600,&quot;image&quot;:{&quot;base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200,&quot;height&quot;:600,&quot;src&quot;:&quot;https://storage.googleapis.com/papyrus_images/c47a81647565c37adfd918a62bae5243dbee3758183f10bc755ea91e9d932eda.png&quot;}}}" format="small"><link rel="preload" as="image" href="https://storage.googleapis.com/papyrus_images/c47a81647565c37adfd918a62bae5243dbee3758183f10bc755ea91e9d932eda.png"><div class="react-component embed my-5" data-drag-handle="true" data-node-view-wrapper="" style="white-space:normal"><a class="link-embed-link" href="https://github.com/JosueGabrielNavarro/hybrid-oracle-client" target="_blank" rel="noreferrer"><div class="link-embed"><div class="flex-1"><div><h2>GitHub - JosueGabrielNavarro/hybrid-oracle-client</h2><p>Contribute to JosueGabrielNavarro/hybrid-oracle-client development by creating an account on GitHub.</p></div><span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-link h-3 w-3 my-auto inline mr-1"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>https://github.com</span></div><img src="https://storage.googleapis.com/papyrus_images/c47a81647565c37adfd918a62bae5243dbee3758183f10bc755ea91e9d932eda.png" alt="GitHub - JosueGabrielNavarro/hybrid-oracle-client"></div></a></div></div><div data-type="subscribeButton" class="center-contents"><a class="email-subscribe-button" href="https://paragraph.com/@gabrielnavarro/subscribe">Subscribe</a></div><div data-type="shareButton" class="center-contents"><a class="email-subscribe-button" href="https://paragraph.com/@gabrielnavarro/ysJ3ga1flMOWEFjbLxCg">Share</a></div><br>]]></content:encoded>
            <author>gabrielnavarro@newsletter.paragraph.com (Josue G Navarro)</author>
            <category>smart-contracts</category>
            <category>oracles</category>
            <category>chainlink</category>
            <category>blockchain</category>
            <category>rust</category>
            <category>solidity</category>
            <enclosure url="https://storage.googleapis.com/papyrus_images/b62802819e81009193d9503328bb48be7c4a331f784514559b4bda7d91b9ae43.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Decoding Galois Fields: Unlocking the Secrets of Ethereum and Web3]]></title>
            <link>https://paragraph.com/@GabrielNavarro/decoding-galois-fields-unlocking-the-secrets-of-ethereum-and-web3</link>
            <guid>ZCWbeEp0Q6YsJJqr5Q83</guid>
            <pubDate>Wed, 11 Mar 2026 05:20:09 GMT</pubDate>
            <description><![CDATA[Paris, 1832. A 20-year-old scribbles a math revolution by candlelight, knowing a bullet waits for him at dawn. 200 years later, his notes are the bedrock of Ethereum privacy]]></description>
            <content:encoded><![CDATA[<h1 id="h-the-tragedy-of-galois" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">The Tragedy of Galois</h1><h3 id="h-history-who-is-evariste-galois" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">History: Who is <strong>Évariste Galois</strong></h3><p>Paris, May 1832. A 20-year-old mathematician, <strong>Évariste Galois, </strong>stares down the barrel of a literal sunrise. A messy romance has led him to a challenge: a pistol duel scheduled for the following morning. He was convinced he would not survive that encounter, so Galois spent his last night, his last hours, scribbling his mathematical legacy by candlelight as he recorded his legacy in revolutionary concepts like <strong>Group Theory</strong> and the algebraic structure known as <strong>Galois Fields</strong>. The next morning, a single bullet ended his life, but his midnight notes would not be forgotten.</p><p>Now, 200 years later, the legacy of those midnight notes is still alive. The math recorded that fateful night is the foundation of <strong>Zero Knowledge Proofs, zk-SNARKs, Ethereum cryptography, and Web3.</strong></p><p>The heart of modern digital privacy now lies in <strong>Galois Fields</strong> and <strong>Finite Fields</strong>, unique sets of finite numbers in which basic operations like addition, subtraction, multiplication, and division are well-defined.</p><p>Instead of using computational power on checking solutions with standard decimal numbers that can grow infinitely large, we can perform calculations over a <strong>finite field</strong>, typically using a prime number as a "limit" for the math (arithmetic modulo p). Every interaction with <strong>Ethereum cryptography</strong> occurs within a field of prime order that obeys the laws Galois discovered that final night in 1832. </p><h1 id="h-the-clock-analogy-and-why-computers-lie" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0"><strong>The Clock Analogy &amp; Why Computers Lie</strong></h1><h3 id="h-the-visual-trap-the-infinite-ruler" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">The Visual Trap: The Infinite Ruler</h3><figure float="none" width="220px" data-type="figure" class="img-center" style="max-width: 220px;"><img src="https://storage.googleapis.com/papyrus_images/86b894fbf1a8f4b15f0ad32ed749e709d9a21158f5cceff856f89c24c67b1f09.jpg" blurdataurl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAACXBIWXMAAAsTAAALEwEAmpwYAAAJoElEQVR4nI1WeXAb5RWXlZCU/EFoh0Iz0w5TCqWTYaAUOoEJTAmFBMJRGqZhhkBbhmlLQ9NAhsS5SCiOk9oJcQ7ZtaMkim9bwVZiC/mQdViRWVuK5JUsaeW9tdqVdlfaQ1qtDjvEHVkZ0mlp2m/2j72+9973fu/93k+j+aal1Wq/vr/3B9/fuOGZ6g/fb2w43Ko/YWg6ptcd3bdr+2uvrH/gRz9cunTJf2651aqqqtJqqzQazdLblr74wi8NLQ0h33hBILIcoqRxMuwOfTkoMrMKjxVlEgkCvW3/2LzppdtX3F7ZW1VV9T+tlwN58uePGjv16SBwTeVUgVRFagawGk7tNXc3GJv2Wvv1katjqkjl0sR8NpFL484R00sbntVWPPw3H5UPy5ct+2jbe2ISzsvxicYGAfJn0rjMoWICPnv8o56mvReb944P6lkyqKRwiUVkDuNi4QTuV1ik/tD+O+6445vTVbG+YsWKxoZDRZkCvzS7rN34lw7yslER42qajIIut/XzvrO1F/U1tsGuJDGjpHAxCc/nWMDaYTG2lDJsUSb7u8/ec8/dZR//eo4bsS9f1njqcEmmRRY1dZ4wHPto+PI512dHZCSgyozIzH6lpoa7j/c2HyxlWYmFc2myINFk1NOu25/lMJlDJRaZVxIDxrN3rlz5tdmbDvbt2l6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T7c01MOi6XhBkFpF5lEEDoQmzx9pBIdNiAs4JBE9Hxy63Muh0KZOs9LwqkBwZfPH5Z/5dvFQenl67BgKdC4W0e6jn8/P15p7TkN/utV9UBTK7SAk8FeZioVImUenwYoZBQEebbh8C2rI8npcolgi+sWnjN0ujyqs1P3t40jmgiuT4UI/ZeGa0T2+6cKSYSagCiQVdLksn7LeBV0wFiZZZJJcm6OjkiLFl2KS/nuciftcrLzx3K51a+bBq1d1NDYdlFmWJGcDWZx80yDyWF+OQd9RrN4amrO26PRILS4s8QcPTNALmRarrQuNPHnygPIOX3FIFa7WLClOr/cXTT15s17NkSCzPJnpOSeIhwNJ3dtLWZ7d0xqLeeSVZlCmRiZpN7ZteXr9s2W3/r8bWam8IbK1W+9gjq3d/+L657wIEXqFgfwKfYbAAjQbQEGAd7Dmwe8dTax5fvnzZLaT1PwFnrqRXva6gDwAAAABJRU5ErkJggg==" nextheight="210" nextwidth="210" class="image-node embed"><figcaption htmlattributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>Standard programming operates on an <strong>infinite ruler</strong>. If a calculation—like a financial transaction or a complex simulation—stretches beyond the computer's physical memory, the ruler can <strong>snap</strong>. For math to be perfectly secure, it must function like a <strong>Clock Face</strong>.</p><p>In a <strong>Finite Field,</strong> we just throw away the infinite ruler and replace it with a circle containing exactly $$p$$ elements, where $$p$$  is a massive prime number.</p><p>Like in a clock, we don't have <strong>negative numbers or decimals. </strong>For example, instead of going backward into negative numbers, we just walk around the clock, and we are either at one point or the next, ensuring total precision.</p><h3 id="h-the-mathematical-magic-division-via-fermat" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">The Mathematical Magic: Division via Fermat</h3><p>Now, in a circular world, we also face some challenges, the most common one being division. Traditional division in a circular world is impossible because it creates decimals, for example:</p><p>$$1 \div 3 = 0.333...$$ </p><p>So, how can we solve this problem in our circular world?</p><p>Here's where we begin using <strong>Fermat's Little Theorem. </strong>Division does not really exist; it is just multiplication in the inverse, so instead of dividing a number, we find a number's <strong>Multiplicative Inverse.  </strong></p><p>Think about it, instead of "cutting a cake into pieces," we find a <strong>secret partner</strong>, a value that, when we multiply it by the original, wraps the clock hand exactly back to 1. To find this partner instantly, cryptographers use <strong>Fermat's Little Theorem</strong>:</p><p> $$a^{p-1} \equiv 1 \pmod p$$<br></p><h1 id="h-pow-the-application" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">PoW: The Application.</h1><p>Now theory is great, but in the world of cryptography, <strong>code is truth</strong>. To make me truly understand the "circular universe," I built a small <strong>Galois Field Calculator in Python from scratch</strong></p><p>My goal was to move beyond the linear math to the logic used in Ethereum's <strong>Arithmetic Circuits</strong>.</p><p>Here is the implementation of the core operations:</p><pre data-type="codeBlock" text="# Addition (Wrap around a clock)
def finiteAdd(a: int, b: int, p: int) -&gt; int:
    &quot;&quot;&quot;
    Addition Calculator in a Galois Field
    Enter the numbers (a,b) and set up the field (p) 
    &quot;&quot;&quot;
    assert a &lt; p, 'Number exceed the field'
    assert b &lt; p, 'Number exceed the field'
    return (a + b) % p

# Subtraction (Go backward around the clock)
def finiteSub(a: int, b: int, p: int) -&gt; int:
    &quot;&quot;&quot;
    Substraction Calculator in a Galois Field
    Enter the numbers (a,b) and set up the field (p)
    &quot;&quot;&quot;
    assert a &lt; p, 'Number exceed the field'
    assert b &lt; p, 'Number exceed the field'
    return (a - b) % p

# Multiplication (Spin the clock super fast)
def finiteMul(a: int, b: int, p: int) -&gt; int:
    &quot;&quot;&quot;
    Multiplication Calculator in a Galois Field
    Enter the numbers (a,b) and set up the field (p)
    &quot;&quot;&quot;
    assert a &lt; p, 'Number exceed the field'
    assert b &lt; p, 'Number exceed the field'
    return (a * b) % p

# Division (Find the inverse, then multiply)
def finiteDiv(a: int, b: int, p: int) -&gt; int:
    &quot;&quot;&quot;
    Division Calculator in a Galois Field
    Enter the numbers (a,b) and set up the field (p)
    &quot;&quot;&quot;
    assert a &lt; p, 'Number exceed the field'
    assert b &lt; p, 'Number exceed the field'
    assert b != 0, 'We cannot divide by zero'
    inv = pow(b, p - 2, p) # Fermat's Little Theorem
    return (a * inv) % p"><code><span class="hljs-comment"># Addition (Wrap around a clock)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">finiteAdd</span>(<span class="hljs-params">a: <span class="hljs-built_in">int</span>, b: <span class="hljs-built_in">int</span>, p: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:
    <span class="hljs-string">"""
    Addition Calculator in a Galois Field
    Enter the numbers (a,b) and set up the field (p) 
    """</span>
    <span class="hljs-keyword">assert</span> a &lt; p, <span class="hljs-string">'Number exceed the field'</span>
    <span class="hljs-keyword">assert</span> b &lt; p, <span class="hljs-string">'Number exceed the field'</span>
    <span class="hljs-keyword">return</span> (a + b) % p

<span class="hljs-comment"># Subtraction (Go backward around the clock)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">finiteSub</span>(<span class="hljs-params">a: <span class="hljs-built_in">int</span>, b: <span class="hljs-built_in">int</span>, p: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:
    <span class="hljs-string">"""
    Substraction Calculator in a Galois Field
    Enter the numbers (a,b) and set up the field (p)
    """</span>
    <span class="hljs-keyword">assert</span> a &lt; p, <span class="hljs-string">'Number exceed the field'</span>
    <span class="hljs-keyword">assert</span> b &lt; p, <span class="hljs-string">'Number exceed the field'</span>
    <span class="hljs-keyword">return</span> (a - b) % p

<span class="hljs-comment"># Multiplication (Spin the clock super fast)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">finiteMul</span>(<span class="hljs-params">a: <span class="hljs-built_in">int</span>, b: <span class="hljs-built_in">int</span>, p: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:
    <span class="hljs-string">"""
    Multiplication Calculator in a Galois Field
    Enter the numbers (a,b) and set up the field (p)
    """</span>
    <span class="hljs-keyword">assert</span> a &lt; p, <span class="hljs-string">'Number exceed the field'</span>
    <span class="hljs-keyword">assert</span> b &lt; p, <span class="hljs-string">'Number exceed the field'</span>
    <span class="hljs-keyword">return</span> (a * b) % p

<span class="hljs-comment"># Division (Find the inverse, then multiply)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">finiteDiv</span>(<span class="hljs-params">a: <span class="hljs-built_in">int</span>, b: <span class="hljs-built_in">int</span>, p: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:
    <span class="hljs-string">"""
    Division Calculator in a Galois Field
    Enter the numbers (a,b) and set up the field (p)
    """</span>
    <span class="hljs-keyword">assert</span> a &lt; p, <span class="hljs-string">'Number exceed the field'</span>
    <span class="hljs-keyword">assert</span> b &lt; p, <span class="hljs-string">'Number exceed the field'</span>
    <span class="hljs-keyword">assert</span> b != <span class="hljs-number">0</span>, <span class="hljs-string">'We cannot divide by zero'</span>
    inv = <span class="hljs-built_in">pow</span>(b, p - <span class="hljs-number">2</span>, p) <span class="hljs-comment"># Fermat's Little Theorem</span>
    <span class="hljs-keyword">return</span> (a * inv) % p</code></pre><h1 id="h-the-conclusion-the-journey" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0"><strong>The Conclusion: The Journey</strong></h1><p><strong>I am a 19-year-old rewiring my brain.</strong> My mission is more than just learning to code; it is a deliberate exercise in <strong>neuroplasticity</strong>, physically reconfiguring my neural connections to grasp the high-abstraction mathematics required for modern cryptography. Just as Galois spent his final hours ensuring his theories were recorded for the future, I am dedicated to mastering the logic that secures our digital world.</p><p><strong>Next time, I am tackling Merkle Trees and Arithmetization.</strong>  You can find the source code for this Galois Field calculator and follow my progress as I build out the full stack of ZK primitives here:</p><ul><li><p><strong>GitHub Repository:</strong> <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/JosueGabrielNavarro/ZK-Primitives-Python">https://github.com/JosueGabrielNavarro/ZK-Primitives-Python</a></p></li><li><p><strong>X Profile:</strong> <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://x.com/JosueNavar83869">https://x.com/JosueNavar83869</a></p></li><li><p><strong>Farcaster Profile:</strong> <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://farcaster.xyz/jossh">https://farcaster.xyz/jossh</a></p></li></ul><br>]]></content:encoded>
            <author>gabrielnavarro@newsletter.paragraph.com (Josue G Navarro)</author>
            <category>cryptography</category>
            <category>ethereum</category>
            <category>web3</category>
            <category>python</category>
            <enclosure url="https://storage.googleapis.com/papyrus_images/a16104870f70ad2787694abb358e1e3217c3712313075a9ba55e891aa4287897.jpg" length="0" type="image/jpg"/>
        </item>
    </channel>
</rss>