<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mr. G</title>
    <description>The latest articles on Forem by Mr. G (@mister_g).</description>
    <link>https://forem.com/mister_g</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F180356%2F6e034d7a-3f72-4e0c-ae6d-0f1cfe22dfde.png</url>
      <title>Forem: Mr. G</title>
      <link>https://forem.com/mister_g</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mister_g"/>
    <language>en</language>
    <item>
      <title>Wei, Gwei, ETH — Where and for what are they used?</title>
      <dc:creator>Mr. G</dc:creator>
      <pubDate>Wed, 03 Jan 2024 02:15:26 +0000</pubDate>
      <link>https://forem.com/mister_g/wei-gwei-eth-where-and-for-what-are-they-used-3oa8</link>
      <guid>https://forem.com/mister_g/wei-gwei-eth-where-and-for-what-are-they-used-3oa8</guid>
      <description>&lt;p&gt;The Ethereum blockchain, an integral part of the cryptocurrency world, operates with its own unique units of account. Understanding these units — Wei, Gwei, and ETH — is crucial for interacting with Ethereum, whether for executing smart contracts, making transactions, or developing decentralized applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wei, Gwei, and ETH: The Basics&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wei:&lt;/strong&gt; The smallest denomination of Ether (ETH), the native cryptocurrency of the Ethereum blockchain. Just like a cent is to a dollar, a Wei is to an Ether. Wei is commonly used when dealing with smart contracts and lower-level Ethereum protocols, as it allows for precise calculations without floating point numbers. When retrieving any value from the blockchain, especially in programming contexts, the value is often denoted in Wei to maintain accuracy and avoid rounding errors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gwei:&lt;/strong&gt; Short for ‘Giga-Wei,’ it is equivalent to 1,000,000,000 Wei. Gwei is most commonly used in the context of gas fees, which are the fees paid to execute transactions and smart contracts on the Ethereum network. Gas fees are calculated in Gwei because it provides a good balance between granularity and practicality. Gwei effectively scales Wei to a more human-readable form, making it easier to understand and calculate transaction costs without dealing with excessively large numbers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5lme83MQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0hp97wcnm3ixrhw8o8a2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5lme83MQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0hp97wcnm3ixrhw8o8a2.png" alt="Example of gas price on Ethereum" width="800" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Eth:&lt;/strong&gt; Represents one whole coin or token. When developers refer to “1 ETH” in Web 2.0-Web3 integrations, it doesn’t necessarily mean one Ether from the Ethereum blockchain. Instead, it represents a standard unit of any cryptocurrency or digital token involved in the integration. In a blockchain application where multiple types of tokens are used, each token, regardless of its underlying technology or value, could be abstractly referred to as “1 ETH” within the code or system design. See the code below when the “ether” is used as a conversion unit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Calculating Gas Fees&lt;/strong&gt;&lt;br&gt;
To calculate the cost of a transaction on the Ethereum network, you need to consider both the gas price (in Gwei) and the amount of gas used. The formula is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Total Cost (in ETH) = Gas Price (in Gwei) × Gas Used × Conversion Factor&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The conversion factor is used to convert Gwei into ETH (since 1 ETH = 1,000,000,000 Gwei).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Example&lt;/strong&gt;&lt;br&gt;
Using Web3.js, a popular JavaScript library for Ethereum, you can calculate the cost of a transaction. Here’s a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Web3 = require('web3');

// Initialize Web3
const web3 = new Web3('RPC_API_KEY');

// Function to calculate transaction cost in USD
async function calculateTransactionCostInUSD(gasPriceGwei, gasUsed, ethPriceUSD) {
    // Convert gas price from Gwei to Wei
    const gasPriceWei = web3.utils.toWei(gasPriceGwei.toString(), 'gwei');

    // Calculate total cost in Wei
    const totalCostWei = gasPriceWei * gasUsed;

    // Convert total cost to ETH
    const totalCostEth = web3.utils.fromWei(totalCostWei.toString(), 'ether');

    // Convert total cost to USD
    const totalCostUSD = totalCostEth * ethPriceUSD;

    return totalCostUSD;
}

// Example usage
const gasPriceGwei = 17; // Example gas price in Gwei
const gasUsed = 21000; // Standard gas limit for a simple transaction
const ethPriceUSD = 2500; // Current price of ETH in USD

calculateTransactionCostInUSD(gasPriceGwei, gasUsed, ethPriceUSD)
    .then(cost =&amp;gt; console.log(`Total Transaction Cost: $${cost.toFixed(2)} USD`))
    .catch(error =&amp;gt; console.error(error));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&lt;br&gt;
&lt;em&gt;Total Transaction Cost: $0.89 USD&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You check a simple application to convert some values in &lt;a href="https://devweb3.co/converter"&gt;DevWeb3.co&lt;/a&gt;. There, you can find more tools to help you better understand how to integrate your Web 2.0 applications or develop new ones using Solidity.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>solidity</category>
      <category>javascript</category>
      <category>web3js</category>
    </item>
    <item>
      <title>Getting the ABI and Solidity Contracts Functions with JavaScript: A Developer’s Journey</title>
      <dc:creator>Mr. G</dc:creator>
      <pubDate>Thu, 16 Nov 2023 03:11:57 +0000</pubDate>
      <link>https://forem.com/mister_g/getting-the-abi-and-solidity-contracts-functions-with-javascript-a-developers-journey-56n2</link>
      <guid>https://forem.com/mister_g/getting-the-abi-and-solidity-contracts-functions-with-javascript-a-developers-journey-56n2</guid>
      <description>&lt;p&gt;Alice, a freelance developer with a knack for tackling new frontiers, recently embarked on a mission that many would find daunting. Freshly hired to develop a front-end interface for a series of Ethereum smart contracts, she found herself at the crossroads of innovation. With her contracts developed in Solidity, Alice’s immediate goal was to create a page listing the functions of these contracts. But Alice was always one to think ahead; she knew that eventually, she wanted to interact with these functions directly through her interface.&lt;/p&gt;

&lt;p&gt;As Alice delved into the depths of Web3.js, she realized that her starting point was to understand the ABI — Application Binary Interface — of her contracts. The ABI is the gateway through which her JavaScript code would communicate with the blockchains, understanding the shapes and forms of her Solidity contract functions.&lt;/p&gt;

&lt;p&gt;With her trusty text editor and a console full of logs, Alice began her journey by fetching the ABI for her contract. She knew that once she had the ABI, listing the contract’s functions would be a piece of cake. She turned to Web3.js, which allowed her to interact with a node through a RPC, using an HTTP connection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import axios from "axios";

const response = await axios.get(`https://api-testnet.polygonscan.com/api?module=contract&amp;amp;action=getabi&amp;amp;address=${contractAddress}&amp;amp;apikey=&amp;lt;YOUR_API_KEY_HERE&amp;gt;`);
if (response &amp;amp;&amp;amp; response.data &amp;amp;&amp;amp; response.data.status === "1" &amp;amp;&amp;amp; response.data.result) {
    const abi = JSON.parse(response.data.result);
    const functions = abi.filter((item) =&amp;gt; item.type === "function");
    console.log("ABI", abi);
    console.log("Functions", functions);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In conclusion, by understanding and utilizing the ABI of Solidity contracts, JavaScript and Web3.js developers like Alice can create powerful front-end applications that interact seamlessly with the Ethereum blockchain. With the ABI as the blueprint and Web3.js as the toolset, the possibilities for blockchain-enabled applications are virtually limitless.&lt;/p&gt;

&lt;p&gt;Alice’s story is a testament to the power of bridging the gap between smart contracts and the user interface, and her journey illuminates the path for other developers to follow in the exciting realm of Web3 development.&lt;/p&gt;

&lt;p&gt;You can also find a list and execute functions of a contract using tools provided by &lt;a href="https://devweb3.co"&gt;DevWeb3.co&lt;/a&gt;. They have a collection of tools that can help you integrate your application with any EVM-compatible blockchain.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>solidity</category>
      <category>javascript</category>
      <category>ethereum</category>
    </item>
    <item>
      <title>Getting Your Coin Balances with JavaScript</title>
      <dc:creator>Mr. G</dc:creator>
      <pubDate>Wed, 15 Nov 2023 17:01:08 +0000</pubDate>
      <link>https://forem.com/mister_g/getting-your-coin-balances-with-javascript-59k1</link>
      <guid>https://forem.com/mister_g/getting-your-coin-balances-with-javascript-59k1</guid>
      <description>&lt;p&gt;Alice, a proactive investor, ventured into the volatile yet exciting world of cryptocurrencies. She meticulously spread her investments across various networks to minimize risk and maximize potential gains. Aware of the importance of security, Alice backed up her private key, ensuring a layer of safety for her digital assets.&lt;/p&gt;

&lt;p&gt;However, upon transitioning to a new computer, Alice faced a minor setback. Her trusty MetaMask, which once offered a seamless view of her portfolio, was not yet installed. The initial sense of panic was quickly subdued by her technical acumen; she realized it was an opportunity to create a personalized solution.&lt;/p&gt;

&lt;p&gt;Alice decided to develop a small application to monitor her diverse coin holdings across different networks. She envisioned a tool that would not only display her balances in real time but also provide alerts for significant market movements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function getBalances() {
    const walletAddress = "&amp;lt;WALLET_ADDRESS&amp;gt;";
    const networks = [
        {
            name: "Polygon Mumbai",
            rpc: "https://polygon-testnet.public.blastapi.io/",
        },
        {
            name: "Fantom Testnet",
            rpc: "https://rpc.ankr.com/fantom_testnet/",
        },
        {
            name: "Binance Smart Chain Testnet",
            rpc: "https://data-seed-prebsc-1-s1.binance.org:8545/",
        },
    ];

    networks.map(async (network) =&amp;gt; {
        const web3 = new Web3(network.rpc);
        const balance = await web3.eth.getBalance(walletAddress);
        console.log(network.name, "balance", Web3.utils.fromWei(balance.toString(), "ether"));
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are not sure about the networks where you have coins, you can go to &lt;a href="https://www.ankr.com/rpc/"&gt;ankr&lt;/a&gt;and add all of the RPCs to check.&lt;/p&gt;

&lt;p&gt;You can try &lt;a href="https://devweb3.co"&gt;DevWeb3.co&lt;/a&gt; and see what they offer as a tool for checking wallet balances across multiple networks. This utility is part of a broader toolkit aimed at assisting Web 2.0 developers in exploring and integrating Web3 technologies into their workflows.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Your Key, Your Crypto: Retrieving Your Wallet Address from a Private Key Using JavaScript and Web3.js</title>
      <dc:creator>Mr. G</dc:creator>
      <pubDate>Thu, 09 Nov 2023 02:51:07 +0000</pubDate>
      <link>https://forem.com/mister_g/your-key-your-crypto-retrieving-your-wallet-address-from-a-private-key-using-javascript-and-web3js-4ed7</link>
      <guid>https://forem.com/mister_g/your-key-your-crypto-retrieving-your-wallet-address-from-a-private-key-using-javascript-and-web3js-4ed7</guid>
      <description>&lt;p&gt;Alice was an astute investor who had the foresight to invest in cryptocurrency during its nascence, understanding its potential to yield significant returns. In a move to ensure absolute security, she wrote down her private key on paper, choosing not to rely on any digital wallet services. However, after stepping away from the market during a bearish phase, she returned to find the ink on her paper fading. The rush to recover her investments led her to her parent's house, where a legible copy of her private key lay safe. Yet, despite having the key, she faced another challenge: she had never stored her wallet address and now needed a secure way to retrieve it without compromising her privacy.&lt;/p&gt;

&lt;p&gt;This article is tailored for developers looking to assist investors like Alice. It aims to provide a robust method for converting a private key into a wallet address within the safety of a local environment, circumventing the risks associated with online tools. We'll delve into a technical solution that ensures Alice can access her wallet address securely, reaffirming her decision to maintain privacy and control over her crypto assets. Join us as we explore a developer-centric approach to bridging the gap between a private key and its corresponding wallet address, ensuring peace of mind for the security-conscious investor.&lt;/p&gt;

&lt;p&gt;The process of converting a private key to a wallet address is not just about running a script; it's about understanding the security implications and the mechanics of blockchain technology.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Web3 from "web3";

const web3 = new Web3();
const account = web3.eth.accounts.privateKeyToAccount("&amp;lt;PRIVATE_KEY&amp;gt;");
console.log("Account Address:", account.address);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In essence, these lines will take the private key as input, generate the corresponding public key, and then derive the wallet address from this public key through a series of cryptographic transformations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping it Safe
&lt;/h2&gt;

&lt;p&gt;When you use your private key to find your wallet address, make sure to do it safely. Do it on your own computer or use an online tool you know is safe. Keep your private key a secret and store it in a safe place after you're done.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;To sum it up, turning a private key into a wallet address is something you can do safely on your own. Over at &lt;a href="https://devweb3.co"&gt;DevWeb3.co&lt;/a&gt;, we have a tool to help you do this without risking your private information. Also, other helpful things like an online editor for your solidity development. Remember, it's all about keeping your crypto safe and sound.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Take Control of Your Crypto: Creating Your Wallet with JavaScript</title>
      <dc:creator>Mr. G</dc:creator>
      <pubDate>Thu, 09 Nov 2023 02:11:12 +0000</pubDate>
      <link>https://forem.com/mister_g/take-control-of-your-crypto-creating-your-wallet-with-javascript-5en4</link>
      <guid>https://forem.com/mister_g/take-control-of-your-crypto-creating-your-wallet-with-javascript-5en4</guid>
      <description>&lt;p&gt;In the world of cryptocurrencies, having a secure place to store your digital assets is paramount. Many newcomers to the crypto space start by leaving their funds on centralized exchanges. While this may seem convenient at first, it presents a significant risk. Centralized platforms can be vulnerable to hacks and bankruptcies, and you’re not in full control of your crypto assets. The solution? Create your own wallet using some JavaScript, web3.js in your local environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Create Your Own Wallet?
&lt;/h2&gt;

&lt;p&gt;Creating your own wallet doesn’t just enhance security; it empowers you. With a self-created wallet, you have:&lt;/p&gt;

&lt;p&gt;Full Control: Only you have access to your funds.&lt;br&gt;
Privacy: Your identity and transactions are not tied to an exchange.&lt;br&gt;
Direct Interaction with DApps: Engage with decentralized applications without intermediaries.&lt;br&gt;
Reduced Risk: No centralized point of failure that hackers can target. (Assuming you don’t have any malware installed on your computer)&lt;/p&gt;
&lt;h2&gt;
  
  
  How Easy Is It?
&lt;/h2&gt;

&lt;p&gt;You might think that setting up a wallet is a technical challenge, but web3.js has simplified the process. This JavaScript library interacts with the Ethereum blockchain and makes it straightforward to create a secure wallet. Here’s what you’ll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A computer&lt;/li&gt;
&lt;li&gt;A basic understanding of JavaScript&lt;/li&gt;
&lt;li&gt;The web3.js library&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the following sections, we’ll provide a coding example to guide you through the process.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Risks of Self-Custody
&lt;/h2&gt;

&lt;p&gt;While creating your own wallet with web3.js gives you control, it also comes with responsibility. The most critical aspect is the safekeeping of your private key. Losing access to your private key means losing access to your crypto, with no way to recover it. It’s essential to store your key securely, such as by using a hardware wallet or a secure password manager, and to have multiple backups in different locations.&lt;/p&gt;

&lt;p&gt;Creating Your Wallet using 2 lines of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const web3 = new Web3();
const wallet = web3.eth.accounts.create();
console.log("Your new wallet address:", wallet.address);
console.log("Private Key:", wallet.privateKey);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  This wallet in MetaMask
&lt;/h2&gt;

&lt;p&gt;In addition to creating a wallet, you have the flexibility to import and manage it using MetaMask. This can be useful if you are creating a new token and need to follow the balance and transfer some to test it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ready to Dive In?
&lt;/h2&gt;

&lt;p&gt;If you’re ready to take the leap and create your own wallet, you can start experimenting today. &lt;a href="https://devweb3.co"&gt;DevWeb3.co&lt;/a&gt; is an excellent resource for anyone looking to step into the world of decentralized wallets. They offer access to faucets, so you can obtain coins to test out smart contracts without risking your own funds.&lt;/p&gt;

&lt;p&gt;Remember, with great power comes great responsibility. Secure your keys, and embark on your journey towards true financial autonomy.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>javascript</category>
      <category>cryptocurrency</category>
      <category>programming</category>
    </item>
    <item>
      <title>Retrieving Implementation Contract Addresses from Proxy Contracts in EVM Networks</title>
      <dc:creator>Mr. G</dc:creator>
      <pubDate>Thu, 09 Nov 2023 02:07:46 +0000</pubDate>
      <link>https://forem.com/mister_g/retrieving-implementation-contract-addresses-from-proxy-contracts-in-evm-networks-38fm</link>
      <guid>https://forem.com/mister_g/retrieving-implementation-contract-addresses-from-proxy-contracts-in-evm-networks-38fm</guid>
      <description>&lt;p&gt;Proxy patterns, such as Transparent and UUPS (Universal Upgradeable Proxy Standard), are critical in the upgradeable design of smart contracts. However, discerning the implementation contract address from a proxy through block explorers can be challenging. This article aims to instruct developers on extracting this information using JavaScript and web3.js, enhancing the integration of Web 2.0 with smart contracts.&lt;/p&gt;

&lt;p&gt;Proxy contracts serve as an intermediary, delegating operations to implementation contracts, which contain the executable logic. This delegation facilitates the upgradeability of contracts without altering the deployed address. Think about a proxy, a controller, where you can change the logic in an API service but don’t need to change the endpoint or how to call the method. The implementation can be related to a service class. It holds the logic and can be updated if needed.&lt;/p&gt;

&lt;p&gt;Patterns: Transparent proxies separate the proxy administration and logic concerns, allowing different addresses for admin and logic operations. In contrast, UUPS proxies embed the upgrade logic within the implementation contract itself, offering a more gas-efficient and elegant upgrade mechanism. Also, Transparent proxies have a separate Admin contract responsible for Access Control, Upgrades, and Ownership control.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mFlkz4Hf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijiyqoy1bq3xslaz3k8g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mFlkz4Hf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijiyqoy1bq3xslaz3k8g.png" alt="Image description" width="800" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Block Explorer showing the current implementation contract address&lt;br&gt;
Limitations of Block Explorers: Block explorers can show the current implementation address, but in some cases, these addresses can be different from the registered on-chain. If you deploy a new implementation contract, it will take a few minutes for the Block Explorer to update this information. If any error occurs, this information will not be trustworthy.&lt;/p&gt;

&lt;p&gt;Extracting the Address from the blockchain: To circumvent this limitation, developers can employ web3.js to interact with the Ethereum blockchain and programmatically determine the implementation contract’s address. The UUSP and Transparent Proxy patterns should follow the EIP-1967, which sets a specific storage slot to hold the implementation contract address. Based on this information, you can use the code below to extract the current address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Web3 from 'web3';

const web3 = new Web3("https://polygon-testnet.public.blastapi.io/");
const implementationStorage = await web3.eth.getStorageAt(proxyAddress, "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc");
if (implementationStorage === "0x0000000000000000000000000000000000000000000000000000000000000000") return null;
const implementationAddressHex = "0x" + implementationStorage.slice(-40); // Extract the last 40 characters (20 bytes) from the storage content
const currentImplementationAddress = web3.utils.toChecksumAddress(implementationAddressHex); // Validate the address
console.log("Found current Implementation contract address", currentImplementationAddress);

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

&lt;/div&gt;



&lt;p&gt;For the Transparent pattern, you can also get the Proxy Admin contract using the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Web3 from 'web3';

const web3 = new Web3("https://polygon-testnet.public.blastapi.io/");
const implementationProxyAdminStorageContentTransparent = await web3.eth.getStorageAt(proxyAddress, "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103");
if (implementationProxyAdminStorageContentTransparent !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
  const implementationAddressProxyAdminHexTransparent = "0x" + implementationProxyAdminStorageContentTransparent.slice(-40);
  _proxyInfo.currentProxyAdminAddress = web3.utils.toChecksumAddress(implementationAddressProxyAdminHexTransparent); // Validate the address
  console.log("Found Proxy Admin contract address in Transparent pattern", _proxyInfo.currentImplementationAddress);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember to initialize Web3 with your own RPC before using it.&lt;/p&gt;

&lt;p&gt;If you are a Web 2.0 developer, this code will provide a more assertive way to know the current implementation contract and how to interact with it if needed.&lt;/p&gt;

&lt;p&gt;To help you read, change, test, and deploy contracts. Check out my project: &lt;a href="https://devweb3.co"&gt;DevWeb3.co&lt;/a&gt;&lt;/p&gt;

</description>
      <category>solidity</category>
      <category>web3</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>A Missed Modifier, A Race Against Time: The Genesis of a Handy Online Smart Contract Editor</title>
      <dc:creator>Mr. G</dc:creator>
      <pubDate>Sun, 05 Nov 2023 04:09:35 +0000</pubDate>
      <link>https://forem.com/mister_g/a-missed-modifier-a-race-against-time-the-genesis-of-a-handy-online-smart-contract-editor-2ll8</link>
      <guid>https://forem.com/mister_g/a-missed-modifier-a-race-against-time-the-genesis-of-a-handy-online-smart-contract-editor-2ll8</guid>
      <description>&lt;p&gt;Navigating the thrilling yet challenging realm of Solidity can sometimes throw curveballs our way. One such unexpected moment knocked on my door when I deployed a smart contract onto the mainnet, only to later realize a crucial oversight - I had missed adding the "onlyOwner" modifier in a pivotal withdraw function. The stakes were high and the clock was ticking, but there was a catch: I was miles away from my computer where my trusted Visual Studio Code lay idle.&lt;/p&gt;

&lt;p&gt;With a pounding heart and the tick-tock of time echoing in my ears, I found myself racing back home to access my development environment. Each passing minute felt like an opportunity for disaster as the contract sat vulnerable on the mainnet. The thought gnawed at me - if only I had an online tool at my disposal, I could rectify the mistake promptly from anywhere, saving precious time and potentially, a lot of money.&lt;/p&gt;

&lt;p&gt;That harrowing experience wasn't just an eye-opener, but a catalyst. It spurred the idea of crafting an online smart contract editor that could be accessed anytime, anywhere, ensuring that other developers wouldn't have to face a similar helpless scenario. The vision was clear: a simple, intuitive online platform that could fetch, edit, test, and redeploy smart contracts swiftly, all you'd need was a browser and your owner wallet at hand.&lt;/p&gt;

&lt;p&gt;This vision materialized into a free online tool, a boon for developers like myself who found themselves in need of a quick fix without the luxury of a full-fledged development environment nearby. The tool is designed to fetch the code of verified contracts from various networks, allowing real-time editing and testing. With a few clicks, you could redeploy the amended contract, right from the comfort of... well, anywhere.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u2h-asrB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oq717q123q0h3bx246m7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u2h-asrB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oq717q123q0h3bx246m7.png" alt="DevWeb3.co Editor Screen" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The tool proved its mettle during its inaugural run. I was able to rectify the missing "onlyOwner" modifier issue effortlessly, a stark contrast to the frantic rush back home I had experienced earlier. The accessibility and ease that this online editor provided were game-changing, turning a potential crisis into a smooth, manageable task.&lt;/p&gt;

&lt;p&gt;Now, this tool stands as a free, accessible platform for all Solidity developers, encapsulating the lessons from that frantic day and offering a solution to swiftly tackle such challenges head-on, no matter where you are.&lt;/p&gt;

&lt;p&gt;As of now, the tool is in its alpha stage, embarking on a journey filled with potential enhancements and refinements. The path ahead is exciting, but it's not one to tread alone. A collaborative effort can propel this tool to new heights, making it more robust and efficient. I warmly invite fellow developers to explore the tool, contribute with feedback, and share new ideas to enrich its capabilities. Together, we can fine-tune this platform to better serve the community, ensuring that no developer is left stranded in face of unexpected smart contract hurdles, no matter where they are.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://devweb3.co/sourcecode"&gt;Try DevWeb3 Editor&lt;/a&gt;&lt;/p&gt;

</description>
      <category>solidity</category>
      <category>web3</category>
      <category>programming</category>
      <category>ethereum</category>
    </item>
  </channel>
</rss>
