<?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: Matéush</title>
    <description>The latest articles on DEV Community by Matéush (@mateush).</description>
    <link>https://dev.to/mateush</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%2F971091%2Ff3ddd970-9474-47db-ab9d-742d10ad734a.jpeg</url>
      <title>DEV Community: Matéush</title>
      <link>https://dev.to/mateush</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mateush"/>
    <language>en</language>
    <item>
      <title>Partman Wizard - Partition tables from the command line</title>
      <dc:creator>Matéush</dc:creator>
      <pubDate>Wed, 28 Aug 2024 03:49:27 +0000</pubDate>
      <link>https://dev.to/mateush/partman-wizard-partition-tables-from-the-command-line-2l42</link>
      <guid>https://dev.to/mateush/partman-wizard-partition-tables-from-the-command-line-2l42</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/neon"&gt;Neon Open Source Starter Kit Challenge &lt;/a&gt;: Ultimate Starter Kit&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  My Kit
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Partman Wizard&lt;/strong&gt; is a CLI tool designed to help you partition PostgreSQL tables using the &lt;code&gt;pg_partman&lt;/code&gt; extension. This tool guides you through the process of setting up table partitions and migrating data efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What CLI can do?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create and configure partitions based on existing tables&lt;/li&gt;
&lt;li&gt;Migrate data from source tables to partitioned tables&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...in one CLI tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Kit
&lt;/h2&gt;

&lt;p&gt;You can browse the source code for the &lt;a href="https://github.com/mateuszsokola/partman-wizard" rel="noopener noreferrer"&gt;Partman Wizard on GitHub&lt;/a&gt;. For a quick start, simply run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx partman-wizard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see the tool in action, check out the video demonstration here: &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/t4qqf-Z0CKc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  The Journey
&lt;/h2&gt;

&lt;p&gt;I'm Mateusz, a software engineer with experience across startups, SMEs, and large enterprises. I am in this game since more than a decade and I can tell that I have seen a lot. &lt;/p&gt;

&lt;p&gt;Our company uses PostgreSQL in production, and one of our tables grew to over 10 million rows. Complex joins resulted in about 30 seconds of API response time (bottleneck was on the database side). The easiest solution to tackle this problem was either partitioning or materialized views. Materialized views weren't feasible since our SQL queries were always parametrized with user IDs. I found out about the &lt;code&gt;pg_partman&lt;/code&gt; extension but unfortunately, our PostgreSQL provider didn’t support it. That means we needed to manage partitioning manually. What a shame.&lt;/p&gt;

&lt;p&gt;A few days ago, I received an email from Dev.to saying there is a challenge related to PostgreSQL (Neon Open Source Starter Kit Challenge), and I thought it was the perfect opportunity to finally play with &lt;code&gt;pg_partman&lt;/code&gt;. I decided to build Partman Wizard to automate the process of partitioning large PostgreSQL tables. Now you can do it from your command line.&lt;/p&gt;

&lt;p&gt;PS. I am not sure if it meets your definition of a Starter Kit. I hope so.&lt;/p&gt;

&lt;p&gt;Thank you for considering my submission!&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>neonchallenge</category>
      <category>postgres</category>
      <category>database</category>
    </item>
    <item>
      <title>How To Build Oracles on Stellar</title>
      <dc:creator>Matéush</dc:creator>
      <pubDate>Sat, 17 Aug 2024 03:44:25 +0000</pubDate>
      <link>https://dev.to/mateush/how-to-build-oracles-on-stellar-4f11</link>
      <guid>https://dev.to/mateush/how-to-build-oracles-on-stellar-4f11</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/stellar"&gt;Build Better on Stellar: Smart Contract Challenge &lt;/a&gt;: Create a Tutorial&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Your Tutorial
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/mhUUQqo_dlg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;You can find the &lt;a href="https://github.com/mateuszsokola/stellar-swiss-trains-oracle" rel="noopener noreferrer"&gt;code on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Created
&lt;/h2&gt;

&lt;p&gt;Many blockchain apps focus on advanced financial techniques that might be too complex to understand for beginners. I decided to take more modest approach and focus on the real-world scenarios. I recorded a screencast on building an oracle for tracking trains in Switzerland. In the end, (almost) everyone knows what trains are and how they work. Thanks to this I was able to explain this topic in a simple fashion.&lt;/p&gt;

&lt;p&gt;I had only 8 days to complete this challenge, so I needed to narrow down the scope and focused on one train only. I chose the IR36 train from Basel to Zürich HB.&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%2F5swz8t9vbisihhnyetcp.png" 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%2F5swz8t9vbisihhnyetcp.png" alt="Image description" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my screencast, viewers will learn how to write smart contracts and oracles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;I am Mateusz and I work as an SWE for one blockchain company called stakefish. My primary focus has been on Ethereum development, particularly around staking services (yes, i built oracles before and they are managing millions of dollars in Ethereum). I work with a bunch of programming languages including Python, JavaScript, and Java. &lt;/p&gt;

&lt;p&gt;However, I consider myself more of a "jack of all trades but master of none," but I am always eager to learn new things. When I stumbled upon the Build Better on Stellar: Smart Contract Challenge, I saw it as a fantastic opportunity not only expand my knowledge (learn Rust) but also teach other.&lt;/p&gt;

&lt;p&gt;I am proud of how the Swiss Train Tracker project turned out. It demonstrates the power of blockchain in tracking the real-world data. Moving forward, I consider this project as completed but I will definitely continue exploring Rust. I hope to further contribute to the ecosystem by developing innovative solutions and sharing my knowledge with the community.&lt;/p&gt;

&lt;p&gt;Mateusz&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>stellarchallenge</category>
      <category>blockchain</category>
      <category>web3</category>
    </item>
    <item>
      <title>Ethereum ️and JavaScript: Cheatsheet</title>
      <dc:creator>Matéush</dc:creator>
      <pubDate>Sat, 12 Nov 2022 07:22:25 +0000</pubDate>
      <link>https://dev.to/mateush/ethereum-javascript-cheatsheet-4afe</link>
      <guid>https://dev.to/mateush/ethereum-javascript-cheatsheet-4afe</guid>
      <description>&lt;p&gt;Even if you don't believe Bitcoin and Ethereum will recover, there are still plenty of job opportunities in Web3 and Metaverse fields. It might be something worth dipping your feet into it since it might be a beginning of good career. I started to work in crypto more than a year ago, and I decided to write this cheatsheet to Ethereum and JavaScript because it wasn't that easy to find. You find here examples how to use the most popular libraries to build distributed apps including creating wallets, signing messages and sending transactions. Using code!&lt;/p&gt;

&lt;p&gt;I must mention this at the very beginning. we will use Görli testnet to perform all operations in this article. We will not use any tokens that have monetary value, so you don't need to worry about your funds.&lt;/p&gt;

&lt;p&gt;What makes this article unique is that we will focus only on the most practical aspects rather than building entire Next.JS app like I used to do in my previous articles. If you feel like you need to refresh the complete process of creating the entire app from scratch you should read my article on &lt;a href="https://www.freecodecamp.org/news/how-to-make-2048-game-in-react/" rel="noopener noreferrer"&gt;How to Build 2048 Game in React&lt;/a&gt; which I published a few months ago.&lt;/p&gt;

&lt;p&gt;This article contains a few external resources such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://eth-faucet-alpha.vercel.app/" rel="noopener noreferrer"&gt;Görli ETH Faucet&lt;/a&gt; - example app built by me. It will allow you to play with your MetaMask wallet. &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/mateuszsokola/eth-faucet" rel="noopener noreferrer"&gt;Source code (GitHub)&lt;/a&gt; - feel free to fork/clone/play with it on your own. &lt;/li&gt;
&lt;li&gt;...and a YouTube video. It took me more than a month to prepare all code for this tutorial, so it would mean the world to me if you watch it, smash the like button, and subscribe to my channel.
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/M0tX6l6INqY"&gt;
&lt;/iframe&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you!&lt;/p&gt;

&lt;h2&gt;
  
  
  Brief intro
&lt;/h2&gt;

&lt;p&gt;I will skip explaining what is blockchain and it is changing the world. I don't expect you to know anything about blockchain but it might be useful. If you have any questions &lt;a href="https://twitter.com/msokola" rel="noopener noreferrer"&gt;you can ping me on Twitter&lt;/a&gt;. &lt;br&gt;
If you want to perform transaction on Ethereum you need a wallet. There are two kind of wallets - soft(ware) wallets and hardware wallets. Hardware wallets are more secure since it is harder to steal their credentials (private keys and mnemonics). Since we are only practicing, we will use a soft wallets in this article. The most popular one is MetaMask. You can use install it as a browser extension and it is free charge. If you don't have it yet - &lt;a href="https://metamask.io/download/" rel="noopener noreferrer"&gt;you can download it from here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Libraries
&lt;/h2&gt;

&lt;p&gt;Once you have your wallet, we can start coding. First, we need to install two essential libraries for Ethereum development - &lt;code&gt;ethers&lt;/code&gt; and &lt;code&gt;useDapp&lt;/code&gt;. BTW. I'm using &lt;code&gt;yarn&lt;/code&gt; in this article but if you are more familiar with &lt;code&gt;npm&lt;/code&gt; you can use it as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add ethers @usedapp/core 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ethers&lt;/code&gt; - allows developers to interact with blockchain. Retrieve data, send transactions, sign messages, creating wallets, and many other things.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;useDapp&lt;/code&gt; - it is an ethers wrapper for React. It offers plenty of hooks to connect wallet, retrieve balance, send transaction so developers don't need to interact with low level APIs. We will use it out of convenience.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Let's configure React
&lt;/h2&gt;

&lt;p&gt;All required libraries are install, so we are good to setup our React app. In the main file, we need to activate &lt;code&gt;useDapp&lt;/code&gt; by adding &lt;code&gt;DAppProvider&lt;/code&gt; with the Ethereum API configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// file: pages/_app.tsx
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import { DAppProvider, Goerli } from '@usedapp/core'

const config = {
  readOnlyChainId: Goerli.chainId,
  readOnlyUrls: {
    [Goerli.chainId]: "https://goerli.infura.io/v3/00000000000000000000000000000000"
  }
}
function MyApp({ Component, pageProps }: AppProps) {
  return (&amp;lt;DAppProvider config={config}&amp;gt;&amp;lt;Component {...pageProps} /&amp;gt;&amp;lt;/DAppProvider&amp;gt;)
}

export default MyApp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see we need to provide Ethereum API to DAppProvider. Where can we find one? For development I would &lt;a href="https://www.infura.io/" rel="noopener noreferrer"&gt;create a free account on Infura.io&lt;/a&gt; and generate API keys for Ethereum. It is the easiest way. &lt;br&gt;
When you created you account and logged in into your dashboard. You must click on "Create new key"button  in the top right corner, and choose "Web3 API (Formerly Ethereum)", and name your project however you want - in my case it is &lt;code&gt;fluffykitten&lt;/code&gt;.&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%2F6soxiwydfrvs9yh2pqc9.png" 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%2F6soxiwydfrvs9yh2pqc9.png" alt="Image description" width="800" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we need to choose GÖRLI network from the dropdown and copy the API link:&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%2Friz62xor06fnlrpurp7p.png" 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%2Friz62xor06fnlrpurp7p.png" alt="Image description" width="800" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have it we are good to go.&lt;/p&gt;
&lt;h2&gt;
  
  
  Signing messages
&lt;/h2&gt;

&lt;p&gt;One of the most important features of every wallet is ability to sign messages. It will be very important to us since we can use this signed message to authenticate users. How come? If user was able to sign message with their wallet - we can assume the own it it, and can execute transactions from it. It is a very common approach in the Web3 development.&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%2Fnrgyibjo1t7og1jy21wv.png" 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%2Fnrgyibjo1t7og1jy21wv.png" alt="Image description" width="800" height="1240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sounds great, right? But how can we use it in React? It is simple. We should use &lt;code&gt;useEthers&lt;/code&gt; hook, offered by &lt;code&gt;useDapp&lt;/code&gt;, and we extract from it the library property (line 6). It will allow us to interact with user's wallet. &lt;br&gt;
Now let's define the &lt;code&gt;signMessage&lt;/code&gt; function. We will use to call the library to retrieve the wallet signer. Signer allows us to request transactions and signing messages from user's wallet. The user will need to approve those action - check the screenshot with MetaMask modal above. &lt;br&gt;
Once we have the signer we can call the signMessage method with the text message we want to sign with this wallet address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// file: pages/Home.tsx
import { useEthers } from '@usedapp/core'
import type { NextPage } from 'next'

const Home: NextPage = () =&amp;gt; {
  const { library } = useEthers()

  const signMessage = async () =&amp;gt; {
    const signer = library?.getSigner()
    const signature = await signer?.signMessage("Fluffykitten FTW!")
    alert(signature)
  }

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;button onClick={signMessage}&amp;gt;Claim&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default Home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to verify signed messages?
&lt;/h2&gt;

&lt;p&gt;When the message has been signed we can send it to somebody along with the wallet address, and signature, so they can confirm if message was actually signed by given wallet. Often, this mechanism is used to make users sign some agreements such as terms of service or EULAs. &lt;/p&gt;

&lt;p&gt;Developers usually prepare API endpoints to verify those sort of messages and record them in databases for legal reasons. Let's assume we want to verify the signed message on our own. How we can do this? &lt;/p&gt;

&lt;p&gt;First, we need to install one more package called &lt;code&gt;@metamask/eth-sig-util&lt;/code&gt;. You can do this by running the following command in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add @metamask/eth-sig-util 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need to import &lt;code&gt;recoverPersonalSignature&lt;/code&gt; from this package and pass the message and signature to it. It will return the address that actually signed this message. Afterwards, we just need to compare returned address with the address given by user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { recoverPersonalSignature } from "@metamask/eth-sig-util"

const address = "0x00000000000000000000000000000000
const message = "Fluffykitten FTW!"
const signature = "0x00000000000000000000000000000000000000000000000000000000000000000000000000000"

const recoveredAddress = recoverPersonalSignature({ data: message, signature})

if (recoveredAddress === address) {
  console.log('OK! SIGNATURE MATCHED!'
}

console.log('STOP! SIGNATURE MISMATCH!'

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  How to use Ethereum in Node.js?
&lt;/h3&gt;

&lt;p&gt;Now you know how to interact with Ethereum using React and browser wallets but it gets a bit more tricky when it comes to Node.JS. In Node.JS, you will need to call blockchain using low level libraries such as ethers. It might be intimidating at the beginning but I will give you some tips how to get started.&lt;/p&gt;

&lt;p&gt;First, we need to create a wallet using ethers. It is very simple - we just need to get to the &lt;code&gt;Wallet&lt;/code&gt; namespace and call the &lt;code&gt;createRandom&lt;/code&gt; method. It will return new wallet credentials.&lt;br&gt;
&lt;/p&gt;

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

const wallet = ethers.Wallet.createRandom()

console.log("Your new Ethereum wallet credentials:")
console.log("Wallet address", wallet.address)
console.log("Private key", wallet.privateKey)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;BE CAREFUL: You need to protect your private key and never reveal it to anyone! If somebody intercepts it they will be able to control the wallet and steal your funds.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where can I get free testnet Ether?
&lt;/h3&gt;

&lt;p&gt;Now you have your wallet ready so we need to top it up with testnet Ether. You can get some from &lt;a href="https://eth-faucet-alpha.vercel.app/" rel="noopener noreferrer"&gt;my Görli ETH faucet&lt;/a&gt;. Just use your browser, connect your MetaMask wallet, and click on the Claim button. Obviously, you will need to sign a message first to authenticate this wallet. The real use case of signing messages, isn't it? &lt;/p&gt;

&lt;p&gt;Once you got your testnet Ether, we will send it to the wallet address created using ethers. Just copy the address to your clipboard, and follow the screenshots. &lt;br&gt;
First, click on the "Send" button (marked with the purple circle on the screenshot below).&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%2F3bcv3iocusmcsge03djc.png" 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%2F3bcv3iocusmcsge03djc.png" alt="Image description" width="716" height="900"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you need to provide the receiver wallet address, amount of tokens, and click on the "Next" button.&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%2Fwijc7dp6qa4j0h04yxpn.png" 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%2Fwijc7dp6qa4j0h04yxpn.png" alt="Image description" width="716" height="1200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we need to review our transaction and click "Confirm".&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%2Fr9qyogjlv1s6mdcxd4x4.png" 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%2Fr9qyogjlv1s6mdcxd4x4.png" alt="Image description" width="714" height="1202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now our transaction is being broadcasted. It should reach the receiver wallet within 3 minutes.&lt;/p&gt;
&lt;h3&gt;
  
  
  How to send transaction using ethers?
&lt;/h3&gt;

&lt;p&gt;Now we gonna do the same exercise we did in the previous step but using code. The code snippet is a bit longer and more complex this time, so I will drop it here and explain everything below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const infuraUrl = "https://goerli.infura.io/v3/00000000000000000000000000000000"
const chainId = 5 // Görli network
const provider = new ethers.providers.JsonRpcProvider(infuraUrl, chainId)

const privateKey = "0x0000000000000000000000000000000000000000000000000000000000000000"
const wallet = new ethers.Wallet(privateKey, provider)

// 1 ETH = 1 * 10 ** 18 wei
const amountInWei = BigInt(1 * 10 ** 18)
const receiver = "0x00000000000000000000000000000000"
const trx = {
    to: receiver,
    value: ethers.BigNumber.from(amountInWei.toString())
}
await wallet.sendTransaction(trx)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the first three lines, we are configuring the Ethereum API. It is exactly the same API endpoint we used before to setup &lt;code&gt;useDapp&lt;/code&gt;. The &lt;code&gt;chainId&lt;/code&gt; needs to be set to &lt;code&gt;5&lt;/code&gt; since we want to use Görli testnet. If you need to use Mainnet (aka production) change it to &lt;code&gt;1&lt;/code&gt; but then you will operate on the real Ether (aka real money). Obviously you need to have some real Ethers before you spend them. &lt;/p&gt;

&lt;p&gt;In line 3 we are establishing connection to the Ethereum API.&lt;br&gt;
In line 4 and 5 we setup wallet using credentials we created earlier on. We need to pass the private key and the Ethereum API connector.&lt;/p&gt;

&lt;p&gt;In line 6, we are defining the amount of tokens we want  to send to the receiver - in our case it is 1 Ether. Before we send this transaction we need to convert this amount into the smallest unit on Ethereum which is  &lt;code&gt;Wei&lt;/code&gt;. Ethereum has 18 digits in decimals, so you need to use special classes such as BigInt and BigNumber to fit those numbers to memory. &lt;/p&gt;

&lt;p&gt;How much is 1 Ether in Wei? 1 Ether = 1000000000000000000 Wei (18 digits)&lt;/p&gt;

&lt;p&gt;In line 7, we define the receiver wallet address.&lt;/p&gt;

&lt;p&gt;In line 8, we construct the transaction object. Notice we need to convert the BigInt number into BigNumber that comes from ethers. It is super important to convert into the type understood by Ethereum.&lt;/p&gt;

&lt;p&gt;and in line 9 we perform the transaction. &lt;/p&gt;

&lt;h2&gt;
  
  
  Last words
&lt;/h2&gt;

&lt;p&gt;My main idea for this article was giving a cheatsheet how to start interacting with Ethereum blockchain without reading long documentations and white papers. That's all I could do in less than 2000 words. I hope you find it useful.&lt;br&gt;
At the beginning I mentioned, I built an example app for this article &lt;a href="https://github.com/mateuszsokola/eth-faucet" rel="noopener noreferrer"&gt;you can find it on my Github&lt;/a&gt;. If you like it please give it a star on Github! Thank you.&lt;/p&gt;

&lt;p&gt;Recently I am more &lt;a href="https://twitter.com/msokola" rel="noopener noreferrer"&gt;active on Twitter&lt;/a&gt;! I'd appreciate if you follow me!&lt;/p&gt;

&lt;p&gt;If you found this article helpful please share it, so more developers can learn from it. Occasionally &lt;a href="https://twitter.com/msokola" rel="noopener noreferrer"&gt;I publish videos on my YouTube channel&lt;/a&gt;, and it would be great if you subscribe, hit the like button, and drop a comment under your favourite video.&lt;/p&gt;

&lt;p&gt;Stay tuned!&lt;/p&gt;

&lt;p&gt;PS. I published a few similar articles on FreeCodeCamp before, just take a look:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/news/how-to-make-2048-game-in-react/" rel="noopener noreferrer"&gt;React Tutorial – How to Build the 2048 Game in React&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/news/how-to-use-feature-toggles-in-next-js-and-react/" rel="noopener noreferrer"&gt;Build Your Own Feature Toggle with Next.js and React in Under 30 Minutes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/news/how-to-build-a-serverless-app/" rel="noopener noreferrer"&gt;How to Build a Fully Functional Serverless App in Under Two Hours&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/news/how-to-deploy-react-apps-to-production/" rel="noopener noreferrer"&gt;How to Deploy a React App to Production Using Docker and NGINX with API Proxies&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>blockchain</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
