<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nikita Martilove on Medium]]></title>
        <description><![CDATA[Stories by Nikita Martilove on Medium]]></description>
        <link>https://medium.com/@nikitamartilove?source=rss-dd202eefe90------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IoT-v5Oce_gIUo7IBV4yMQ.jpeg</url>
            <title>Stories by Nikita Martilove on Medium</title>
            <link>https://medium.com/@nikitamartilove?source=rss-dd202eefe90------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 23:44:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nikitamartilove/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Create a simple discord bot with Node.js]]></title>
            <link>https://nikitamartilove.medium.com/create-a-simple-discord-bot-with-node-js-1d1c88cc00f?source=rss-dd202eefe90------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d1c88cc00f</guid>
            <category><![CDATA[discord-server]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[teach]]></category>
            <category><![CDATA[study]]></category>
            <category><![CDATA[discord-bot]]></category>
            <dc:creator><![CDATA[Nikita Martilove]]></dc:creator>
            <pubDate>Sun, 19 Feb 2023 17:43:18 GMT</pubDate>
            <atom:updated>2023-02-19T18:21:20.607Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*1oKn2ddjuaf6dL3eWi_ogg.jpeg" /></figure><p>In this article, we will make simple discord bot with node.js.</p><p>For that We firstly have to create an App on Discord <a href="https://discord.com/developers/applications">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RvYrkbVi9Jxg3I9_2OquoQ.png" /></figure><p>Once you’re logged in, click on <strong>‘New Application’</strong> at the top right of the window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kq0d86TLGa_bv0UP8N1T7g.png" /></figure><p>Then fill in the details of your app (i.e. name) and you will be taken to your app’s dashboard. Navigate to ‘Bot’ and click <strong>‘Add Bot’</strong> to enable your app as a bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oJVi-8S0_8hqFpicCrRHpQ.png" /></figure><p>Click on <strong>‘Copy’</strong> to copy your token and save it somewhere, we’ll need it for later.</p><p>And make all Privileged Gateway Intents options to enable and save it.</p><p><strong>Now Let’s install bot to server.</strong></p><p>Create a new Discord server with your Discord account to install the bot at.</p><p>Back at the App dashboard, navigate to ‘OAuth2/URL Generator’ and select <strong>‘bot’</strong> under the Scopes section.</p><p>And choose bot permissions(Administrator).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*98o1zAYXKxAI_RHqok8tQw.png" /></figure><p>You will see an URL being generated at the bottom. Copy this URL and paste it on a new tab. You will be redirected to the page as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ML2XQ0h62d-o_iLcP1KSiA.png" /></figure><p>Install this bot to your preferred Discord server.For example, mine is the NFTFV_Bot server I just created.</p><p><strong>From now Let’s make server code with node.js.</strong></p><pre>mkdir discordBot<br>cd discordBot<br>npm init<br>npm install discord.js axios dotenv</pre><p>Create index.js and type follow codes.</p><pre>require(&#39;dotenv&#39;).config();<br>const { Client, GatewayIntentBits, Partials } = require(&quot;discord.js&quot;);<br><br>const prefix = &quot;/&quot;;<br><br>const client = new Client({<br>    &#39;intents&#39;: [<br>        GatewayIntentBits.DirectMessages,<br>        GatewayIntentBits.Guilds,<br>        GatewayIntentBits.GuildBans,<br>        GatewayIntentBits.GuildMessages,<br>        GatewayIntentBits.MessageContent,<br>    ],<br>    &#39;partials&#39;: [Partials.Channel],<br>});<br><br>client.on(&#39;ready&#39;, () =&gt; {<br>  console.log(`Logged in as ${client.user.tag}!`);<br>});<br><br>client.on(&#39;messageCreate&#39;, msg=&gt;{<br>  if (!msg.content.startsWith(prefix)) return;<br><br>  if (msg.content === &quot;/start&quot;){<br>    msg.reply(&quot;I&#39;m your discord bot!&quot;);<br>  }<br>})<br><br>client.login(Input your token here);</pre><p>Great, now if we run the command below, our bot should go online:</p><pre>node index.js</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WE9ilH8Ep6Vj4bUI_HJEiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zgfw6BNUOL9yAw7umMl6Gg.jpeg" /></figure><h3>Conclusion: There’s more!</h3><p>There’s way more amazing things you can do with a Discord bot! Even ones that uses databases and so on. Feel free to explore the <a href="https://discord.com/developers/docs/intro">Discord Developer documentation</a> and the <a href="https://discord.js.org/">discord.js documentation</a> to learn more and build your own dream bot.</p><p>Thanks for reading. I hope this has been a helpful introduction on how to make Discord bot. If it’s helpful, do leave a like or share this article around for more reach.</p><p>For more information, please browse the Resources section below or see the code in this tutorial at <a href="https://github.com/victoria-lo/discordBot">https://github.com/victoria-lo/discordBot</a>.</p><p>If you have build an awesome Discord bot, please share it in the comments below. I would love to check it out! Cheers!</p><h3>Resources</h3><ul><li><a href="https://discord.com/developers/docs/intro">https://discord.com/developers/docs/intro</a></li><li><a href="https://discord.js.org/">https://discord.js.org/</a></li><li><a href="https://www.npmjs.com/package/axios">https://www.npmjs.com/package/axios</a></li><li><a href="https://www.npmjs.com/package/dotenv">https://www.npmjs.com/package/dotenv</a></li><li><a href="https://github.com/jaychandra6/MemeAPI">https://github.com/jaychandra6/MemeAPI</a></li><li><a href="https://www.w3schools.com/jsref/met_win_setinterval.asp">https://www.w3schools.com/jsref/met_win_setinterval.asp</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d1c88cc00f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create simple smart contract by solidity using Hardhat.]]></title>
            <link>https://nikitamartilove.medium.com/how-to-create-simple-smart-contract-by-solidity-using-hardhat-268de133f159?source=rss-dd202eefe90------2</link>
            <guid isPermaLink="false">https://medium.com/p/268de133f159</guid>
            <category><![CDATA[hard-hat]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[blocckhain]]></category>
            <dc:creator><![CDATA[Nikita Martilove]]></dc:creator>
            <pubDate>Thu, 09 Feb 2023 04:22:33 GMT</pubDate>
            <atom:updated>2023-02-09T05:19:28.640Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JQpZ33lfQ3BRX8NVJC1V6g.png" /></figure><p>In this article, we can learn how to create smart contract(ERC20) on Hardhat.</p><p>First of all You have to know about hardhat and install hardhat environment.</p><p><strong>So What is hardhat?</strong></p><p><strong>Hardhat </strong>is a development environment for Ethereum software. It consists of different components for editing, compiling, debugging and deploying your smart contracts and dApps, all of which work together to create a complete development environment.</p><p>Now Let’s install hardhat environment.</p><pre>npx hardhat</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*RiBg0HNh9lah7kv9Ph89AQ.png" /></figure><p>Then You can see like above picture.</p><p>You can choose one thing that you mind. Here we will choose ‘Create a JavaScript project’.</p><p>The hardhat has the following structure.</p><ul><li>contracts/ is where the source files for your contracts should be.</li><li>test/ is where your tests should go.</li><li>scripts/ is where simple automation scripts go.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SwZgzINjb63uGn72kQaKhQ.png" /></figure><p>If you need to change these paths, take a look at the <a href="https://hardhat.org/hardhat-runner/docs/config#path-configuration">paths configuration section</a>.</p><p>And then Install hardhat environment with npm or yarn.</p><pre>npm i hardhat @nomicfoundation/hardhat-toolbox<br><br>or <br><br>yarn add hardhat @nomicfoundation/hardhat-toolbox</pre><p>Now Let’s create a new Token.sol in contracts file.</p><p>You can create simple ERC20 contract with <strong>openzeppelin </strong>or<strong> </strong>from scratch<strong>.</strong></p><p>We will use <strong>openzeppelin</strong> <strong>open-source.</strong></p><p>At ERC20.sol of openzeppelin provide several default functions.</p><ul><li>name() //Returns the name of the token.</li><li>symbol() // Returns the symbol of the token, usually a shorter version of the name.</li><li>decimals() // Returns the number of decimals used to get its user representation.</li><li>totalSupply() // See {IERC20-totalSupply}.</li><li>balanceOf() // See {IERC20-balanceOf}.</li><li>transfer() // See {IERC20-transfer}.</li><li>allowance() // See {IERC20-allowance}.</li><li>approve() // See {IERC20-approve}.</li><li>transferFrom() // See {IERC20-transferFrom}.</li><li>_mint() // Creates `amount` tokens and assigns them to `account`, increasing the total supply.</li><li>_burn() // Destroys `amount` tokens from `account`, reducing the total supply.</li><li>_approve() // Sets `amount` as the allowance of `spender` over the `owner` s tokens.</li></ul><pre>npm i @openzeppelin/contracts</pre><p>Then Type code at Token.sol like follow code.</p><pre>// SPDX-License-Identifier: Apache-2.0<br><br>pragma solidity ^0.8.0;<br><br>import &quot;@openzeppelin/contracts/token/ERC20/ERC20.sol&quot;;<br>import &quot;@openzeppelin/contracts/access/Ownable.sol&quot;;<br><br>contract Token is ERC20, Ownable {<br>    constructor(string memory name, string memory symbol) ERC20(name, symbol) {<br>        _mint(msg.sender, 1e12 * 1e18);<br>    }<br><br>    /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).<br>    function mint(address _to, uint256 _amount) external onlyOwner {<br>        _mint(_to, _amount);<br>    }<br>}</pre><p>And for deploy contract we have to change deploy.js of scripts file.</p><pre><br>describe(&quot;Deploy simple Smart Contract&quot;, async function () {<br>    const Token = await hre.ethers.getContractFactory(&quot;Token&quot;);<br>    const token = await Token.deploy(&quot;TestToken&quot;, &quot;TToken&quot;);<br><br>    await token.deployed();<br><br>    console.log(<br>        &quot;simple erc20 contract deployed.&quot; + token.address<br>    );<br>});</pre><p>And we have to set hardhat.config.js.</p><pre>require(&quot;@nomicfoundation/hardhat-toolbox&quot;);<br><br>/** @type import(&#39;hardhat/config&#39;).HardhatUserConfig */<br>module.exports = {<br>  solidity: &quot;0.8.17&quot;,<br>};</pre><p>Ok. Deploy contract on hardhat network.</p><pre>npx hardhat test</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*RxyBvqavu85ak5RopOgcZw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*Zcys6vCs1lKQhdpGSr2FMw.jpeg" /></figure><p>From now You can deploy contract with hardhat perfectly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=268de133f159" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Connect wallet with Web3-Modal in React.js?]]></title>
            <link>https://nikitamartilove.medium.com/what-is-blockchain-technology-what-are-the-key-features-of-blockchain-28d36acd6731?source=rss-dd202eefe90------2</link>
            <guid isPermaLink="false">https://medium.com/p/28d36acd6731</guid>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Nikita Martilove]]></dc:creator>
            <pubDate>Thu, 19 Jan 2023 14:47:34 GMT</pubDate>
            <atom:updated>2023-02-09T05:03:45.407Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3wJlBs5zMwj7DNkB_tedgg.png" /></figure><p>In this article You will learn how to connect wallet using web3-modal with live code.</p><p>During the development of your project, you may encounter problems with connecting your wallet to a website.<br>In this case I prefer using web3-modal.</p><p><strong>Web3Modal</strong> is <strong>an easy-to-use library to help developers add support for multiple providers in their apps with a simple customizable configuration</strong>. By default Web3Modal Library supports injected providers like (Metamask, Rainbow, Brave Wallet, Dapper, Frame, Gnosis Safe, Tally, Web3 Browsers, etc) and WalletConnect.</p><p>Now Let’s learn about using web3-modal in React/Typescript step by step.</p><p>First of all, you have to install Node.js and NPM for building React/Typescript.</p><p>Create new React app for your project.</p><pre>npx create-react-app web3-modal</pre><p>After You must change your react-scripts to a version lower than 5.0</p><pre>npm i react-scripts@4.0.3</pre><p>And You can change src/App.js like below code.</p><pre>import logo from &#39;./logo.svg&#39;;<br>import &#39;./App.css&#39;;<br><br>function App() {<br>  return (<br>    &lt;div className=&quot;App&quot;&gt;<br>      &lt;header className=&quot;App-header&quot;&gt;<br>        &lt;img src={logo} className=&quot;App-logo&quot; alt=&quot;logo&quot; /&gt;<br>        &lt;p&gt;<br>          Connect Wallet Example<br>        &lt;/p&gt;<br>        &lt;button<br>          className=&quot;btn&quot;<br>        &gt;<br>          Connect Wallet<br>        &lt;/button&gt;<br>      &lt;/header&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><p>And Add “btn” class at src/App.css file</p><pre>.btn {<br>  padding: 10px;<br>  cursor: pointer;<br>  background-color: aqua;<br>  border: none;<br>}</pre><p>After Install Web3Modal NPM package</p><pre>npm install --save ethers@5.7.2 web3modal @walletconnect/web3-provider @coinbase/wallet-sdk<br><br># OR<br><br>yarn add ethers@5.7.2 web3modal @walletconnect/web3-provider @coinbase/wallet-sdk</pre><p>And Let’s create provider.js at src file.</p><pre>import WalletConnect from &quot;@walletconnect/web3-provider&quot;;<br>import CoinbaseWalletSDK from &quot;@coinbase/wallet-sdk&quot;;<br>// import Squarelink from &quot;squarelink&quot;;<br><br>export const provider = {<br>    walletlink: {<br>        package: CoinbaseWalletSDK, // Required<br>        options: {<br>            appName: &quot;Web 3 Modal Demo&quot;, // Required<br>            infuraId: &quot;9f8f5ec266c54f85aa9e66fbe230b077&quot;, // Required unless you provide a JSON RPC url; see `rpc` below<br>        },<br>    },<br>    walletconnect: {<br>        package: WalletConnect, // required<br>        options: {<br>            infuraId: &quot;9f8f5ec266c54f85aa9e66fbe230b077&quot;, // required<br>        },<br>    }<br>};</pre><p>Now Let’s change App.js file again like follow.</p><pre>import logo from &#39;./logo.svg&#39;;<br>import Web3Modal from &quot;web3modal&quot;;<br>import { ethers } from &quot;ethers&quot;;<br><br>import { provider } from &#39;./provider&#39;;<br>import &#39;./App.css&#39;;<br>import { useState } from &#39;react&#39;;<br><br>const web3Modal = new Web3Modal({<br>    cacheProvider: true, // optional<br>    provider, // required<br>});<br><br>function App() {<br><br>    const [address, setAddress] = useState(&quot;&quot;);<br><br>    const connectWallet = async () =&gt; {<br>        try {<br>            const provider = await web3Modal.connect();<br>            const library = new ethers.providers.Web3Provider(provider);<br>            const accounts = await library.listAccounts();<br>            const network = await library.getNetwork();<br>            const myaccount = accounts[0];<br>            setAddress(myaccount);<br>            console.log(network);<br>        } catch (e) {<br>            console.log(e.message);<br>        }<br>    }<br>    const disconnectWallet = async () =&gt; {<br>        setAddress(&quot;&quot;);<br>        await web3Modal.clearCachedProvider();<br>    }<br>    return (<br>        &lt;div className=&quot;App&quot;&gt;<br>            &lt;header className=&quot;App-header&quot;&gt;<br>                &lt;img src={logo} className=&quot;App-logo&quot; alt=&quot;logo&quot; /&gt;<br>                &lt;p&gt;<br>                    Connect Wallet Example<br>                &lt;/p&gt;<br>                {address === &quot;&quot; ? (<br>                    &lt;button onClick={() =&gt; { connectWallet() }}<br>                        className=&quot;btn&quot;<br>                    &gt;<br>                        Connect Wallet<br>                    &lt;/button&gt;<br>                ) : (<br>                    &lt;button onClick={() =&gt; { disconnectWallet() }}<br>                        className=&quot;btn&quot;<br>                    &gt;<br>                        {address.slice(0, 4) + &quot;...&quot; + address.slice(-4)}<br>                    &lt;/button&gt;<br>                )}<br>            &lt;/header&gt;<br>        &lt;/div&gt;<br>    );<br>}<br><br>export default App;</pre><p>Now Let’s start our app.</p><pre>npm start</pre><p>And then Let’s click ‘Connect Wallet’ button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X_HfKkP0tEveIIoRsNRZxg.png" /></figure><p>Then you can see Metamask connect Modal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HH6XpT61qMTGdpKIpOp-YQ.png" /></figure><p>Yes. Congratulation.<br>From now You can build Connect Wallet with Web3-modal.</p><p>And then If you want to get changing of Metamask, You can change your connectWallet function like follow at App.js.</p><pre>const connectWallet = async () =&gt; {<br>        try {<br>            const provider = await web3Modal.connect();<br>            provider.on(&quot;accountsChanged&quot;, (accounts) =&gt; {<br>                console.log(accounts);<br>            });<br><br>            // Subscribe to chainId change<br>            provider.on(&quot;chainChanged&quot;, (chainId) =&gt; {<br>                console.log(chainId);<br>            });<br><br>            // Subscribe to provider connection<br>            provider.on(&quot;connect&quot;, (info) =&gt; {<br>                console.log(info);<br>            });<br><br>            // Subscribe to provider disconnection<br>            provider.on(&quot;disconnect&quot;, (error) =&gt; {<br>                console.log(error);<br>            });<br>            const library = new ethers.providers.Web3Provider(provider);<br>            const accounts = await library.listAccounts();<br>            const network = await library.getNetwork();<br>            const myaccount = accounts[0];<br>            setAddress(myaccount);<br>            console.log(network);<br>        } catch (e) {<br>            console.log(e.message);<br>        }<br>    }</pre><p>Ok. We’ve done.</p><p>For using Web3-modal, Most important thing is change web-pack version.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28d36acd6731" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>