<?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 Mehmet YAMAN on Medium]]></title>
        <description><![CDATA[Stories by Mehmet YAMAN on Medium]]></description>
        <link>https://medium.com/@mehmetyaman?source=rss-d864e3e714cc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*N3w5sviaDt3N0HB_RXOutA.png</url>
            <title>Stories by Mehmet YAMAN on Medium</title>
            <link>https://medium.com/@mehmetyaman?source=rss-d864e3e714cc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 01:19:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mehmetyaman/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[ Understanding Function Selectors in Ethereum Smart Contracts]]></title>
            <link>https://medium.com/@mehmetyaman/understanding-function-selectors-in-ethereum-smart-contracts-b8d4972ec9d1?source=rss-d864e3e714cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8d4972ec9d1</guid>
            <dc:creator><![CDATA[Mehmet YAMAN]]></dc:creator>
            <pubDate>Sat, 01 Nov 2025 15:18:48 GMT</pubDate>
            <atom:updated>2025-11-01T15:37:23.799Z</atom:updated>
            <content:encoded><![CDATA[<p>When interacting with Ethereum smart contracts, every function call is uniquely identified by something called a <strong>function selector</strong>.<br> Although it’s just four bytes long, it plays a crucial role in how the Ethereum Virtual Machine (EVM) determines <em>which function to execute</em>.</p><p>In this article, we’ll break down what a function selector is, how it’s generated, and where it’s used — with simple code examples.</p><h3>🧩 What Is a Function Selector?</h3><p>A <strong>function selector</strong> is a <strong>4-byte identifier</strong> (that’s 8 hexadecimal characters) used to tell the EVM which function inside a smart contract should be called.</p><p>When you call a function in a smart contract, the transaction you send to the Ethereum network includes a <strong>data payload</strong>.<br> The first 4 bytes of this data field represent the function selector — basically a unique fingerprint for that function.</p><h3>⚙️ How Is It Generated?</h3><p>Each Solidity function has a <strong>function signature</strong>, which is the function name combined with its parameter types — without spaces.</p><p>Example:</p><pre>function transfer(address recipient, uint256 amount)</pre><p>Function signature:</p><pre>transfer(address,uint256)</pre><p>Now, Ethereum takes this signature string and applies the <strong>Keccak-256 hash function</strong> to it.</p><p>Then, the <strong>first 4 bytes</strong> of that hash become the function selector.</p><h3>Example Step-by-Step</h3><ol><li>Start with the signature:</li></ol><pre>transfer(address,uint256)</pre><p>2. Hash it with Keccak-256:</p><pre>keccak256(&quot;transfer(address,uint256)&quot;) =<br>a9059cbb000000000000000000000000bBbBBBBb...</pre><p>3. Take the first 4 bytes (8 hex characters):</p><pre>0xa9059cbb</pre><p>✅ <strong>Final selector:</strong> 0xa9059cbb</p><p>This selector represents the ERC-20 transfer function.</p><h3>💡 Where Function Selectors Are Used</h3><p>Function selectors live in the <strong>transaction data</strong> when you interact with a smart contract.</p><p>For example, when you call the ERC-20 transfer function, the transaction data might look like this:</p><pre>0xa9059cbb000000000000000000000000bBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB000000000000000000000000000000000000000000000000000000000000000a</pre><p>Let’s decode this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd0d16d802130e3265dad2f4ad84c834/href">https://medium.com/media/fd0d16d802130e3265dad2f4ad84c834/href</a></iframe><p>When the Ethereum Virtual Machine processes this transaction, it reads the selector and knows <strong>which function</strong> to run.</p><h3>🧠 How to Calculate Function Selectors Yourself</h3><p>Here are a few ways to compute a selector manually.</p><h3>In Solidity</h3><pre>bytes4 selector = bytes4(keccak256(&quot;transfer(address,uint256)&quot;));</pre><h3>In JavaScript (ethers.js)</h3><pre>ethers.utils.id(&quot;transfer(address,uint256)&quot;).slice(0, 10);<br>// &quot;0xa9059cbb&quot;</pre><h3>In Python (web3.py)</h3><pre>from eth_utils import keccak<br>keccak(text=&quot;transfer(address,uint256)&quot;).hex()[:10]</pre><p>🧭 Summary Table</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2aef7cbb7f4aa2eddbe817578b38e0a6/href">https://medium.com/media/2aef7cbb7f4aa2eddbe817578b38e0a6/href</a></iframe><h3>🚀 Why It Matters</h3><p>Understanding function selectors is essential when:</p><ul><li>Working with <strong>low-level contract interactions</strong> (using call, delegatecall, or staticcall)</li><li><strong>Debugging transactions</strong></li><li>Writing <strong>custom contract interfaces</strong></li><li>Building tools or scripts that encode contract calls manually</li></ul><p>It’s also foundational for learning about <strong>proxy patterns, fallback functions, and ABI encoding</strong> in more advanced Solidity development.</p><h3>🧩 Final Thoughts</h3><p>The function selector may look small, but it’s a vital part of how Ethereum keeps everything organized.<br> Those 4 bytes are what allow millions of contracts to live side-by-side without confusion.</p><p>Next time you send a transaction, remember — the EVM figures out which function to call based on that tiny 0xa9059cbb piece of magic.</p><p>✍️ <em>Written by </em><a href="https://www.linkedin.com/in/mehmetyaman/"><em>Mehmet Yaman</em></a><br> <em>Software Architect | Smart Contract Developer | Founder at </em><a href="https://codefirst.io/"><em>Codefirst</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8d4972ec9d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[⚠️ The Dark Side of Hexagonal Architecture]]></title>
            <link>https://medium.com/@mehmetyaman/%EF%B8%8F-the-dark-side-of-hexagonal-architecture-14ca4ec4e9a4?source=rss-d864e3e714cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/14ca4ec4e9a4</guid>
            <dc:creator><![CDATA[Mehmet YAMAN]]></dc:creator>
            <pubDate>Sat, 07 Jun 2025 12:37:53 GMT</pubDate>
            <atom:updated>2025-06-07T12:37:53.825Z</atom:updated>
            <content:encoded><![CDATA[<h3>When Clean Boundaries Create Hidden Costs</h3><blockquote>Hexagonal Architecture (Ports and Adapters) is elegant in theory — but what happens when that elegance becomes your bottleneck?</blockquote><h3>🧠 TL;DR</h3><p>Hexagonal Architecture offers modularity, testability, and flexibility. But it’s not a silver bullet. This article explores the <strong>downsides</strong>, both organizational and technical — including overengineering, interface bloat, performance hits, and challenges with asynchronous systems. You’ll also find <strong>visual diagrams</strong> and real-world advice on when <em>not</em> to use it.</p><h3>🏗️ What Is Hexagonal Architecture (Brief Recap)</h3><p>Hexagonal Architecture, also known as the <strong>Ports and Adapters</strong> pattern, promotes:</p><ul><li>Core domain logic at the center</li><li>Inbound ports (e.g., HTTP controllers, CLI commands)</li><li>Outbound ports (e.g., database, email services)</li><li>Adapter implementations wrapping real-world technologies</li></ul><pre>┌────────────────────┐<br>        │  Inbound Adapter   │<br>        │   (e.g. REST API)  │<br>        └────────┬───────────┘<br>                 │<br>        ┌────────▼──────────┐<br>        │   Inbound Port    │<br>        └────────┬──────────┘<br>                 │<br>        ┌────────▼──────────┐<br>        │    Application    │<br>        │      Logic        │<br>        └────────┬──────────┘<br>                 │<br>        ┌────────▼──────────┐<br>        │   Outbound Port   │<br>        └────────┬──────────┘<br>                 │<br>        ┌────────▼──────────┐<br>        │ Outbound Adapter  │<br>        │  (e.g. Database)  │<br>        └───────────────────┘</pre><h3>❌ Organizational Drawbacks</h3><h3>1. Overengineering for Small Projects</h3><p>Too many layers for simple CRUD apps. More glue code than logic.</p><h3>2. Steep Learning Curve</h3><p>Unfamiliar developers get lost in terminology and structure.</p><h3>3. Rigid Boundaries Kill Speed</h3><p>Prototyping becomes slow due to layer bureaucracy.</p><h3>4. Anemic Models and Logic Leakage</h3><p>Pure domain models often leak infrastructure logic.</p><h3>⚙️ Technical Pitfalls</h3><h3>5. Interface Explosion</h3><p>Too many interfaces = more boilerplate, harder testing.</p><h3>6. Async/Streaming Unfriendliness</h3><p>Hard to model Kafka/event-driven systems naturally.</p><h3>7. Integration Testing Overhead</h3><p>Tests become brittle across ports/adapters.</p><h3>8. Latency &amp; Runtime Cost</h3><p>Layered design introduces measurable latency.</p><h3>9. Cognitive Load</h3><p>Multiple files/layers for a single feature makes navigation tough.</p><h3>🤔 When Not to Use It</h3><ul><li>For MVPs or rapid prototypes</li><li>In reactive/event-based architectures</li><li>If team lacks experience with DI-heavy designs</li></ul><h3>✅ When It Works</h3><ul><li>In large, long-lived applications</li><li>Where business logic must outlive I/O layers</li><li>When testability and domain purity matter</li></ul><h3>📌 Summary Diagram</h3><pre>[ Dev Speed ↓ ] → [ Adapter Explosion ]<br>     ↓                      ↓<br>[ Over-Abstraction ] ← [ Interface Bloat ]<br>     ↓                      ↓<br>[ Misaligned Use Case ] → [ Testing Fatigue ]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6x1yWyCcX43Dy77Vu6Gs-g.png" /></figure><h3>🔧 Sample Scenario: Send Welcome Email</h3><p>Let’s imagine you want to send a welcome email to new users. Here’s a basic hexagonal implementation in TypeScript.</p><p><strong>Folder structure:</strong></p><pre>/src<br>  /domain<br>    Email.ts<br>    ports/EmailSenderPort.ts<br>  /application<br>    SendWelcomeEmail.ts<br>  /adapters/outbound<br>    SmtpEmailSender.ts<br>  /inbound<br>    HttpController.ts<br>  index.ts</pre><p><strong>domain/Email.ts</strong></p><pre>export class Email {<br>  constructor(public to: string, public subject: string, public body: string) {}<br>}</pre><p><strong>domain/ports/EmailSenderPort.ts</strong></p><pre>import { Email } from &quot;../Email&quot;;<br>export interface EmailSenderPort {<br>  send(email: Email): Promise&lt;void&gt;;<br>}</pre><p><strong>application/SendWelcomeEmail.ts</strong></p><pre>import { Email } from &quot;../domain/Email&quot;;<br>import { EmailSenderPort } from &quot;../domain/ports/EmailSenderPort&quot;;<br>export class SendWelcomeEmail {<br>  constructor(private emailSender: EmailSenderPort) {}<br>  async execute(userEmail: string) {<br>    const email = new Email(userEmail, &quot;Welcome!&quot;, &quot;Thanks for joining!&quot;);<br>    await this.emailSender.send(email);<br>  }<br>}</pre><p><strong>adapters/outbound/SmtpEmailSender.ts</strong></p><pre>import { EmailSenderPort } from &quot;../../domain/ports/EmailSenderPort&quot;;<br>import { Email } from &quot;../../domain/Email&quot;;<br>export class SmtpEmailSender implements EmailSenderPort {<br>  async send(email: Email): Promise&lt;void&gt; {<br>    console.log(`Sending SMTP email to ${email.to}`);<br>    // Real SMTP logic here<br>  }<br>}</pre><p><strong>inbound/HttpController.ts</strong></p><pre>import express from &quot;express&quot;;<br>import { SendWelcomeEmail } from &quot;../application/SendWelcomeEmail&quot;;<br>export const makeHttpController = (useCase: SendWelcomeEmail) =&gt; {<br>  const router = express.Router();<br>  router.post(&quot;/welcome&quot;, async (req, res) =&gt; {<br>    const { email } = req.body;<br>    await useCase.execute(email);<br>    res.send(&quot;Email sent!&quot;);<br>  });<br>  return router;<br>};</pre><p><strong>index.ts</strong></p><pre>import express from &quot;express&quot;;<br>import { SmtpEmailSender } from &quot;./adapters/outbound/SmtpEmailSender&quot;;<br>import { SendWelcomeEmail } from &quot;./application/SendWelcomeEmail&quot;;<br>import { makeHttpController } from &quot;./inbound/HttpController&quot;;<br>const smtpAdapter = new SmtpEmailSender();<br>const sendWelcomeEmail = new SendWelcomeEmail(smtpAdapter);<br>const app = express();<br>app.use(express.json());<br>app.use(&quot;/api&quot;, makeHttpController(sendWelcomeEmail));<br>app.listen(3000, () =&gt; console.log(&quot;Server running on :3000&quot;));</pre><p><strong>Unit test tip (mock):</strong></p><pre>class FakeEmailSender implements EmailSenderPort {<br>  public sent: Email[] = [];<br>  async send(email: Email): Promise&lt;void&gt; {<br>    this.sent.push(email);<br>  }<br>}</pre><h3>✍️ About the Author</h3><p>Written by <strong>Mehmet Yaman</strong>, software architect and lover of clean code.<br> Follow me or connect via <a href="https://www.linkedin.com/in/mehmetyaman/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14ca4ec4e9a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding C3 Linearization: The Algorithm Behind Python and Solidity’s Method Resolution Order]]></title>
            <link>https://medium.com/@mehmetyaman/understanding-c3-linearization-the-algorithm-behind-python-and-soliditys-method-resolution-order-f386b9a10696?source=rss-d864e3e714cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/f386b9a10696</guid>
            <dc:creator><![CDATA[Mehmet YAMAN]]></dc:creator>
            <pubDate>Sun, 01 Jun 2025 12:47:28 GMT</pubDate>
            <atom:updated>2025-06-01T12:47:28.699Z</atom:updated>
            <content:encoded><![CDATA[<p>In modern object-oriented programming, multiple inheritance introduces complexity around which method or property a class should inherit when multiple parent classes define the same member. This is where <strong>C3 Linearization</strong> comes into play.</p><p>Originally developed for the Dylan language and later adopted by <strong>Python</strong>, <strong>Solidity</strong>, and others, C3 provides a deterministic and consistent way to compute the <strong>Method Resolution Order (MRO)</strong>. In this article, we’ll dive into how C3 Linearization works, see how it behaves in Python and Solidity, and explore which languages implement it.</p><h3>What is C3 Linearization?</h3><p>C3 Linearization is an algorithm that determines the order in which classes are inherited, resolving ambiguities in multiple inheritance. It ensures:</p><ul><li><strong>Preservation of local precedence order</strong></li><li><strong>Monotonicity</strong></li><li><strong>Consistency</strong></li></ul><p>The core idea is to merge parent class linearizations in a way that respects their order and avoids conflicts.</p><h3>Example Abstract:</h3><p>Suppose you have the following class hierarchy:</p><pre>A<br>  / \<br> B   C<br>  \ /<br>   D</pre><p>Without C3, method resolution might be ambiguous. C3 produces a linear sequence (e.g., D -&gt; B -&gt; C -&gt; A) that defines the order methods are resolved.</p><h3>C3 Linearization in Python</h3><p>Python uses C3 linearization to compute the MRO for classes with multiple inheritance. The result is accessible via the __mro__ attribute or mro() method.</p><h3>Python Example:</h3><pre>class A:<br>    def greet(self): return &quot;A&quot;<br>class B(A):<br>    def greet(self): return &quot;B&quot;<br>class C(A):<br>    def greet(self): return &quot;C&quot;<br>class D(B, C):<br>    pass<br>print(D.__mro__)  # (&lt;class &#39;__main__.D&#39;&gt;, &lt;class &#39;__main__.B&#39;&gt;, &lt;class &#39;__main__.C&#39;&gt;, &lt;class &#39;__main__.A&#39;&gt;, &lt;class &#39;object&#39;&gt;)<br>print(D().greet())  # Output: B</pre><p>📌 D inherits from both B and C. Since B appears before C, B.greet is chosen due to the linearization order.</p><h3>C3 Linearization in Solidity</h3><p>Solidity also uses C3 Linearization to determine which function to call when multiple parent contracts define the same function.</p><h3>Solidity Example:</h3><pre>pragma solidity ^0.8.0;<br>contract A {<br>    function greet() public pure virtual returns (string memory) {<br>        return &quot;A&quot;;<br>    }<br>}<br>contract B is A {<br>    function greet() public pure virtual override returns (string memory) {<br>        return &quot;B&quot;;<br>    }<br>}<br>contract C is A {<br>    function greet() public pure virtual override returns (string memory) {<br>        return &quot;C&quot;;<br>    }<br>}<br>contract D is B, C {<br>    function greet() public pure override(B, C) returns (string memory) {<br>        return super.greet();<br>    }<br>}</pre><h3>MRO Computation:</h3><p>The MRO for D is:</p><pre>D -&gt; B -&gt; C -&gt; A</pre><p>So super.greet() will resolve to C.greet().</p><p>🧠 <strong>Tip:</strong> Solidity’s inheritance order matters! Switching B and C would change the result.</p><h3>C3 Linearization Algorithm: Concept</h3><p>The C3 algorithm works as follows:</p><ol><li>Start with the class itself</li><li>Merge the linearizations of its parents and the list of parents</li><li>Always pick the first head of the lists that is not present in the tail of any other lists</li><li>Remove the selected head from all lists</li><li>Repeat until all classes are consumed</li></ol><h3>Programming Languages Using C3 Linearization</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-fTdsUCf09d_cw8Jozf-g.png" /></figure><h3>Conclusion</h3><p>C3 Linearization brings structure and predictability to the often-chaotic world of multiple inheritance. Languages like Python and Solidity rely on it to resolve ambiguity and ensure consistency in method resolution.</p><p>By understanding how C3 linearization works, you can design better inheritance hierarchies and avoid common pitfalls in object-oriented programming.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f386b9a10696" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Bridging a Custom Token from Arbitrum to Ethereum: A Developer’s Guide]]></title>
            <link>https://medium.com/@mehmetyaman/bridging-a-custom-token-from-arbitrum-to-ethereum-a-developers-guide-226e93e0f3a2?source=rss-d864e3e714cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/226e93e0f3a2</guid>
            <dc:creator><![CDATA[Mehmet YAMAN]]></dc:creator>
            <pubDate>Fri, 30 May 2025 19:00:52 GMT</pubDate>
            <atom:updated>2025-05-30T19:13:50.853Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve deployed a custom ERC-20 token on <strong>Arbitrum</strong>, but now want to make it accessible on <strong>Ethereum mainnet</strong>, you’re in the right place.</p><p>In this guide, we’ll walk through <strong>how to bring your Arbitrum-native token to Ethereum</strong>, using canonical bridges, wrapper contracts, or custom bridging solutions — depending on your needs.</p><p>🧠 What Does “Bringing a Token to Ethereum” Mean?</p><p>Tokens deployed on Arbitrum are not automatically recognized on Ethereum. To move them across chains, you need to:</p><ol><li><strong>Lock</strong> tokens on Arbitrum</li><li><strong>Deploy</strong> a corresponding token on Ethereum (or use a bridge’s wrapper)</li><li><strong>Unlock or mint</strong> the equivalent amount on Ethereum</li></ol><p>This is usually done via a <strong>bridge</strong>, but for custom tokens, you may need extra steps.</p><p>⚙️ Step-by-Step: How to Bring a Token from Arbitrum to Ethereum</p><h3>🔹 Step 1: Verify Your Token is Fully Deployed on Arbitrum</h3><p>Ensure your token contract is live on Arbitrum One. You can confirm this on:</p><ul><li><a href="https://arbiscan.io/">Arbiscan</a></li><li>Or directly in your development tools (e.g., Hardhat + Arbitrum config)</li></ul><p>Example:</p><pre>// Sample ERC-20 Token on Arbitrum<br>contract MyToken is ERC20 {<br>    constructor() ERC20(&quot;MyToken&quot;, &quot;MTK&quot;) {<br>        _mint(msg.sender, 1000000 * 1e18);<br>    }<br>}</pre><h3>🔹 Step 2: Choose Your Bridging Strategy</h3><p>There are three main ways to make your token available on Ethereum:</p><h4>✅ Option A: Use Arbitrum’s Canonical Token Bridge (Manual Registration)</h4><ul><li>Suitable for <strong>canonical bridging</strong> via Arbitrum’s native bridge</li><li>Requires <strong>L1 token counterpart</strong></li><li>You <strong>register the L1-L2 mapping</strong></li></ul><h4>✅ Option B: Use Third-party Bridges</h4><ul><li>Platforms like <a href="https://hop.exchange/">Hop</a>, <a href="https://layerzero.network/">LayerZero</a>, or <a href="https://stargate.finance/">Stargate</a></li><li>You might need to <strong>create wrapped tokens</strong> and write <strong>bridge adapters</strong></li></ul><h4>✅ Option C: Create Your Own Cross-Chain Wrapper</h4><ul><li>Deploy an L1 version of your token</li><li>Write a <strong>bridge wrapper</strong> on Ethereum that can mint/burn tokens based on signals from Arbitrum</li><li>Use messaging protocol (e.g., Arbitrum’s Inbox/Outbox)</li></ul><p>For this tutorial, we’ll follow <strong>Option A</strong> with the <strong>Arbitrum Token Bridge</strong>.</p><h3>🔹 Step 3: Deploy a Corresponding Token Contract on Ethereum</h3><p>You’ll need to deploy an ERC-20 token contract on Ethereum that will act as the <strong>counterpart</strong> to your Arbitrum token. This is <strong>usually a proxy or wrapper</strong>.</p><blockquote>🛑 <strong>Important:</strong> This contract should not allow public minting. Instead, minting should be allowed <strong>only by the bridge</strong>.</blockquote><pre>contract L1MyToken is ERC20, Ownable {<br>    address public bridge;<br><br>    constructor(address _bridge) ERC20(&quot;MyToken&quot;, &quot;MTK&quot;) {<br>        bridge = _bridge;<br>    }<br><br>    function mint(address to, uint256 amount) external {<br>        require(msg.sender == bridge, &quot;Only bridge can mint&quot;);<br>        _mint(to, amount);<br>    }<br><br>    function burn(address from, uint256 amount) external {<br>        require(msg.sender == bridge, &quot;Only bridge can burn&quot;);<br>        _burn(from, amount);<br>    }<br>}</pre><p>Deploy this contract on Ethereum mainnet using Remix, Hardhat, or Foundry.</p><h3>🔹 Step 4: Register the Token Mapping via Arbitrum Bridge</h3><ol><li>Go to the Arbitrum Token Bridge UI</li><li>Connect your wallet to <strong>Ethereum</strong></li><li>Click <strong>“Add Custom Token”</strong></li><li>Provide: <br> → <strong>L1 Token address</strong> (Ethereum)<br> → <strong>L2 Token address</strong> (Arbitrum)</li><li>Submit the transaction (requires gas)</li></ol><p>Alternatively, you can use the Arbitrum SDK to programmatically register the token pair.</p><h3>🔹 Step 5: Lock &amp; Mint Workflow</h3><p>Once registered:</p><ul><li>When users send tokens from Arbitrum to Ethereum:<br> → The Arbitrum token is <strong>locked<br> → </strong>An equivalent amount is <strong>minted</strong> on Ethereum</li><li>When bridging back to Arbitrum:<br> → Ethereum tokens are <strong>burned<br> → </strong>Original tokens are <strong>released</strong> on Arbitrum</li></ul><p>The bridge contract handles this securely.</p><h3>🔹 Step 6: Add Your Token to Wallets (Optional UX Step)</h3><p>Provide users with your token’s details on both chains:</p><ul><li>Ethereum:<br> → Contract address<br> → Token symbol<br> → Decimals</li><li>Arbitrum:<br> → Same info, different address</li></ul><p>You can also embed <strong>Add to MetaMask</strong> buttons in your dApp using ethereum.request({ method: &#39;wallet_watchAsset&#39;, ... })</p><h3>🧪 Testing on Testnets</h3><p>Before deploying to mainnet:</p><ul><li>Use <strong>Arbitrum Sepolia</strong> + <strong>Ethereum Sepolia</strong></li><li>Deploy both token contracts</li><li>Simulate bridging</li><li>Test locking/minting workflows and verify token balances</li></ul><h3>🎯 Conclusion</h3><p>Bringing a custom token from Arbitrum to Ethereum isn’t just a transfer — it’s a matter of <strong>creating a secure representation</strong>, coordinating mint/burn logic, and maintaining consistency between two chains.</p><p>This guide gives you a developer-friendly starting point. For production, consider:</p><ul><li><strong>✅ Audit your contracts</strong></li><li><strong>✅ Use access control &amp;&amp; Role management (Ownable, Pausable)</strong></li><li><strong>✅ Monitor bridge events</strong></li><li><strong>✅ Automate with SDKs</strong></li><li><strong>✅ Upgradeable contracts (via proxies)</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*dpC_36W6j2qYQXq-alt3MA.gif" /></figure><h3>💬 Bonus: A Seinfeld Take on Token Bridging</h3><blockquote><strong><em>Jerry:</em></strong><em> “So you’re telling me… the token is not really </em>moving<em>?”<br> </em><strong><em>George:</em></strong><em> “No, Jerry. It’s being locked up… and then it’s minted somewhere else!”<br> </em><strong><em>Jerry:</em></strong><em> “So it’s like Kramer — disappearing from one apartment and magically showing up in another with no explanation!”<br> </em><strong><em>Elaine:</em></strong><em> “Except Kramer doesn’t need gas fees.”<br> </em><strong><em>George:</em></strong><em> “If only bridging my dignity was that easy…”</em></blockquote><h3>📎 Resources</h3><ul><li><a href="https://docs.arbitrum.io/build-decentralized-apps/token-bridging/overview">Arbitrum Token Bridge Docs</a></li><li><a href="https://github.com/OffchainLabs/arbitrum-sdk">Arbitrum SDK</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=226e93e0f3a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Upgrading from Etherscan API v1 to v2: What Developers Need to Know]]></title>
            <link>https://medium.com/@mehmetyaman/upgrading-from-etherscan-api-v1-to-v2-what-developers-need-to-know-4e7ae2d9746c?source=rss-d864e3e714cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e7ae2d9746c</guid>
            <dc:creator><![CDATA[Mehmet YAMAN]]></dc:creator>
            <pubDate>Sat, 17 May 2025 09:50:58 GMT</pubDate>
            <atom:updated>2025-05-17T09:50:58.894Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K-442Q9Y-CDJcseiOrPoCw.jpeg" /></figure><h3>✍️ About the Author</h3><p>Hi, I’m Mehmet Yaman — a software engineer passionate about Web3, APIs, and simplifying developer workflows. I specialize in helping teams build scalable blockchain integrations. You can connect with me on <a href="https://www.linkedin.com/in/mehmetyaman/">LinkedIn</a> to follow more of my work and insights.</p><p>Etherscan is a go-to tool for Ethereum developers and analysts. With the release of <strong>Etherscan API v2</strong>, developers can now benefit from a more structured, consistent, and reliable experience. If you’re currently using v1, this guide will walk you through what’s new, what’s better, and how to make the switch — with code examples included.</p><h3>🔁 Why Etherscan API v2?</h3><p>Version 1 of the API was incredibly useful but had some pain points:</p><ul><li>Inconsistent response structures</li><li>Minimal metadata</li><li>Flat JSON with lots of manual parsing</li><li>Confusing or opaque status codes</li></ul><p>Version 2 aims to fix all of that.</p><h3>📦 Key Improvements in v2</h3><p>Here’s what you can expect from the upgrade:</p><h3>1. ✅ Improved Status Handling</h3><p><strong>v1:</strong> Returns status as strings like “”1&quot;” or “”0&quot;”, requiring extra checks.</p><p><strong>v2:</strong> Introduces more descriptive status fields:</p><pre>{<br>  &quot;status&quot;: &quot;success&quot;,<br>  &quot;data&quot;: { ... }<br>}</pre><p>This allows easier condition handling and improves reliability.</p><h3>2. 🗂️ More Structured JSON Responses</h3><p>One of the most developer-friendly changes in Etherscan API v2 is the shift toward <strong>structured, nested JSON responses</strong>. In v1, responses were mostly flat or inconsistent, which made parsing them tedious — especially when handling arrays or multiple values tied to a single transaction.</p><h4>🧾 Example: Transaction Details</h4><p><strong>v1 Response:</strong></p><pre>{<br>  &quot;status&quot;: &quot;1&quot;,<br>  &quot;message&quot;: &quot;OK&quot;,<br>  &quot;result&quot;: [<br>    {<br>      &quot;blockNumber&quot;: &quot;17182158&quot;,<br>      &quot;timeStamp&quot;: &quot;1683275861&quot;,<br>      &quot;hash&quot;: &quot;0xabc123...&quot;,<br>      &quot;from&quot;: &quot;0xabc...&quot;,<br>      &quot;to&quot;: &quot;0xdef...&quot;,<br>      &quot;value&quot;: &quot;1000000000000000000&quot;,<br>      &quot;isError&quot;: &quot;0&quot;,<br>      &quot;txreceipt_status&quot;: &quot;1&quot;,<br>      &quot;gas&quot;: &quot;21000&quot;,<br>      &quot;gasPrice&quot;: &quot;1000000000&quot;,<br>      &quot;gasUsed&quot;: &quot;21000&quot;<br>    }<br>  ]<br>}</pre><p><strong>v2 Response:</strong></p><pre>{<br>  &quot;status&quot;: &quot;success&quot;,<br>  &quot;data&quot;: {<br>    &quot;transactions&quot;: [<br>      {<br>        &quot;hash&quot;: &quot;0xabc123...&quot;,<br>        &quot;block&quot;: {<br>          &quot;number&quot;: 17182158,<br>          &quot;timestamp&quot;: &quot;2023-05-05T12:57:41Z&quot;<br>        },<br>        &quot;from&quot;: &quot;0xabc...&quot;,<br>        &quot;to&quot;: &quot;0xdef...&quot;,<br>        &quot;value&quot;: {<br>          &quot;amount&quot;: &quot;1.0&quot;,<br>          &quot;unit&quot;: &quot;ETH&quot;,<br>          &quot;raw&quot;: &quot;1000000000000000000&quot;<br>        },<br>        &quot;gas&quot;: {<br>          &quot;used&quot;: 21000,<br>          &quot;limit&quot;: 21000,<br>          &quot;price&quot;: {<br>            &quot;amount&quot;: &quot;1.0&quot;,<br>            &quot;unit&quot;: &quot;Gwei&quot;,<br>            &quot;raw&quot;: &quot;1000000000&quot;<br>          }<br>        },<br>        &quot;status&quot;: &quot;success&quot;<br>      }<br>    ]<br>  }<br>}</pre><p><strong>Benefits:</strong></p><ul><li>Fields like gas, value, and block are grouped logically.</li><li>Units and raw values are separated for flexibility.</li><li>Timestamps are in ISO 8601 format.</li><li>Status is human-readable.</li></ul><h4>🪙 Example: ERC-20 Token Transfer</h4><p><strong>v1 Response:</strong></p><pre>{<br>  &quot;status&quot;: &quot;1&quot;,<br>  &quot;result&quot;: [<br>    {<br>      &quot;tokenName&quot;: &quot;USDT&quot;,<br>      &quot;tokenSymbol&quot;: &quot;USDT&quot;,<br>      &quot;tokenDecimal&quot;: &quot;6&quot;,<br>      &quot;from&quot;: &quot;0xabc...&quot;,<br>      &quot;to&quot;: &quot;0xdef...&quot;,<br>      &quot;value&quot;: &quot;1000000&quot;<br>    }<br>  ]<br>}</pre><p><strong>v2 Response:</strong></p><pre>{<br>  &quot;status&quot;: &quot;success&quot;,<br>  &quot;data&quot;: {<br>    &quot;transfers&quot;: [<br>      {<br>        &quot;token&quot;: {<br>          &quot;name&quot;: &quot;Tether USD&quot;,<br>          &quot;symbol&quot;: &quot;USDT&quot;,<br>          &quot;decimals&quot;: 6,<br>          &quot;contract&quot;: &quot;0xdac17f958d2ee523a2206206994597c13d831ec7&quot;<br>        },<br>        &quot;from&quot;: &quot;0xabc...&quot;,<br>        &quot;to&quot;: &quot;0xdef...&quot;,<br>        &quot;value&quot;: {<br>          &quot;amount&quot;: &quot;1.0&quot;,<br>          &quot;unit&quot;: &quot;USDT&quot;,<br>          &quot;raw&quot;: &quot;1000000&quot;<br>        },<br>        &quot;timestamp&quot;: &quot;2023-05-05T12:57:41Z&quot;,<br>        &quot;txHash&quot;: &quot;0xabc123...&quot;<br>      }<br>    ]<br>  }<br>}</pre><p><strong>Why This Matters</strong></p><ul><li>Less manual parsing logic</li><li>Easier integration with frontends (React, Vue, etc.)</li><li>TypeScript-friendly typing</li></ul><h3>3. 📊 Richer Metadata</h3><p>v2 includes more metadata per call. For example, token transfers now come with:</p><ul><li>Contract address</li><li>Full token info (name, symbol, decimals)</li><li>ISO-formatted timestamps</li></ul><h3>4. 🔐 Unified Authentication</h3><p>API key usage is more consistent and now supports per-key rate limits and scopes. No more guessing which endpoints require what.</p><h3>🚦 Rate Limiting: What You Need to Know</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bqF0jlQNwKD116Ga8n-ygw.jpeg" /><figcaption>Image from @STR/AFP/GettyImages</figcaption></figure><p>With the introduction of v2, <strong>rate limiting</strong> is now more transparent and structured. Each API key has a defined quota depending on your Etherscan plan (Free, Developer, Business, etc.), and exceeding that quota results in throttled or blocked requests.</p><blockquote>Visual overview of API rate limits and behavior when thresholds are exceeded.</blockquote><h4>📌 Why It Matters</h4><p>If you’re calling the API in loops, cron jobs, or real-time UIs, understanding and respecting the rate limits will prevent your app from being blocked or degraded.</p><h4>🧠 Best Practices</h4><ul><li>Implement <strong>exponential backoff</strong> or <strong>retry with delay</strong> when receiving HTTP 429 (Too Many Requests) responses.</li><li>Use <strong>caching</strong> for repeated requests (like token metadata).</li><li>Group requests intelligently to reduce total calls.</li></ul><h4>⚙️ Example: Handling 429 Errors in Node.js</h4><pre>const axios = require(&#39;axios&#39;);<br>async function fetchWithRateLimit(url, retries = 5) {<br>  try {<br>    const res = await axios.get(url);<br>    return res.data;<br>  } catch (err) {<br>    if (err.response &amp;&amp; err.response.status === 429 &amp;&amp; retries &gt; 0) {<br>      console.warn(&#39;Rate limit hit. Retrying in 3 seconds...&#39;);<br>      await new Promise(resolve =&gt; setTimeout(resolve, 3000));<br>      return fetchWithRateLimit(url, retries - 1);<br>    } else {<br>      throw err;<br>    }<br>  }<br>}</pre><h4>🔎 Rate Limit Headers</h4><p>Some Etherscan v2 endpoints return headers to help you track usage:</p><ul><li>X-RateLimit-Limit: Max requests allowed</li><li>X-RateLimit-Remaining: Requests left in the current window</li><li>X-RateLimit-Reset: Timestamp when the limit resets</li></ul><h3>🛠️ Migration Tips</h3><ul><li>✅ Check for status: success instead of string values</li><li>✅ Update your parser to match nested response formats</li><li>✅ Migrate your rate-limiting or caching logic if it’s based on v1 errors</li></ul><h3>🦪 Example Migration Code</h3><p>Here’s a basic Node.js example to fetch and parse a v2 transaction:</p><pre>const axios = require(&#39;axios&#39;);<br>const ETHERSCAN_API_KEY = &#39;YOUR_API_KEY&#39;;<br>const txHash = &#39;0xabc123...&#39;;<br>async function getTransaction(txHash) {<br>  const url = `https://api.etherscan.io/v2/transaction/${txHash}?apikey=${ETHERSCAN_API_KEY}`;<br>  const res = await axios.get(url);<br>  if (res.data.status !== &#39;success&#39;) throw new Error(&#39;API call failed&#39;);<br>  const tx = res.data.data.transactions[0];<br>  console.log(`Transaction from ${tx.from} to ${tx.to} for ${tx.value.amount} ${tx.value.unit}`);<br>}<br>getTransaction(txHash);</pre><h3>🧭 Final Thoughts</h3><p>If you’re building with Ethereum, the Etherscan v2 API is a clear upgrade. The new structure helps you write cleaner code, debug faster, and support advanced use cases. Migrating might take a bit of upfront work — but it pays off.</p><p>Happy building! 🛠️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e7ae2d9746c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Constructor Types in Flutter/Dart]]></title>
            <link>https://medium.com/@mehmetyaman/constructor-types-in-flutter-dart-585d55dde7b5?source=rss-d864e3e714cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/585d55dde7b5</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Mehmet YAMAN]]></dc:creator>
            <pubDate>Thu, 03 Mar 2022 15:33:32 GMT</pubDate>
            <atom:updated>2022-03-03T15:33:32.439Z</atom:updated>
            <content:encoded><![CDATA[<p>Constructor Types in Flutter/Dart</p><p>What is a class about, State Behaviour and Identity, and Constructors is very common way used in most object oriented languages to create and initialize an object. Dart enables to construct a class with optional styles, here you can find them,</p><h4>Constructor Types</h4><h4><strong>* Default</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KjPaKtTF7jk-S2h6Ttjvmw.png" /></figure><h4>* Paremetrized</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mNi2CtuKJ1psLOLTZbl4yw.png" /></figure><h4>* Named</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*88eiECKhgo9gQ-ZNpvhBUA.png" /></figure><h4>* Constant</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vl9BYV26Ty__McvjwJDcRg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=585d55dde7b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>