<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anass ELABBADI on Medium]]></title>
        <description><![CDATA[Stories by Anass ELABBADI on Medium]]></description>
        <link>https://medium.com/@anasselabbadi.pro?source=rss-70299b9b3050------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uKKCHzf9XEfqSQZstg08LA.png</url>
            <title>Stories by Anass ELABBADI on Medium</title>
            <link>https://medium.com/@anasselabbadi.pro?source=rss-70299b9b3050------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 02:41:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anasselabbadi.pro/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Most XML Sitemaps Are Technically Wrong]]></title>
            <link>https://medium.com/@anasselabbadi.pro/why-most-xml-sitemaps-are-technically-wrong-2697a3a6acae?source=rss-70299b9b3050------2</link>
            <guid isPermaLink="false">https://medium.com/p/2697a3a6acae</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[technical-seo]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[search-engines]]></category>
            <dc:creator><![CDATA[Anass ELABBADI]]></dc:creator>
            <pubDate>Wed, 28 Jan 2026 20:22:33 GMT</pubDate>
            <atom:updated>2026-01-28T20:22:33.999Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Senior Engineer’s Deep Dive into Sitemap Validation, Crawling, and Indexation</h3><h3>Introduction</h3><p>XML sitemaps are often treated as a checkbox item.</p><p>Generate a file.<br>Submit it to Google Search Console.<br>Move on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mvPfM3TFe05XijIWsRe0hw.png" /></figure><p>In practice, that mindset is responsible for a large percentage of silent indexing failures, wasted crawl budget, and long-term SEO debt — especially on modern web stacks built with frameworks like Next.js, React, headless CMSs, and server-side rendering.</p><p>The uncomfortable truth is this:<br><strong>most sitemap problems are not SEO problems — they are engineering problems.</strong></p><p>This article is based on a real sitemap validation I ran on a production website using a custom Sitemap Validator I built for internal and public use. We’ll walk through how XML sitemaps actually work under the hood, analyze real validation results, and explain why each issue matters technically — not just from a “best practices” SEO standpoint.</p><p>If you build serious web products, sitemaps deserve the same rigor as APIs, databases, and background jobs.</p><h3>How XML Sitemaps Really Work (Under the Hood)</h3><h3>How search engines fetch sitemaps</h3><p>Search engines discover sitemaps through three primary mechanisms:</p><p><strong>1. robots.txt</strong></p><pre>Sitemap: https://example.com/sitemap.xml</pre><p><strong>2. Manual submission</strong> (Google Search Console, Bing Webmaster Tools)</p><p><strong>3. Heuristic discovery</strong> (common paths like /sitemap.xml)</p><p>Once discovered, the sitemap is fetched like any other HTTP resource. That means:</p><ul><li>HTTP status codes matter</li><li>Redirects matter</li><li>Caching headers matter</li><li>TLS and protocol consistency matter</li></ul><p>A sitemap is <strong>not</strong> treated as a static config file. It’s treated as a network resource that must behave predictably over time.</p><h3>Parsing rules and schema constraints</h3><p>An XML sitemap must conform to a strict schema:</p><ul><li>UTF-8 encoded</li><li>Valid XML syntax</li><li>Namespaces correctly declared</li><li>&lt;urlset&gt; → &lt;url&gt; → &lt;loc&gt; hierarchy</li></ul><p>Search engines do not attempt to “fix” malformed XML. If parsing fails, <strong>the entire sitemap can be ignored</strong>, not partially processed.</p><p>This is one of the most misunderstood aspects:</p><blockquote><em>A single invalid character can invalidate tens of thousands of URLs.</em></blockquote><h3>Hard limits that actually matter</h3><p>XML sitemaps are constrained by:</p><ul><li><strong>50,000 URLs per sitemap</strong></li><li><strong>50 MB uncompressed size</strong></li><li>Optional but recommended &lt;lastmod&gt;, &lt;changefreq&gt;, &lt;priority&gt;</li></ul><p>Exceeding limits does not trigger a warning email. It simply causes silent truncation or rejection.</p><p>Large platforms should always use <strong>sitemap indexes</strong>, not monolithic files.</p><h3>“Present in sitemap” ≠ “Eligible for indexation”</h3><p>This distinction is critical.</p><p>A URL being listed in a sitemap means:</p><ul><li>The site owner claims the URL exists</li><li>The URL is a candidate for crawling</li></ul><p>It does <strong>not</strong> mean:</p><ul><li>The URL will be indexed</li><li>The URL is canonical</li><li>The URL is high priority</li><li>The URL is trusted</li></ul><p>Search engines still evaluate:</p><ul><li>Canonical signals</li><li>HTTP status codes</li><li>Meta directives (noindex)</li><li>Content quality</li><li>Internal linking</li></ul><p>Sitemaps are <strong>hints</strong>, not commands.</p><h3>Sitemaps vs robots.txt: defining crawl boundaries</h3><ul><li>Sitemaps describe what can be crawled.</li><li>Robots.txt defines what must not be crawled.</li><li>Problems arise when these two sources contradict each other.</li></ul><p>I’ve seen production systems where sitemaps list URLs that robots.txt explicitly blocks — a clear architectural failure. <a href="https://www.mastalabs.io/tools/robots-txt-generator">Generating robots.txt</a> with the same source of truth as the sitemap avoids that class of bugs entirely.</p><h3>Validation Results Analysis (Real Production Sitemap)</h3><p>The screenshot shows a sitemap with <strong>12 URLs</strong>, all syntactically valid, but containing a mix of structural checks, SEO-related validations, and crawler-level constraints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NrGZZYGRkc-9kN1K8PLVTQ.png" /><figcaption><strong><em>A real production sitemap validation results.</em></strong></figcaption></figure><p>Let’s break this down logically.</p><h3>1. XML &amp; Protocol Checks (All Passed)</h3><p>✔ Valid XML syntax</p><p>✔ Correct namespace</p><p>✔ UTF-8 encoding</p><p>✔ No malformed tags</p><p>This confirms the sitemap can be <strong>parsed deterministically</strong> by crawlers.</p><p>Why this matters:</p><ul><li>Parsing happens before <em>any</em> crawling decision</li><li>A malformed sitemap is equivalent to having no sitemap at all</li></ul><p>From an engineering perspective, this means the sitemap generator is:</p><ul><li>Deterministic</li><li>Encoding-safe</li><li>Not leaking templating artifacts</li></ul><p>Good foundation — but this is the easy part.</p><h3>2. Sitemap Item Structure &amp; URL Hygiene</h3><p>✔ Valid HTTP/HTTPS URLs</p><p>✔ No invalid characters</p><p>✔ No empty &lt;loc&gt; entries</p><p>✔ URL length within limits</p><p>These checks prevent subtle crawler failures.</p><p>Common real-world causes of failure here:</p><ul><li>Unescaped query parameters</li><li>Dynamic route placeholders ([slug])</li><li>Locale artifacts (/en//page)</li><li>CMS-generated junk URLs</li></ul><p>On modern SSR frameworks (Next.js especially), sitemap generation often runs in a <strong>Node context without runtime routing awareness</strong>, which is where things break.</p><p>Passing these checks means URLs are <em>syntactically crawlable</em>.</p><h3>3. HTTP Status Code Validation</h3><p>✔ All URLs return 200 OK</p><p>✔ No redirects</p><p>✔ No 4xx / 5xx responses</p><p>This is more important than most teams realize.</p><p>Search engines <strong>do not like redirects in sitemaps</strong>.</p><p>Why?</p><ul><li>Sitemaps are supposed to list <em>final canonical URLs</em></li><li>Redirects waste crawl budget</li><li>Redirect chains compound crawl inefficiency</li></ul><p>A sitemap pointing to URLs that redirect is a strong signal of architectural drift.</p><p>From a system design perspective, this confirms:</p><ul><li>Canonical URL generation is aligned with routing</li><li>No environment mismatch (http → https, non-www → www)</li><li>No stale URLs leaking into production</li></ul><p>This is a sign of engineering discipline.</p><h3>4. Indexability &amp; Canonical Alignment</h3><p>✔ No noindex URLs in sitemap</p><p>✔ Canonical URLs match sitemap URLs</p><p>✔ No blocked URLs (robots.txt)</p><p>This is where many teams get it wrong.</p><p>A sitemap <strong>must not</strong> include:</p><ul><li>noindex pages</li><li>Canonicalized-away variants</li><li>Blocked paths</li><li>Filtered or faceted URLs</li></ul><p>Including them creates contradictory signals:</p><blockquote><em>“Please crawl this” + “Do not index this”</em></blockquote><p>Search engines resolve contradictions conservatively — usually by ignoring your intent.</p><p>Passing these checks indicates:</p><ul><li>Canonical logic is centralized</li><li>SEO and routing are not fighting each other</li><li>The sitemap reflects <strong>index intent</strong>, not URL existence</li></ul><p>That distinction is senior-level thinking.</p><h3>5. SEO Best-Practice Checks (Warnings vs Errors)</h3><p>The validator distinguishes <strong>warnings</strong> from <strong>errors</strong>, which matters.</p><p>Errors = technically broken<br> Warnings = potentially suboptimal, context-dependent</p><p>Examples commonly flagged:</p><ul><li>Missing &lt;lastmod&gt;</li><li>Flat sitemap structure</li><li>Low URL count relative to site size</li></ul><p>These are not fatal, but they affect:</p><ul><li>Crawl prioritization</li><li>Change detection</li><li>Index freshness</li></ul><p>For large or frequently updated platforms, &lt;lastmod&gt; accuracy directly impacts how often Google revisits URLs.</p><p>This is <strong>not SEO fluff</strong> — it’s distributed systems optimization.</p><h3>Common Engineering Mistakes Behind Sitemap Issues</h3><p>After reviewing hundreds of real sitemaps, the same root causes appear repeatedly.</p><h3>1. Auto-generated sitemaps without canonical awareness</h3><p>In many teams, sitemap problems don’t start at validation time — they start at generation time.<br>If URLs are produced without canonical awareness, environment filtering, or indexability checks, validation only confirms a broken design.</p><p>This is why I treat sitemap generation as a <strong>deterministic build artifact</strong>, not a CMS export. The <a href="https://www.mastalabs.io/tools/xml-sitemap-generator">XML Sitemap Generator</a> I built enforces those constraints early, before URLs ever reach crawlers.</p><p>Framework plugins often:</p><ul><li>Enumerate routes</li><li>Ignore canonical rules</li><li>Ignore redirects</li><li>Ignore noindex</li></ul><p>The result is a sitemap that is <strong>syntactically valid, but semantically wrong</strong>.</p><h3>2. Mixing indexable and non-indexable URLs</h3><p>Examples:</p><ul><li>Auth pages</li><li>Pagination</li><li>Filters</li><li>Internal tools</li><li>A/B test variants</li></ul><p>A sitemap should describe <strong>public, stable, canonical content</strong> — nothing else.</p><h3>3. Environment leaks</h3><p>Classic failures:</p><ul><li>http:// URLs in production</li><li>staging. subdomains</li><li>Old domains</li><li>Preview deployments</li></ul><p>These issues usually originate from:</p><ul><li>Shared config files</li><li>CI/CD environment mismatch</li><li>Poor separation of runtime vs build-time config</li></ul><h3>4. CMS + frontend mismatch</h3><p>Headless CMSs often expose:</p><ul><li>Draft URLs</li><li>Preview URLs</li><li>Legacy slugs</li></ul><p>If the sitemap generator trusts the CMS blindly, garbage enters the sitemap.</p><h3>5. Over-trusting SEO plugins</h3><p>SEO plugins optimize content.<br>They do <strong>not</strong> understand your architecture.</p><p>Sitemaps belong closer to:</p><ul><li>Routing</li><li>Canonical logic</li><li>Deployment pipelines</li></ul><p>Not marketing tooling.</p><h3>How I Built and Use My Sitemap Validator</h3><p>I built my Sitemap Validator with a <strong>developer-first philosophy</strong>.</p><p>Not:</p><ul><li>“Green checks everywhere”</li><li>Vague SEO scores</li><li>Black-box advice</li></ul><p>But:</p><ul><li>Deterministic validation</li><li>Explicit failure reasons</li><li>Clear separation between parsing, crawling, and indexability</li></ul><p>It checks:</p><ul><li>XML schema validity</li><li>URL hygiene</li><li>HTTP behavior</li><li>Canonical alignment</li><li>Indexability signals</li><li>Robots compatibility</li><li>Crawl-waste patterns</li></ul><p>I use it the same way I use:</p><ul><li>Database migration validators</li><li>OpenAPI validators</li><li>CI linting rules</li></ul><p>As a <strong>diagnostic tool</strong>, not a marketing report.</p><p>You can try it here:<br> 👉 S<a href="https://www.mastalabs.io/tools/sitemap-validator">itemap Validator</a></p><h3>Why Senior Engineers Should Care About Sitemaps</h3><p>Sitemaps directly impact:</p><ul><li><strong>Crawl budget efficiency</strong></li><li><strong>Index freshness</strong></li><li><strong>System reliability</strong></li><li><strong>Long-term SEO scalability</strong></li></ul><p>On large platforms, sitemap quality becomes a <strong>capacity planning problem</strong>.</p><p>Bad sitemaps:</p><ul><li>Waste crawler resources</li><li>Delay content discovery</li><li>Hide regressions</li><li>Mask routing bugs</li></ul><p>Good sitemaps:</p><ul><li>Act as a source of truth</li><li>Surface architectural drift</li><li>Encode intent explicitly</li></ul><p>At scale, sitemap validation is not SEO — it’s <strong>systems engineering</strong>.</p><h3>Conclusion</h3><p>XML sitemaps are not trivial files.<br>They are <strong>contracts</strong> between your system and search engines.</p><p>If that contract is vague, contradictory, or technically sloppy, crawlers respond accordingly.</p><p>Senior engineers understand this instinctively:</p><ul><li>Explicit beats implicit</li><li>Determinism beats guesswork</li><li>Validation beats hope</li></ul><blockquote>Treat your sitemap like any other production interface.<br>Audit it. Validate it. Own it.</blockquote><p>That mindset is part of engineering craftsmanship — and it compounds over time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2697a3a6acae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Benford’s Law Reveals Hidden Insights]]></title>
            <link>https://medium.com/@anasselabbadi.pro/how-benfords-law-reveals-hidden-insights-9be6f3057dda?source=rss-70299b9b3050------2</link>
            <guid isPermaLink="false">https://medium.com/p/9be6f3057dda</guid>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[benfords-law]]></category>
            <category><![CDATA[statistical-analysis]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Anass ELABBADI]]></dc:creator>
            <pubDate>Tue, 25 Apr 2023 10:37:10 GMT</pubDate>
            <atom:updated>2023-04-25T10:37:10.080Z</atom:updated>
            <content:encoded><![CDATA[<p>Discover the power of Benford’s Law! Unveil hidden insights and detect anomalies in your data with this intriguing statistical phenomenon. In this article, we will explore the applications of Benford’s Law and how it can be applied using a JavaScript web app. From financial analysis to fraud detection, population statistics to scientific research, Benford’s Law has diverse applications that can provide valuable insights in various data analysis scenarios. Let’s dive in and uncover the secrets of Benford’s Law!</p><h4>Background on Benford’s Law</h4><p>Benford’s Law, also known as the First-Digit Law or the Newcomb-Benford Law, is a statistical phenomenon that describes the distribution of first digits in many datasets that occur in nature, economics, and other fields. It was first discovered by physicist Frank Benford in 1938, who observed that the pages of a book of logarithm tables were more worn at the beginning, suggesting that numbers starting with smaller digits appeared more frequently than those starting with larger digits.</p><p>Benford’s Law states that in many datasets, the probability of the first digit “1” occurring is about 30%, followed by “2” with about 17.6%, “3” with about 12.5%, and so on, with decreasing probabilities for larger digits, and “9” with only about 4.6%. This distribution of first digits is unexpected and counterintuitive, as our intuition might tell us that all digits should occur with equal probabilities.</p><p>The mathematical basis for Benford’s Law lies in the logarithmic scale of numbers. In many datasets, numbers span several orders of magnitude, and the distribution of first digits in such datasets follows a logarithmic pattern. Benford’s Law can be expressed mathematically as follows:</p><blockquote>P(d) = log10(d + 1) — log10(d),</blockquote><p>where P(d) is the probability of the first digit being d, and log10 is the base-10 logarithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/0*hfVctrOVbaw3VMGW" /></figure><p>Benford’s Law has been found to be applicable in various domains, including finance, accounting, scientific research, population statistics, and more. It has been used to detect anomalies, identify data quality issues, and even detect fraud in financial statements. Its applications in data analysis have grown significantly in recent years, with the advent of big data and advanced statistical techniques.</p><p>In the next sections, we will explore how Benford’s Law can be applied in practice to reveal hidden insights in data, and how a JavaScript web app can be used as a tool for Benford’s Law analysis.</p><h4>Applications of Benford’s Law</h4><p>Benford’s Law has found applications in various domains due to its ability to reveal hidden insights and detect anomalies in datasets. Some of the key applications of Benford’s Law include:</p><ol><li>Financial and accounting analysis: Benford’s Law has been widely used in financial and accounting analysis to detect potential fraud or irregularities in financial statements. By applying Benford’s Law to financial data such as revenues, expenses, or transaction amounts, it is possible to identify discrepancies that may indicate fraudulent activities or data manipulation.</li><li>Data quality assessment: Benford’s Law can be used as a tool for assessing the quality of data in large datasets. By comparing the distribution of first digits in the dataset with the expected distribution according to Benford’s Law, it is possible to identify data entry errors, data duplication, or other data quality issues that may affect the accuracy and reliability of the dataset.</li><li>Forensic data analysis: Benford’s Law has been used in forensic data analysis to detect potential anomalies or irregularities in datasets related to criminal investigations, insurance claims, or other forensic applications. By analyzing the distribution of first digits in the data, forensic analysts can identify suspicious patterns that may indicate fraudulent activities or data manipulation.</li><li>Population statistics: Benford’s Law has been applied to population statistics, such as census data, to assess the accuracy and reliability of reported population numbers. It can help identify potential errors or discrepancies in population data, which can have significant implications for policy making, resource allocation, and other decision-making processes.</li><li>Scientific research: Benford’s Law has been used in scientific research to assess the validity and reliability of experimental data. It can help identify potential data fabrication or manipulation in research findings, and ensure the integrity of scientific data.</li><li>Business analytics: Benford’s Law can be applied in business analytics to identify potential patterns or anomalies in various types of data, such as sales data, customer data, or product data. By analyzing the distribution of first digits in the data, businesses can gain insights into customer behaviors, market trends, or product performance.</li><li>Fraud detection: Benford’s Law has been used in fraud detection in various industries, including insurance, tax, and procurement. By applying Benford’s Law to transaction data or other relevant datasets, it is possible to identify potential fraudulent activities that may deviate from the expected distribution of first digits.</li></ol><p>These are just a few examples of the wide-ranging applications of Benford’s Law in data analysis. Its versatility and effectiveness in detecting anomalies and revealing hidden insights make it a powerful tool for data analysts, auditors, forensic investigators, and other professionals in diverse fields. In the next sections, we will explore how to apply Benford’s Law analysis using a JavaScript web app, and how it can provide valuable insights in real-world data analysis scenarios.</p><p>Here are some key steps for applying Benford’s Law in data analysis:</p><ol><li>Collect and prepare the data: Gather the dataset that you want to analyze and ensure that it is in a suitable format for analysis. This may involve cleaning the data, removing outliers, and converting data into appropriate units.</li><li>Extract the leading digits: For each data point in the dataset, extract the leading digit. This can usually be done by taking the integer part or the leftmost digit of the number.</li><li>Calculate the expected distribution: Use Benford’s Law to calculate the expected distribution of leading digits. According to Benford’s Law, the expected percentage distribution of leading digits is approximately: 1 (30.1%), 2 (17.6%), 3 (12.5%), 4 (9.7%), 5 (7.9%), 6 (6.7%), 7 (5.8%), 8 (5.1%), and 9 (4.6%).</li><li>Compare the actual and expected distributions: Create a histogram or other graphical representation to display the actual distribution of leading digits in the dataset, and compare it with the expected distribution according to Benford’s Law. Look for significant deviations from the expected distribution, particularly if the deviations are consistent across the dataset.</li><li>Investigate anomalies: If there are significant deviations between the actual and expected distributions, it may indicate potential anomalies, fraud, or errors in the dataset. Investigate these discrepancies further to determine the cause of the deviations. This may involve reviewing the data source, checking for data entry errors, verifying the accuracy of calculations, or identifying potential fraudulent activities.</li><li>Interpret results: Once you have completed the analysis, interpret the results and draw conclusions based on the findings. If the deviations from Benford’s Law are statistically significant and cannot be explained by legitimate reasons, it may indicate data quality issues, potential fraud, or errors that need to be addressed.</li></ol><p>Or You Can Always Use the Web App I Developed Using JavaScript to Apply Benford’s Law on a Given JSON Data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kgQ8hzxFvpmNb6_tcYjf_w.png" /></figure><p><a href="https://github.com/chiefmasta/benford_law">https://github.com/chiefmasta/benford_law</a></p><p>You can learn more about how to use the app on <a href="https://github.com/chiefmasta/benford_law">my github profile</a>.</p><p>As data analysis continues to play a crucial role in various domains, including finance, auditing, scientific research, and beyond, the application of Benford’s Law can provide valuable insights and help uncover patterns that may be hidden in data.</p><p>And with the help of a simple JavaScript web app, users can conveniently and accurately analyze their JSON data using Benford’s Law.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9be6f3057dda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to interact with the smart contract using web3.js]]></title>
            <link>https://medium.com/@anasselabbadi.pro/how-to-interact-with-the-smart-contract-using-web3-js-3c10623385d7?source=rss-70299b9b3050------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c10623385d7</guid>
            <category><![CDATA[solidity-tutorial]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Anass ELABBADI]]></dc:creator>
            <pubDate>Wed, 01 Jun 2022 11:39:37 GMT</pubDate>
            <atom:updated>2022-06-01T11:39:37.121Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is the sequel to the one below:</p><p><a href="https://medium.com/@anasselabbadi.pro/learn-about-the-essential-concepts-of-a-smart-contract-938717bd18ba">Learn about the essential concepts of a Smart Contract</a></p><p>Now that we have our smart contract ready, how can we get/send data to it ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vo097SVT9Ux3mabJ" /></figure><h3>Intro</h3><p>- When you want to call a function on a smart contract, you need to query one of these nodes and tell it:</p><ol><li>The address of the smart contract</li><li>The function you want to call, and</li><li>The variables you want to pass to that function.</li></ol><p>- Ethereum nodes only speak a language called JSON-RPC</p><h3>Web3 Providers</h3><p>- Setting up a web3 provider it’s kind of like setting the URL of the remote web server for your API calls in a traditional web app. It tells our code which node we should be talking to handle our reads and writes.</p><p>- However, there’s a third-party service so you don’t need to maintain your own Ethereum node in order to provide a DApp for your users — Infura.</p><h4>Infura</h4><p>- Infura is a service that maintains a set of Ethereum nodes with a caching layer for fast reads, which you can access for free through their API.</p><p>- to check if the user has Metamask installed on the browser, you can use the boilerplate below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3I_2N1JZtGEl8Gma" /></figure><h3>Contract ABI</h3><p>- ABI stands for Application Binary Interface. Basically it’s a representation of your contracts’ methods in JSON format that tells Web3.js how to format function calls in a way your contract will understand.</p><p>- When you compile your contract to deploy to Ethereum, the Solidity compiler will give you the ABI, so you’ll need to copy and save this in addition to the contract address.</p><h3>Instantiating a Web3.js Contract</h3><p>- Once you have your contract’s address and ABI, you can instantiate it in Web3 as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9Uqxsp1eO-vYoKiG" /></figure><h3>Calling Contract Functions</h3><p>- Web3.js has two methods we will use to call functions on our contract: call and send.</p><h4>Call</h4><p>- Call is used for view and pure functions. It only runs on the local node, and won’t create a transaction on the blockchain.</p><p>Review: view and pure functions are read-only and don’t change state on the blockchain. They also don’t cost any gas, and the user won’t be prompted to sign a transaction with MetaMask.</p><h4>Send</h4><p>- Send will create a transaction and change data on the blockchain. You’ll need to use send for any functions that aren’t view or pure.</p><h3>What’s a Wei?</h3><p>- A wei is the smallest sub-unit of Ether — there are 10¹⁸ wei in one ether.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/0*bKPNULbCQjXKZCXv" /></figure><p>we have reached the end of our article about smart contracts.</p><p>It’s Time for you now to write some code…</p><h4>First chapter:</h4><p><a href="https://medium.com/@anasselabbadi.pro/learn-about-the-essential-concepts-of-a-smart-contract-938717bd18ba">Learn about the essential concepts of a Smart Contract</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c10623385d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn about the essential concepts of a Smart Contract]]></title>
            <link>https://medium.com/coinmonks/learn-about-the-essential-concepts-of-a-smart-contract-938717bd18ba?source=rss-70299b9b3050------2</link>
            <guid isPermaLink="false">https://medium.com/p/938717bd18ba</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solidity-tutorial]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[smart-contract-blockchain]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <dc:creator><![CDATA[Anass ELABBADI]]></dc:creator>
            <pubDate>Wed, 01 Jun 2022 11:23:49 GMT</pubDate>
            <atom:updated>2022-10-24T10:29:08.557Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I’ll take you through a walkaround of all the essential concepts of a <strong><em>Smart Contract</em></strong>, that will help you build your own and have an overview of how they work.</p><p><em>I assume you have some experience programming in another language (e.g. Javascript).</em></p><h3>Table of Contents</h3><ul><li>Basics</li><li>Optimization</li><li>Time units</li><li>Function modifiers</li><li>Saving Gas With ‘View’ Functions</li><li>REVIEW FIRST PART</li><li>The payable Modifier</li><li>Random Numbers</li><li>Tokens on Ethereum</li><li>Transfer Logic</li><li>Assert vs Require</li></ul><h3>Basics</h3><p>Starting with the absolute basics:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*M_mX5h8V9FYjvRPw.png" /></figure><p>Solidity’s code is encapsulated in <strong>contracts</strong>. A contract is the fundamental building block of Ethereum applications:</p><p>- All variables and functions belong to a contract, and this will be the starting point of all your projects.</p><p>- All solidity source code should start with a “version pragma” — a declaration of the version of the Solidity compiler this code should use.</p><blockquote>pragma solidity &gt;=0.5.0 &lt;0.6.0;</blockquote><blockquote>contract HelloWorld <strong>{</strong></blockquote><blockquote><strong>}</strong></blockquote><p>- <strong>State variables</strong> are permanently stored in contract storage. This means they’re written to the Ethereum blockchain. Think of them like writing to a DB.</p><blockquote>contract Example <strong>{</strong></blockquote><blockquote><em>// This will be stored permanently in the blockchain</em></blockquote><blockquote>uint myUnsignedInteger = 100;</blockquote><blockquote><strong>}</strong></blockquote><p>- When you want a collection of something, you can use an array. There are two types of arrays in Solidity: fixed arrays and dynamic arrays:</p><blockquote><em>// Array with a fixed length of 2 elements:</em></blockquote><blockquote>uint[2] fixedArray;</blockquote><blockquote><em>// another fixed Array, can contain 5 strings:</em></blockquote><blockquote>string[5] string Array;</blockquote><blockquote><em>// a dynamic Array — has no fixed size, can keep growing:</em></blockquote><blockquote>uint[] dynamicArray;</blockquote><p>- You can declare an array as public, and Solidity will automatically create a getter method for it.</p><blockquote>Person<em>[]</em> public people;</blockquote><ul><li><strong>storage</strong> — variable is a state variable (store on blockchain)</li><li><strong>memory</strong> — variable is in memory and it exists while a function is being called</li><li><strong>calldata</strong> — special data location that contains function arguments, only available for external functions</li></ul><p>- We’re also providing instructions about where the _name variable should be stored- in <strong>memory</strong>. This is required for all reference types such as arrays, structs, mappings, and strings.</p><p>- If a function doesn’t change any values or write anything. We could declare it as a <strong>VIEW</strong></p><blockquote>function sayHello() public view returns (string memory){ … }</blockquote><p>- Solidity also contains <strong>pure</strong> functions, which means you’re not even accessing any data in the app. Consider the following:</p><blockquote>function _multiply(uint a, uint b) private pure returns (uint) {</blockquote><blockquote>return a * b;</blockquote><blockquote>}</blockquote><p>Note: It may be hard to remember when to mark functions as pure/view. Luckily the Solidity compiler is good about issuing warnings to let you know when you should use one of these modifiers.</p><p>- Ethereum has the hash function <strong><em>keccak256</em></strong> built in, which is a version of SHA3. A hash function basically maps an input into a random 256-bit hexadecimal number. A slight change in the input will cause a large change in the hash.</p><blockquote>keccak256(abi.encodePacked(“aaaab”));</blockquote><p>- <strong>Events</strong> are a way for your contract to communicate that something happened on the blockchain to your app front-end, which can be ‘listening’ for certain events and take action when they happen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H4OCbO_mmPtmO4kg" /></figure><p>- In Solidity, there are certain global variables that are available to all functions. One of these is msg.sender, which refers to the address of the person (or smart contract) who called the current function.</p><blockquote>Note: In Solidity, function execution always needs to start with an external caller. A contract will just sit on the blockchain doing nothing until someone calls one of its functions. So there will always be a <strong>msg.sender.</strong></blockquote><p>- <strong>Internal</strong> is the same as private, except that it’s also accessible to contracts that inherit from this contract.</p><p>- <strong>External</strong> is similar to public, except that these functions can ONLY be called outside the contract</p><ul><li>For our contract to talk to another contract on the blockchain that we don’t own, first we need to define an interface.</li></ul><p>- In Solidity you can return more than one value from a function.</p><p>- <strong>uint</strong> is an alias for <strong>uint256</strong></p><p>- Remember with strings, we have to compare their <strong>keccak256</strong> hashes to check equality</p><p>- A function <strong>modifier</strong> looks just like a function, but uses the keyword modifier instead of the keyword function. And it can’t be called directly like a function can — instead we can attach the modifier’s name at the end of a function definition to change that function’s behavior.</p><h3>Optimization</h3><p>- If you have multiple <strong>uints</strong> inside a <strong>struct</strong>, using a smaller-sized <strong>uint</strong> when possible will allow Solidity to pack these variables together to take up less storage.</p><p>- You’ll also want to <em>cluster identical data types together</em> (i.e. put them next to each other in the struct) so that Solidity can minimize the required storage space. For example, a struct with fields <strong><em>uint c; uint32 a; uint32 b;</em></strong> will cost less gas than a struct with fields <strong><em>uint32 a; uint c; uint32 b;</em></strong> because the uint32 fields are clustered together.</p><h3>Time units</h3><p>Solidity also contains the time units <strong><em>seconds, minutes, hours, days, weeks and years</em></strong>. These will convert to a <strong>uint</strong> of the number of seconds in that length of time.</p><p>So, 1 minutes is 60, 1 hours is 3600 (60 seconds x 60 minutes), 1 days is 86400 (24 hours x 60 minutes x 60 seconds), etc.</p><h3>Function modifiers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qZlH3fTKVTReQ50Q" /></figure><p>- You can see here that the olderThan modifier takes arguments just like a function does. And that the driveCar function passes its arguments to the modifier.</p><h3>Saving Gas With ‘View’ Functions</h3><p>- view functions don’t cost any gas when they’re called externally by a user.</p><p>- This is because view functions don’t actually change anything on the blockchain — they only read the data. So marking a function with view tells web3.js that it only needs to query your local Ethereum node to run the function, and it doesn’t actually have to create a transaction on the blockchain (which would need to be run on every single node, and cost gas).</p><blockquote>Note: If a view function is called internally from another function in the same contract that is not a view function, it will still cost gas. This is because the other function creates a transaction on Ethereum, and will still need to be verified from every node. So view functions are only free when they’re called externally.</blockquote><blockquote>Note: memory arrays must be created with a length argument (in this example, 3). They currently cannot be resized like storage arrays can with array.push(), although this may be changed in a future version of Solidity.</blockquote><h3>REVIEW FIRST PART :</h3><p>1) We have visibility modifiers that control when and where the function can be called from: <strong>private</strong> means it’s only callable from other functions inside the contract; <strong>internal</strong> is like <strong>private</strong> but can also be called by contracts that inherit from this one; <strong>external</strong> can only be called outside the contract; and finally <strong>public</strong> can be called anywhere, both internally and externally.</p><p>2) We also have state modifiers, which tell us how the function interacts with the BlockChain:</p><ul><li><strong>view</strong> tells us that by running the function, no data will be saved/changed.</li><li><strong>Pure</strong> tells us that not only does the function not save any data to the blockchain, but it also doesn’t read any data from the blockchain.</li></ul><p>Both of these don’t cost any gas to call if they’re called externally from outside the contract (but they do cost gas if called internally by another function).</p><p>3) Then we have custom modifiers: <strong>onlyOwner</strong> and <strong>aboveLevel</strong>, for example. For these we can define custom logic to determine how they affect a function.</p><blockquote>function test() external view onlyOwner anotherModifier { <em>/* … */</em>}</blockquote><h3>The payable Modifier</h3><p>- <strong>Payable</strong> functions are part of what makes Solidity and Ethereum so cool — they are a special type of function that can receive Ether.</p><blockquote>Note: If a function is not marked payable and you try to send Ether to it as above, the function will reject your transaction.</blockquote><p>- It is important to note that you cannot transfer Ether to an address unless that address is of type <strong>address payable</strong>.</p><p>- <strong>address(this).balance</strong> will return the total balance stored on the contract.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J-FNdRWUvYTAIYDT" /></figure><h3>Random Numbers</h3><p>- The best source of randomness we have in Solidity is the <strong><em>keccak256</em></strong> hash function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OIUHXsJuso6O9Vtr" /></figure><h4>Explanation:</h4><p>What this would do is take the timestamp of <strong>now</strong>, the <strong>msg.sender,</strong> and an incrementing <strong>nonce</strong> (a number that is only ever used once, so we don’t run the same hash function with the same input parameters twice).</p><p>It would then “pack” the inputs and use <strong>keccak</strong> to convert them to a random hash. Next, it would convert that hash to a <strong>uint</strong>, and then use <strong>% 100</strong> to take only the last 2 digits. This will give us a totally random number between 0 and 99.</p><h3>Tokens on Ethereum</h3><p>A <strong>token</strong> on Ethereum is basically just a smart contract that follows some common rules — namely it implements a standard set of functions that all other token contracts share, such as:</p><p><strong><em>transferFrom(address _from, address _to, uint256 _tokenId) and balanceOf(address _owner)</em></strong>.</p><p>- Basically a token is just a contract that keeps track of who owns how much of that token, and some functions so those users can transfer their tokens to other addresses.</p><p>- <strong>ERC721</strong> tokens are not interchangeable since each one is assumed to be unique, and are not divisible. You can only trade them in whole units, and each one has a unique ID. So these are a perfect fit for making our zombies tradeable.</p><blockquote>Note: Note that using a standard like ERC721 has the benefit that we don’t have to implement the auction or escrow logic within our contract that determines how players can trade / sell our zombies. If we conform to the spec, someone else could build an exchange platform for crypto-tradable ERC721 assets, and our ERC721 zombies would be usable on that platform. So there are clear benefits to using a token standard instead of rolling your own trading logic.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lR5Bafx8oZrGZKbw" /></figure><h3>Transfer Logic</h3><p>1- ​​The first way is the token’s owner calls <strong>transferFrom</strong> with his <strong>address</strong> as the <strong>_from</strong> parameter, the <strong>address</strong> he wants to transfer to as the <strong>_to</strong> parameter, and the <strong>_tokenId</strong> of the token he wants to transfer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KKdwA-QR9e-F1erK" /></figure><p>2- The second way is the token’s owner first calls <strong>approve</strong> with the address he wants to transfer to, and the <strong>_tokenId</strong> . The contract then stores who is approved to take a token, usually in a <strong>mapping (uint256 =&gt; address).</strong> Then, when the owner or the approved address calls <strong>transferFrom</strong>, the contract checks if that <strong>msg.sender </strong>is the owner or is approved by the owner to take the token, and if so it transfers the token to him.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pviwxoION5Wricrv" /></figure><h3>Assert vs Require</h3><ul><li><strong>Assert</strong> is similar to <strong>require</strong>, where it will throw an error if false. The difference between <strong>assert</strong> and <strong>require</strong> is that <strong>require</strong> will refund the user the rest of their gas when a function fails, whereas <strong>assert</strong> will not. So most of the time you want to use <strong>require</strong> in your code; <strong>assert</strong> is typically used when something has gone horribly wrong with the code (like a <strong>uint</strong> overflow).</li></ul><p>Congratulations, You now have an idea of how everything works, So in the next article (link below), we will see how you can interact with the smart contract from a front end application using <strong>web3.js</strong>.</p><p><a href="https://medium.com/@anasselabbadi.pro/how-to-interact-with-the-smart-contract-using-web3-js-3c10623385d7">How to interact with the smart contract using web3.js</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=938717bd18ba" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/learn-about-the-essential-concepts-of-a-smart-contract-938717bd18ba">Learn about the essential concepts of a Smart Contract</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to get discovered by Google’s search engine]]></title>
            <link>https://medium.com/@anasselabbadi.pro/how-to-get-discovered-by-googles-search-engine-8f3548fc01d2?source=rss-70299b9b3050------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f3548fc01d2</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[google-adwords]]></category>
            <category><![CDATA[ads]]></category>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[seo-tips]]></category>
            <dc:creator><![CDATA[Anass ELABBADI]]></dc:creator>
            <pubDate>Wed, 01 Jun 2022 10:24:25 GMT</pubDate>
            <atom:updated>2022-06-01T10:24:25.580Z</atom:updated>
            <content:encoded><![CDATA[<h3>Get discovered with search</h3><p>start with keyword research to understand what your customers are looking for, then use that info to access your successes and failures, brainstorm solutions to improve your weak spots and prioritize them, and don’t be afraid to redo your SEO Plan.</p><ol><li>Do keyword research</li><li>See where I appear in search results for specifics keywords</li><li>Look for the gaps in my SEO performance</li><li>Review results and adjust plan</li></ol><p>Here are 4 quick tips on how to stay up-to-date on search.</p><ol><li>Learn how search engines work.<br>Many have blogs that offer updates on new features, algorithm changes and suggestions on how to better optimize your website.</li><li>Keep an eye on changes and monitor how they affect your website.<br>For instance, you might read that the major search engines made a change that improves users’ experience on mobile search results. If your website isn’t optimized for mobile devices you’d probably want to update your website to be more mobile-friendly.</li><li>Find inspiration from other websites.<br>Do they offer free shipping? Are they active on social networks? Do they regularly update their website with photos? Adopt the practices that will work for your own business.</li><li>Talk to your customers.<br>They have the best insights on what content your site is missing, features that are needed, or products they are looking for.</li></ol><p>⭐️ Only a small number of keywords have very high search volume. But there’s a large number that have low search volume. This is what’s called the “<em>long tail</em>” of SEO .</p><p>⚠️ Warning:</p><blockquote><strong>Don’t add extra keywords or variations of keywords to your pages. Repeating them unnecessarily is called “keyword stuffing” and is against search engines’ guidelines.</strong></blockquote><p><strong>Frequency, competition </strong>and<strong> relevance </strong>are the three things to keep in mind when selecting keywords in order to get the right track for successful <em>SEO.</em></p><p>️️️⭐️ <em>Analytics</em> tools are a great way to get information about how content is performing, who visits the site and turns into a customer, and what content they interact with.</p><h3>Make search work for you</h3><p>There are several elements on your page that can tell the search engine that the page is about fresh fruits and vegetables. These include: <em>meta tags</em> (<em>used to generate the few short sentences that follow</em>) and <em>title</em> (<em>used to generate the first line shown</em>), <em>headings</em> and <em>the page copy itself.</em></p><p>️⭐️ A good meta description is usually two short sentences. It should also reinforce the title by using the keyword or phrase again.</p><p>⭐️ A title should be short and sweet; a description should match what the page is about. You should also consider what’s on the page itself</p><p>“backlinks” and social media are a great way to control things that happen off your site.</p><ul><li><em>backlinks. This is the term for a link from another website to your site. Think of links like votes</em></li></ul><p>If your potential customers are in different countries or speak multiple languages, there are many aspects to consider. We’ll go over the most important ones: language, localisation and country targeting.</p><ul><li>you need to speak your customers’ language — literally.<br>The first is to make sure that each page in a different language has its own unique web page.</li><li>mixing languages on the same page. <strong>BIG NO-NO<br></strong>when half your content is in French and the other half is in English, search engines can’t decide what language your content is in.<br>Avoid using automated services to translate your content.</li><li>help search engines understand the country (or countries!) you are targeting.<br>if your website has a country code top level domain name — ccTLD for short — it’s a strong indication that your site targets a specific country.</li></ul><blockquote><strong>Search engines may use a number of factors including where your website is hosted, its IP address, and information on your web pages.</strong></blockquote><h3>Be noticed with search ads</h3><h3>What is SEM ?</h3><p>A form of advertising that allows you to bid for your advertisement to show along with search results for keywords that people are typing in. This lets businesses be seen by people at the very moment they’re searching for the things a business offers. E.g. “SEO is a long process, but using SEM helped me get a lot more website traffic really quickly.”</p><h3>How it works ?</h3><p>Another really unique thing to know about SEM is the advertiser only pays when someone clicks on their ad. So if your ad appears, but no one clicks on it, you won’t be charged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/0*pJRzN9FgKPm3C6N_" /></figure><p>Yes, you heard that right! That’s why it’s called “pay-per-click” advertising.</p><h3>How SEM works ?</h3><p>With SEM , it’s very likely that people who clicked your ad are interested in what you have to offer, because they told you so. Or rather, they told the search engine when they searched for wedding photographer Cardiff, saw your ad and clicked on it.</p><h3>How an SEM auction works ?</h3><p>The winner is calculated when multiplying “Quality Score” X “Max CPC”</p><ul><li><em>Quality Score : A measure from 1 to 10 of how relevant your ads and landing pages are to the keywords you’re bidding on. Improving your Quality Score can help you achieve better ad positions and lower prices for clicks.</em></li><li><em>Max CPC : Your maximum cost­-per-­click (CPC), or bid price, is the highest amount that you are willing to pay for 1 click on your ad. However, you will not necessarily be charged the full Max CPC. For example, if your Max CPC is $1.25, you may only pay $1.04 for the click, depending on competitive factors. However, raising a bid might increase the likelihood of a higher ad position on the search engine results page. E.g. “I’ll bid as high as $2.25, but that’s my max CPC — I’m not made of money!”</em></li></ul><h3>What makes a good keyword ?</h3><p>Relevance</p><p>Traffic</p><p>Competition.</p><h3>How to make your ads stand out ?</h3><p>Relevance is the name of the game in search engine marketing. Try and write your advert’s headline to match the searcher’s words as closely as possible.</p><p>Examples :</p><ul><li>Get 25% Off Your Photo Collage.</li><li>Free Shipping on Purchases over <em>$</em>25.</li><li>Or for a specific keyword : Hire Wedding Photographer</li></ul><p>“call to action” to tell visitors what you want them to do when they get to your site. This is used in the second line of the advert.</p><p>Example :</p><ul><li>View our Wedding Photo Gallery!</li><li>Make a purchase …</li><li>Buy …</li></ul><p>Full Example of how the advert should looks like:</p><blockquote><em>Cardiff wedding photography.</em></blockquote><blockquote><em>Get 25% off your first order. Make your reservation now.</em></blockquote><h3>Improve your search campaigns</h3><h3>what is “Negative Keywords” ?</h3><p>These negative keywords will prevent your ads from appearing when people search for things that aren’t relevant to your business. For example, [-pencil], [-pastel] and [-horse]..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f3548fc01d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>