<?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: hyetigran</title>
    <description>The latest articles on DEV Community by hyetigran (@hyetigran).</description>
    <link>https://dev.to/hyetigran</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%2F709780%2Fb04060e4-4020-4845-b04b-e5e03d1fc75f.png</url>
      <title>DEV Community: hyetigran</title>
      <link>https://dev.to/hyetigran</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hyetigran"/>
    <language>en</language>
    <item>
      <title>Engineering Resolution 2022</title>
      <dc:creator>hyetigran</dc:creator>
      <pubDate>Sun, 02 Jan 2022 11:32:40 +0000</pubDate>
      <link>https://dev.to/hyetigran/engineering-resolution-2022-4bmm</link>
      <guid>https://dev.to/hyetigran/engineering-resolution-2022-4bmm</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BEnpLVzO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqoo7n7u0mihf4oibzev.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BEnpLVzO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqoo7n7u0mihf4oibzev.jpeg" alt="Lightbulb and idea bubbles" width="880" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is a list of technologies, projects and goals on my radar for the new year, 2022.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Portfolio site with Nextjs&lt;/strong&gt;&lt;br&gt;
My current portfolio site, atigran.com, was built over two years ago when I was fresh out of bootcamp. It is dated and needs a total makeover. Having recently used nextjs, I'm looking to completely redesign my site and as a stretch, add a Blog component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Standard Coin&lt;/strong&gt;&lt;br&gt;
I built a mobile app using React-Native that combines three products into one. The portfolio tracker, markets and wallet have been complete and deployed to TestFlight. In 2022, I hope to go even further by adding the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I hope to see the app approved into the App Store&lt;/li&gt;
&lt;li&gt;Create a landing page using Nextjs and TailwindCSS&lt;/li&gt;
&lt;li&gt;Improve the UI/UX of the application to look and feel top notch&lt;/li&gt;
&lt;li&gt;Make optimizations like adding a markets micro service&lt;/li&gt;
&lt;li&gt;Recruit 2-3 contributors who are excited about building/learning&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Courses on Udemy&lt;/strong&gt;&lt;br&gt;
The list cannot be complete without including continuing education. Among the many courses in my queue, the two I'm most excited about are the Docker/Kubernetes and Blockchain courses. Of course, just passively watching the content is not enough to retain knowledge. I'd like to exercise the skills in existing or new projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS Certifications&lt;/strong&gt;&lt;br&gt;
Dev Ops is an increasingly important and interesting skill set to have. I'd like to gain the Solutions Architect and Developer Operations certificates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Triplebyte Assessments&lt;/strong&gt;&lt;br&gt;
Triplebyte is currently my favorite recruitment platform and I'd like to improve my ranking by completing as many relevant assessments as I can with a score of 3 or above.&lt;br&gt;
-Backend&lt;br&gt;
-Frontend&lt;br&gt;
-SQL&lt;br&gt;
-Python&lt;br&gt;
-General Coding&lt;br&gt;
-Full Stack Architecture&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other&lt;/strong&gt;&lt;br&gt;
Some minor objectives on my list is to learn a new language and applying to a project. Potential languages include C, C++ or Rust. However, Java, Kotlin and Swift are also strong contenders.&lt;br&gt;
In addition, I would like to increase my Stackoverflow reputation to over 1000.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>goals</category>
      <category>career</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Unable to resolve module crypto</title>
      <dc:creator>hyetigran</dc:creator>
      <pubDate>Sat, 02 Oct 2021 17:36:37 +0000</pubDate>
      <link>https://dev.to/hyetigran/unable-to-resolve-module-crypto-1gek</link>
      <guid>https://dev.to/hyetigran/unable-to-resolve-module-crypto-1gek</guid>
      <description>&lt;p&gt;&lt;a href="https://media.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%2Ftfmrdmiykj195p06qc98.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ftfmrdmiykj195p06qc98.jpeg" alt="Alt Text" width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem
&lt;/h3&gt;

&lt;p&gt;If you're a JavaScript/Web developer interested in working with Bitcoin then you've undoubtedly come across, &lt;em&gt;bitcore&lt;/em&gt;, one of the widely used libraries. It is an open-source software published and maintained by Bitpay and used in many popular tutorials such as &lt;a href="https://www.youtube.com/watch?v=_o-zcP1AyQc&amp;amp;list=PL1mkWlKl32oddt02un0if2ooy7w2jOczP" rel="noopener noreferrer"&gt;BCH Wallet&lt;/a&gt; and &lt;a href="https://www.pluralsight.com/courses/bitcoin-decentralized-technology" rel="noopener noreferrer"&gt;Pluralsight&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, the library was designed for web apps and will break your React Native mobile app if used 'out-of-the-box'.&lt;/p&gt;

&lt;p&gt;In our basic code example below, we try to initialize a new private key on initial app render.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;App.js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function App() {

  const [privateKey, setPrivateKey] = useState();

  useEffect(() =&amp;gt; {
    setPrivateKey(new bitcore.PrivateKey("testnet"));
  }, []);

  return (
    &amp;lt;View style={styles.container}&amp;gt;
      &amp;lt;Text&amp;gt;{`Testnet private key: ${privateKey}`}&amp;lt;/Text&amp;gt;
      &amp;lt;StatusBar style="auto" /&amp;gt;
    &amp;lt;/View&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;em&gt;bitcore.privateKey&lt;/em&gt; method will throw the following error message: &lt;strong&gt;Unable to resolve module crypto...&lt;/strong&gt; which results in the 'red screen of death'.&lt;/p&gt;

&lt;p&gt;Alternatively, you may also see &lt;strong&gt;Unable to resolve module buffer...&lt;/strong&gt; message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fd7cjay9rwdxmn0try4g9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fd7cjay9rwdxmn0try4g9.png" alt="Unable to resolve module crypto" width="750" height="1334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Reason
&lt;/h3&gt;

&lt;p&gt;The gist of it is that React Native does not use the Node runtime environment and thus does not have access to specific libraries such as 'crypto', 'assert', 'url', etc. For the vast majority of use cases, this is not a problem, but working with cryptocurrency happens to be an exception.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;There are &lt;a href="https://gist.github.com/parshap/e3063d9bf6058041b34b26b7166fd6bd" rel="noopener noreferrer"&gt;several workarounds&lt;/a&gt; that exist and unfortunately all of them lack elegance.&lt;/p&gt;

&lt;p&gt;In this example, we use rn-nodeify to enable core node modules in our React Native app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: eject expo&lt;/strong&gt;&lt;br&gt;
If your app is using the expo managed workflow, you'll need to eject.&lt;/p&gt;

&lt;p&gt;This is an irreversible process.&lt;/p&gt;

&lt;p&gt;By ejecting, you will no longer be able to use some of the expo cli commands such as start, build, etc. Also, you'll need to use xcode and android studio directly in order to run  the app in the development environment.&lt;/p&gt;

&lt;p&gt;On the other hand, all expo specific libraries (i.e. @expo/vector-icons, expo-splash-screen, etc) will work with little to no tweaks.&lt;/p&gt;

&lt;p&gt;To eject:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;From your project directory, run &lt;code&gt;expo eject&lt;/code&gt;. This will download the required dependencies and build native projects under the ios and android directories.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Source: &lt;a href="https://docs.expo.dev/expokit/eject/" rel="noopener noreferrer"&gt;expo docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After running the above command, your project directory should now contain &lt;em&gt;android&lt;/em&gt; &amp;amp; &lt;em&gt;ios&lt;/em&gt; directories and &lt;em&gt;index.js&lt;/em&gt; &amp;amp; &lt;em&gt;metro.config.js&lt;/em&gt; files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1.5: run app in simulator via xcode&lt;/strong&gt;&lt;br&gt;
Update libraries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delete package-lock file if you have one&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;yarn&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Change to ios directory &lt;code&gt;cd ios&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Delete the podfile.lock if you have one&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;pod install&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Open xcode and select &lt;em&gt;Open a project or file&lt;/em&gt; option. Navigate to the &lt;strong&gt;ios&lt;/strong&gt; directory and select open.&lt;/p&gt;

&lt;p&gt;Click the play button to build and run your app on ios simulator.&lt;/p&gt;

&lt;p&gt;It is very common at this stage to run into issues usually dealing with updating packages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: install package rn-nodeify&lt;/strong&gt;&lt;br&gt;
In the root directory of your app run the following command:&lt;br&gt;
&lt;code&gt;yarn add rn-nodeify -D&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command creates a boilerplate file, &lt;em&gt;shim.js&lt;/em&gt;, in the root directory. Import this file at the very top of your &lt;em&gt;index.js&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import "./shim";&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: modify package.json file&lt;/strong&gt;&lt;br&gt;
Update the package.json file to include a &lt;em&gt;postinstall&lt;/em&gt; script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; "scripts": {
    "start": "react-native start",
    ~~~
    "postinstall": "node_modules/.bin/rn-nodeify --install crypto,assert,url,stream,events --hack"
  },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Through a bit of trial and error I discovered that the above packages in the postinstall script are necessary dependencies for the bitcore library.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: restart your app&lt;/strong&gt;&lt;br&gt;
Close down your metro terminal, simulator and then restart your app by pressing the &lt;em&gt;play&lt;/em&gt; button in Xcode.&lt;/p&gt;

&lt;p&gt;You should see the following screen:&lt;br&gt;
&lt;a href="https://media.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%2Fui551scgcqerpn5kr9bu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fui551scgcqerpn5kr9bu.png" alt="crypto error fixed" width="800" height="1731"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations, you're now on your way to creating the next crypto app.&lt;/p&gt;

&lt;p&gt;It is possible to run into additional errors at this stage. For example, on my second attempt at this process, I was getting 'Process could not be found in this project' error. I simply had to 'yarn add process' to get it working again.&lt;/p&gt;

&lt;p&gt;As an aside, this method hasn't been battle tested and could potentially have security issues.&lt;/p&gt;

</description>
      <category>crypto</category>
      <category>reactnative</category>
      <category>bitcoin</category>
      <category>expo</category>
    </item>
  </channel>
</rss>
