<?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: Boluwatife Ayodele G</title>
    <description>The latest articles on DEV Community by Boluwatife Ayodele G (@yceethetechie).</description>
    <link>https://dev.to/yceethetechie</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%2F550893%2Fd7565d25-c9ed-4ec9-8eb1-545fabb2a2dc.jpeg</url>
      <title>DEV Community: Boluwatife Ayodele G</title>
      <link>https://dev.to/yceethetechie</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yceethetechie"/>
    <language>en</language>
    <item>
      <title> Generate a Blockchain Key Pair Address in Rust</title>
      <dc:creator>Boluwatife Ayodele G</dc:creator>
      <pubDate>Mon, 27 Dec 2021 12:06:17 +0000</pubDate>
      <link>https://dev.to/yceethetechie/generate-a-blockchain-key-pair-address-in-rust-4871</link>
      <guid>https://dev.to/yceethetechie/generate-a-blockchain-key-pair-address-in-rust-4871</guid>
      <description>&lt;p&gt;Hi, in this tutorial, we will be looking at how to generate a blockchain key pair address with the rust programming language. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8qaAMvQ0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vq2o1fegotuf7q4sjs3n.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8qaAMvQ0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vq2o1fegotuf7q4sjs3n.jpeg" alt="Image description" width="880" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[image credit : &lt;a href="https://connects.world"&gt;https://connects.world&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;In this project,two crates were used namely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Secp256k1[&lt;a href="https://docs.rs/secp256k1/latest/secp256k1/"&gt;https://docs.rs/secp256k1/latest/secp256k1/&lt;/a&gt;] &lt;/li&gt;
&lt;li&gt;anyhow (&lt;a href="https://crates.io/crates/anyhow"&gt;https://crates.io/crates/anyhow&lt;/a&gt;). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;Secp256k1&lt;/code&gt; is a Rust implementation of &lt;a href="https://github.com/sipa/secp256k1"&gt;the Pieter Wuille’s secp256k1 eliptic curve&lt;/a&gt;. The bitcoin network uses this eliptic curve for its public key generation algorithm too.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;anyhow&lt;/code&gt; crate is used for handling errors graciously in Rust.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Enough of the talking....&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;First, we declare a public function named &lt;code&gt;create_keypair()&lt;/code&gt; which returns a public key and private (secret) key pair. We then initiate the &lt;code&gt;secp256k1&lt;/code&gt; crate. On line 9 we used the random number generator &lt;code&gt;rng&lt;/code&gt; on the &lt;code&gt;secp256k1&lt;/code&gt; crate to generate a secure private key. On line 10, we generated the key-pairs by invoking the &lt;code&gt;generate_keypair&lt;/code&gt; method which takes a rng from line 9.&lt;/p&gt;

&lt;p&gt;The main function just makes a call to the &lt;code&gt;create_keypair()&lt;/code&gt; function, and then prints the output.&lt;/p&gt;

&lt;p&gt;Note: As you change the integer in &lt;code&gt;seed_from_u64&lt;/code&gt;, you get a different set of private and public keys.&lt;/p&gt;

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

&lt;p&gt;To run the code for this tutorial, add the following lines to your &lt;code&gt;Cargo.toml&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[dependencies]

secp256k1 = {version = "0.20.3", features = ["rand"]}
anyhow = "1.0.47"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open your terminal then execute &lt;code&gt;cargo run&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed the tutorial, you can drop your comments if you have questions.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
