https://ethereum.org/en/

In this story, I will show how I created my family's virtual chore token in to live in the Ethereum blockchain, there are two reasons why I created mine, 1) learn more about Ethereum and smart contracts, 2) pay our kids with AguilaCoin instead of fiat — AguilaCoin is the name of our coin, start thinking about your token name!

A few notes:
* In this post I use token and coin interchangeably to refer to ERC-20 Token.
* Screenshots are from my mac instead of raspberry pi.

Index


A few weeks ago I showed my son a few of the games I created way back when I was at college, one was SpitBomb a multiplayer shooting game, we had a lot of fun playing for a few mins and then my son started suggesting improvements, I liked his ideas and I decided to create it from scratch with my new JavaScript skills.

SpitBomb v0.0.1

The full source code of the original SpitBomb is available at GitHub, I use JSE AWT Canvas to draw everything on the game, I created all the graphics using a program now extinct called Adobe Fireworks…


https://auth0.com/blog/jwt-json-webtoken-logo/

In my earlier story I wrote about how to best transfer from clients and how to best store passwords on the server side, you can check it our here, the next step up is to add authentication tokens, and I’m going to explain how to do that with JASON Web Tokens (JWT), also I will be providing the full source code at the end of the story.

The great thing about JWT is that its super simple to understand, implement and there are plenty of libraries for a variety of languages, I even contributed to one of them here and…


If you turn on the Developer Tools and inspect the traffic when logging in to a website you’re going to be surprised to see that many websites for big companies are sending your password in plain text, yes plain text, ok ok, it’s encrypted but only for the middle-man, not for the servers receiving the password; there are several reasons why I think this is wrong:

The websites we’re logging into will most likely contain…


application/json, application/x-www-form-urlencoded, and multipart/form-data

Alright, for this one I’ll be honest, it was not easy, because everywhere I looked there were solutions with third-party libraries or just partial theory information, and as you might already know, I’m learning Node.js and web technologies from scratch to know what’s going on under the hood.

The full source code is available at the end of this post, so if you know what you’re doing you can dive straight to it, if you’re also learning enjoy the read.

This project takes advantage of the learnings I shared in my previous posts, so I won’t be covering those topics…


For this story I’m going to be reusing the example I wrote for How to encode Node.js response from scratch, reading that story is only beneficial if you want to learn how to encode your responses from scratch without third-party modules, I’m particularly reusing it because I want to use the Content-Encoding header from the responses.

Browser caching comes out of the box, it is up to the server to send the correct caching information in the response header so that browsers can cache files on their end.

The headers that I’ll be using in this example are Cache-Control, Vary


In this story, I’ll be showing how to encode responses from Node.js using the built-in zlib library with gzip, deflate and br in a simple html site as shown below

<html lang="en">
<head>
<title>Encoding and Caching</title>
</head>
<body>
<h3>Encoding & Caching Example</h3>
<img id="ramboImg" alt="Rambo Gif" src="images/rambo.gif"/>
</body>
</html>

But before we jump into the weeds, I want to mention a two reasons why you would want to encode your response: smaller and faster responses. …


In this story I’ll be showing how to upload an image to a node.js server and from there uploading to a FTP server, then downloading the image from the FTP server and sending it back to the website as the response, and then the website will show it in an <img> tag.

Why is this useful? basically for learning, in real production environment I don’t think I’ll be using an FTP server, and if I do, it will have to be in a private network, a better choice for production apps is to upload files to Amazon S3 or Google’s…


Before jumping into Express or any other Node.js frameworks I want to learn a little low-level stuff so that I know what’s happening behind the scenes, so I decided to create a very simple app that shows an html with a button to select an image and then it uploads it to the node.js server as soon as its selected.

I decided not to use html forms also known as application/x-www-form-urlencoded to make it even simpler, I didn’t find any samples out there that did this, I bet there’s something out there but my search keywords didn’t find anything so…


In this story I’m going to talk about npm and node.js configurations, if you would like to read the first part of this series, check out the part 1.

Package Manager

npm is the standard package manager for Node.js, it contains over 350k packages, there’s also another package manager called yarn, which I won’t be talking about in this story, but I recommend reading about it.

Installing dependencies

If you’re creating a new project, you can install dependencies by running npm install <package_name>, there are several parameters you can use when executing this command as follows:

Salvador Guerrero

Computer Science Engineer, Cross-Platform App Developer, Open Source contributor. 🇲🇽🇺🇸

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store