<?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: Oniya Adesubomi Daniel</title>
    <description>The latest articles on DEV Community by Oniya Adesubomi Daniel (@adesubomi).</description>
    <link>https://dev.to/adesubomi</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%2F897265%2Fd4e260fe-bb7a-4b6c-bc63-bd235da51007.jpeg</url>
      <title>DEV Community: Oniya Adesubomi Daniel</title>
      <link>https://dev.to/adesubomi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adesubomi"/>
    <language>en</language>
    <item>
      <title>How to Generate bech32 Bitcoin Address</title>
      <dc:creator>Oniya Adesubomi Daniel</dc:creator>
      <pubDate>Fri, 27 Jan 2023 14:40:23 +0000</pubDate>
      <link>https://dev.to/adesubomi/how-to-generate-bech32-bitcoin-address-5ckc</link>
      <guid>https://dev.to/adesubomi/how-to-generate-bech32-bitcoin-address-5ckc</guid>
      <description>&lt;p&gt;Bitcoin addresses are used to receive and send transactions on the Bitcoin network, that’s not news.&lt;/p&gt;

&lt;p&gt;To generate an address, you need to have a private key. This private key is converted using cryptographic magic to a public key, and the public key is hashed to produce the address. You can learn more about the relevance of these cryptographic processes from Abubakar.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;But then, a little backstory;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Initially, Bitcoin addresses were based on a "Pay-to-Pubkey-Hash" (P2PKH) format, which used a public key hash as the address. These addresses began with the number "1."&lt;/p&gt;

&lt;p&gt;Later, a new address format called "Pay-to-Script-Hash" (P2SH) was introduced, which allowed for more complex scripts to be used in transactions. P2SH addresses begin with the number "3." This format was created to enable the use of multi-signature and other advanced features.&lt;/p&gt;

&lt;p&gt;Then, SegWit (short for Segregated Witness) was introduced, which modified the format of P2SH addresses. SegWit addresses, which begin with the number "3" as well, use a different hash and allow for more efficient use of block space, increased transaction capacity, and malleability fix.&lt;/p&gt;

&lt;p&gt;Finally, the Bech32 format was introduced, it's a new format of segwit address which has the prefix "bc1" and is more efficient in terms of space and offers error-checking capabilities.&lt;/p&gt;

&lt;p&gt;These address formats are all still in use today, but Bech32 is considered the most recommended format, as it offers the most benefits.&lt;/p&gt;

&lt;p&gt;In this article, we will demonstrate how to generate a SegWit address in the "Bech32" format using the bitcoinjs-lib and some other libraries that would help us achieve our goal. We are mostly writing TypeScript.&lt;/p&gt;

&lt;p&gt;The first step is to install the library by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i bitcoinjs-lib bip32 bip39
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next...&lt;/p&gt;

&lt;h3&gt;
  
  
  Generate a seed phrase
&lt;/h3&gt;

&lt;p&gt;A seed phrase is just some a set of words that can be rearranged randomly. These words have a range of allowed lengths (i.e. you can only use a seed phrase of a combination of 3, 6, 9, 12, 15, 18, 21 or 24 words). If these words are truly randomly generated, it is statistically impossible to generate 2 identical sets of seed phrase.&lt;/p&gt;

&lt;p&gt;This seed phrase should be kept save because whoever has the seed phrase would have access to any address generated from that seed phrase.&lt;/p&gt;

&lt;p&gt;Generate a seed phrase with this piece of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// required imports
const bip39 = require("bip39");

// code
const mnemonic bip39.generateMnemonic().toString();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>ai</category>
      <category>automation</category>
      <category>rpa</category>
    </item>
  </channel>
</rss>
